QorePay logo
QorePay logo

Java Library

Download Library

Requirements

Java 8 or later.

Building

Gradle

Copy library to your project

Include library in settings.gradle

1include ':qorepay-sdk'

Getting Started

Simple usage looks like:

1public class App {
2public static void main(String[] args) throws IOException {
3    PaymentApi api = new PaymentApi("BRAND_ID",
4            "API_KEY",
5            "https://gate.qorepay.com/api/v1/");
6    ClientDetails clientDetails = new ClientDetails("[email protected]");
7    List productList = new ArrayList<>();
8    productList.add(new Product("Test", 100));
9    PurchaseDetails purchaseDetails = new PurchaseDetails(productList);
10    Purchase purchase = new Purchase(api.getBrandId(), clientDetails, purchaseDetails);
11    purchase.setSuccessRedirect("https://gate.qorepay.com/api/?success=1");
12    purchase.setFailureRedirect("https://gate.qorepay.com/api/?success=1");
13    Call purchaseCall = api.getService().createPurchase(purchase);
14    purchaseCall.enqueue(new Callback() {
15        @Override
16        public void onResponse(Call call, Response response) {
17            if (response.isSuccessful()) {
18                System.out.println(response.body().getCheckoutUrl());
19            } else {
20                System.out.println(api.errors(response));
21            }
22        }
23
24        @Override
25        public void onFailure(Call call, Throwable t) {
26
27        }
28    });
29}
30}

Examples

See App.java for more examples

Testing

1./gradlew test