Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 1.41 KB

README.md

File metadata and controls

62 lines (47 loc) · 1.41 KB

Mollie API client for java

This is a java port of the PHP Client.

Requirements

  • In order to use the API a Mollie account is required.
  • Java >= 6
  • Gradle build system

Building

gradle build

Basic Usage

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();
    }

License

BSD (Berkeley Software Distribution) License. Copyright (c) 2015-2015, Impending