This is a java port of the PHP Client.
- In order to use the API a Mollie account is required.
- Java >= 6
- Gradle build system
gradle build
Initializing the Mollie API client, and setting your API key.
MollieClient client = new MollieClient();
try {
client.setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");
} catch (MollieException e) {
e.printStackTrace();
}
Creating a new payment.
try {
Payment payment = client.payments().create(new BigDecimal("10.00"),
"My first API payment",
"https://webshop.example.org/order/12345/",
null
);
} catch (MollieException e) {
e.printStackTrace();
}
After creation, the payment id is available in the payment.id
property. You should store this id with your order.
Retrieving a payment.
try {
Payment payment = client.payments().get(payment.id);
if (payment.isPaid()) {
System.out.println("Payment received.");
}
} catch (MollieException e) {
e.printStackTrace();
}
BSD (Berkeley Software Distribution) License. Copyright (c) 2015-2015, Impending