Skip to content

Splitty-Pay/splittypay-java-sdk

Repository files navigation

Splitty Pay Java Client

Java client to consume Splitty Pay API.

Usage

Library artifactory is published on Maven Central.

<dependency>
  <groupId>com.splittypay</groupId>
  <artifactId>splittypay-java-sdk</artifactId>
  <version>{VERSION}</version>
</dependency>

Sample application

Following code provides a brief example that show how Splitty Pay Client can be used to create a Payment Request.

To generate the access token, visit Splitty Pay authentication documentation.

public class CreatePaymentRequest {

  public static void main(String[] args) {

    private SplittyPayClient splittyPayClient = SplittyPayClient.newSplittyPayClientFor(SplittyPayEnvironment.SANDBOX, {ACCESS_TOKEN});

    PaymentResponse paymentResponse = splittyPayClient.createPayment(PaymentRequest.builder()
                .cart("123")
                .currency("EUR")
                .notificationUrl("https://splittypay.com")
                .cancelUrl("https://errorUrl")
                .successUrl("https://successUrl")
                .amount(10000)
                .details(Details.builder()
                        .email("example@splittypay.com")
                        .language("IT")
                        .build()
                ).build());
    );
  }
}

In src/test directory can be found more examples that show how Splitty Pay client can be used for the more advanced operations.