com.github.bleumi:bleumi-pay-sdk-java

Java SDK for the Bleumi Pay REST API

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.github.bleumi
ArtifactId

ArtifactId

bleumi-pay-sdk-java
Last Version

Last Version

1.0.14
Release Date

Release Date

Type

Type

jar
Description

Description

com.github.bleumi:bleumi-pay-sdk-java
Java SDK for the Bleumi Pay REST API

Download bleumi-pay-sdk-java

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.bleumi/bleumi-pay-sdk-java/ -->
<dependency>
    <groupId>com.github.bleumi</groupId>
    <artifactId>bleumi-pay-sdk-java</artifactId>
    <version>1.0.14</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.bleumi/bleumi-pay-sdk-java/
implementation 'com.github.bleumi:bleumi-pay-sdk-java:1.0.14'
// https://jarcasting.com/artifacts/com.github.bleumi/bleumi-pay-sdk-java/
implementation ("com.github.bleumi:bleumi-pay-sdk-java:1.0.14")
'com.github.bleumi:bleumi-pay-sdk-java:jar:1.0.14'
<dependency org="com.github.bleumi" name="bleumi-pay-sdk-java" rev="1.0.14">
  <artifact name="bleumi-pay-sdk-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.bleumi', module='bleumi-pay-sdk-java', version='1.0.14')
)
libraryDependencies += "com.github.bleumi" % "bleumi-pay-sdk-java" % "1.0.14"
[com.github.bleumi/bleumi-pay-sdk-java "1.0.14"]

Dependencies

compile (8)

Group / Artifact Type Version
io.swagger.core.v3 : swagger-annotations jar 2.0.0
com.squareup.okhttp : okhttp jar 2.7.5
com.squareup.okhttp : logging-interceptor jar 2.7.5
com.google.code.gson : gson jar 2.8.1
io.gsonfire : gson-fire jar 1.8.3
org.threeten : threetenbp jar 1.3.5
io.swagger : swagger-annotations jar 1.5.9
javax.validation : validation-api jar 2.0.1.Final

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Bleumi Pay SDK for Java

GitHub license

The Bleumi Pay SDK helps you integrate Algo, Algorand Standard Asset, Ethereum, ERC-20, RSK, RSK ERC-20 & xDai payments and payouts into your business or application. The SDK bundles Bleumi Pay API into one SDK to ease implementation and support.

bleumi-pay-sdk-java is a Java library that provides an interface between your Java application and Bleumi Pay API. This tutorial covers the basics, including examples, needed to use the SDK.

Getting Started

Pre-requisites

Development Environment

  1. Java 1.8+
  2. Maven/Gradle

Obtain An API Key

Bleumi Pay SDK uses API keys to authenticate requests. You can obtain an API key through the Bleumi Dashboard.

Install Package

maven-central (scoped)

Using Maven

Add the following XML code to the dependencies section of your pom.xml file:

<dependency>
  <groupId>com.github.bleumi</groupId>
  <artifactId>bleumi-pay-sdk-java</artifactId>
  <version>1.0.14</version>
</dependency>

Using Gradle

Add this dependency to your project's build file:

compile "com.github.bleumi:bleumi-pay-sdk-java:1.0.14"

Run Sample Code

The following code generates an unique checkout URL to accept payment from the buyer:

// Import classes:
import com.bleumi.pay.ApiClient;
import com.bleumi.pay.ApiException;
import com.bleumi.pay.Configuration;
import com.bleumi.pay.auth.*;
import com.bleumi.pay.model.*;
import com.bleumi.pay.api.HostedCheckoutsApi;

public class HostedCheckoutsApiExample {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: ApiKeyAuth
        ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
        ApiKeyAuth.setApiKey("<Your API Key>");

        HostedCheckoutsApi apiInstance = new HostedCheckoutsApi();
        CreateCheckoutUrlRequest body = new CreateCheckoutUrlRequest(); // CreateCheckoutUrlRequest | Request body - used to specify checkout URL creation parameters.
        try {
            body.setId("<ID>"); //Eg. "1"
            body.setCurrency("<CURRENCY>"); // Eg. "USD"
            body.setAmount("<AMOUT>"); // Eg. "10"
            body.setSuccessUrl("<SUCCESS_URL>"); // Eg. "https://demo.store/api/completeOrder"
            body.setCancelUrl("<CANCEL_URL>"); // Eg. "https://demo.store/api/cancelOrder"
            body.setToken("<TOKEN>"); //Optional; Replace <TOKEN>  by anyone of the following values: 'ETH' or 'XDAI' or 'XDAIT' or ECR-20 Contract Address or 'RBTC' or RSK ECR-20 Contract Address or 'Asset ID' of Algorand Standard Asset.
            body.setChain(Chain.GOERLI); //Optional; Replace Chain.GOERLI with appropriate chain as required.
            CreateCheckoutUrlResponse result = apiInstance.createCheckoutUrl(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling HostedCheckoutsApi#createCheckoutUrl");
            e.printStackTrace();
        }
    }
}

More examples can be found under each method in SDK Classes section.

SDK Classes

Class Method HTTP request Description
HostedCheckoutsApi createCheckoutUrl POST /v1/payment/hc Generate a unique checkout URL to accept payment.
HostedCheckoutsApi listTokens GET /v1/payment/hc/tokens Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard.
HostedCheckoutsApi validateCheckoutPayment POST /v1/payment/hc/validate Validate the GET parameters passed by Hosted Checkout in successUrl upon successfully completing payment.
PaymentsApi getPayment GET /v1/payment/{id} Retrieve the wallet addresses & token balances for a given payment
PaymentsApi listPayments GET /v1/payment Retrieve all payments created.
PaymentsApi settlePayment POST /v1/payment/{id}/settle Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress
PaymentsApi refundPayment POST /v1/payment/{id}/refund Refund the balance of a token for a given payment to the buyerAddress
PaymentsApi getPaymentOperation GET /v1/payment/{id}/operation/{txid} Retrieve a payment operation for a specific payment.
PaymentsApi listPaymentOperations GET /v1/payment/{id}/operation Retrieve all payment operations for a specific payment.
PayoutsApi createPayout POST /v1/payout Create a payout.
PayoutsApi listPayouts GET /v1/payout Returns a list of payouts

Documentation for Models

Limitations

Recommendation

It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issues.

License

Copyright 2020 Bleumi, Inc.

Code licensed under the MIT License.

com.github.bleumi

Bleumi

Versions

Version
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0