Skip to content

Latest commit

 

History

History
85 lines (64 loc) · 2.68 KB

File metadata and controls

85 lines (64 loc) · 2.68 KB

Settle Java

Settle client for Java language

Getting Started

Get started with the Java Development SDK for Settle, Compatible with Java 8

Usage

  1. Create Maven project and add the dependency in the pom.xml
<dependency>
    <groupId>com.github.settle-finance</groupId>
    <artifactId>java-integration-sdk</artifactId>
    <version>1.0.3</version>
</dependency>
  1. Add it in your root pom.xml at the end of repositories:
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
  1. Start integrating

Exampe Usage

public class Example {
    static PlatformConfig platformConfig;
    static PlatformClient platformClient;

    public static void main(String[] args) {
        try {
            platformConfig = new PlatformConfig(
                    "COMPANY_ID",
                    "API_KEY",
                    "API_SECRET",
                    "API_TOKEN",
                    "https://api.settle.club",
                    false
            );

            platformClient = new PlatformClient(platformConfig);

            PlatformModels.CustomerObject customer = PlatformModels.CustomerObject.builder().countryCode("91").mobile("8898518242").uid("1").build();

            PlatformModels.Device device = PlatformModels.Device.builder().ipAddress("127.0.0.1").userAgent("moz").build();

            PlatformModels.Order order =  PlatformModels.Order.builder().valueInPaise(100000).uid("123").build();

            PlatformModels.ValidateCustomer validateCustomer = PlatformModels.ValidateCustomer.builder().customer(customer).order(order).device(device).build();

            // Use this API to verify the customer.
            PlatformModels.VerifyCustomerSuccess verifyCustomerSuccess = platformClient.customer.validate(
                    platformConfig.getOrganizationId(),
                    verifyCustomer
            );

            PlatformModels.CreateTransaction createTransaction = PlatformModels.CreateTransaction.builder().customer(customer).order(order).redirectUrl("https://www.google.com").build();

            // Use this API to create transaction for user.
            PlatformModels.CreateTransactionSuccess createTransactionSuccess = platformClient.customer.createTransaction(
                    "",
                    platformConfig.getOrganizationId(),
                    createTransaction
            );
   
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

Documentation