Skip to content

everflow-io/veem-java-sdk

 
 

Repository files navigation

Veem-Java-Sdk

The Veem Java SDK provides an interface to make it easier to call Veem Global Payments APIs for server side Java backend service. Some of the features included in the SDK are:

Documentation

System Requirements

  1. The SDK works on JDK 8 and above.
  2. A developer account
  3. An application with a customer account and the associated client id and secret (Authorization flow / Client Credentials flow)

First Use Instructions

  1. Clone the GitHub repo to your computer.
  2. Import it to the IDE of your choice.

Testing the Code & Building Artifacts

To test the code locally, follow the steps below:

  1. cd to the project directory
  2. Client can either integrate with Authorization flow or Client Credential Flow;
  3. For Authorization flow, fill in the testConfigAuth.json file values with client id ,client secret and redirect url (optional).
  4. For Client Credentials flow, fill in the testConfigClientCreds.json file values with client id and client secret.
  5. To exercise all Veem Global Payment APIs, fill access_token received from either step 3 or 4 to testConfig.json.
  6. Run the command: ./gradlew build - this will run the unit test and build the sdk jar.

Getting the OAuth Tokens

In order to get the access tokens from the Developer Portal;

Sign In with Veem - Sign into developer Portal .

Create an Application- Create a new application by providing the Name, OAuth2 Redirection URLs and Payment Status Webhooks.

Create a Customer- Create a new customer by providing Business Name, Country and Primary Email

Get Credentials- Go the Application and select the Customer and copy the Access Token.

In order to get the access token programmatically, get the client id, client secrets (Optional redirect url for Authorization flow).

        val veemContext = new VeemContext.VeemContextBuilder()
                .environment(SANDBOX) //SANDBOX or PRODUCTION environment
                .clientId(clientId)
                .clientSecret(clientSecret)
                .build()

        val authenticationClient = veemContext.getAuthenticationClient()
        val tokenResponse = authenticationClient.getTokenFromClientCredentials(Arrays.asList(Scope.ALL))

Invoice Client Example

The following example is to send invoice using Invoice Client

  VeemContext veemContext = new VeemContext.VeemContextBuilder()
            .environment(SANDBOX)
            .build()
            
  Invoice invoice = Invoice.builder()
                .amount(new Amount(BigDecimal.valueOf(100), USD))
                .payer(Account.builder()
                    .email("test-${-> randomUUID()}@mailinator.com")
                    .firstName("Test")
                    .lastName("Veem API")
                    .countryCode(US)
                    .phone("2102102100")
                    .type(INCOMPLETE)
                    .build())
                .build()
                
  Invoice sentInvoice = veemClient.invoices().send(invoice)

About

Java SDK for the Veem Global Payments API https://veem.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 70.8%
  • Groovy 29.2%