Java

Follow the simple steps below and get started developing.

Add Java SDK Dependency


Add the following dependency to your POM.

<dependency> <groupId>com.simplify</groupId> <artifactId>payments-sdk-java</artifactId> <version>1.10.0</version> </dependency>

Add the following dependency to your Gradle configuration.

'com.simplify:payments-sdk-java:1.10.0'

Add the following dependency to your Ivy configuration.

<dependency org="com.simplify" name="payments-sdk-java" rev="1.10.0"/>

Using the SDK

View Javadoc View Java API

The objects you will most likely be interacting with are the objects in the package: com.simplify.payments.domain

Set your API Keys

After logging into your account, your API keys can be located at: Settings -> API Keys

To set your public and private API keys do the following:

PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";

Another option is to pass the api keys as arguments to each API invocation.

Examples

Charging a card

You can charge a card in 2 ways. Once you have generated a card token using simplify.js, you can charge the card using the token. Alternatively, you can also charge a card by passing the card details.

For more information on the simplify.js go to Payments Form

PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";

PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
Payment payment = Payment.create(new PaymentsMap()
    .set("currency", "USD")
    .set("token", "f21da65e-f0ab-45cb-b8e6-40b493c3671f") // returned by JavaScript call
    .set("amount", 1000) // In cents e.g. $10.00
    .set("description", "prod description"));

if ("APPROVED".equals(payment.get("paymentStatus"))) {
    System.out.println("Payment approved");
}
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Payment payment = Payment.create(new PaymentsMap()
    .set("currency", "USD")
    .set("card.cvc", "123")
    .set("card.expMonth", 11)
    .set("card.expYear", 99)
    .set("card.number", "5555555555554444")
    .set("amount", 1000) // In cents e.g. $10.00
    .set("description", "prod description"));

if ("APPROVED".equals(payment.get("paymentStatus"))) {
    System.out.println("Payment approved");
}

For more examples see the api documentation or our tutorial