Skip to content

freddietilley/mollie-api-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Java port of the mollie api client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages