ioan-ghisoi-cko / checkout-sdk-java

Checkout.com SDK for Java

Home Page:https://bit.ly/2CQDiba

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status GitHub license GitHub release

Checkout.com Java SDK

Built with Java 8 and Gradle 5

💻 Import

The jar, javadoc, and sources are all available from Maven Central.

Gradle

dependencies {
    implementation 'com.checkout:checkout-sdk-java:3.5.0'
}

Maven

<dependency>
    <groupId>com.checkout</groupId>
    <artifactId>checkout-sdk-java</artifactId>
    <version>3.5.0</version>
</dependency>

If you don't have your own API keys, you can sign up for a test account here.

📖 Documentation

You can see the SDK documentation here.

➕ Dependencies

  • gson 2.8.5
  • slf4j-api 1.7.26
  • apache httpclient 4.5.12

💨 Quickstart

Here's a simple example of how to create the client and which values it needs to bootstrap:

import com.checkout.CheckoutApi;
import com.checkout.CheckoutApiImpl;
import com.checkout.payments.RefundResponse;

import java.util.concurrent.CompletableFuture;

class Main {
    public static void main(String[] args) {
        String secretKey = "my_checkout_secret_key";
        String publicKey = "my_checkout_public_key";
        boolean useSandbox = true;
        
        CheckoutApi checkoutApi = CheckoutApiImpl.create(secretKey, useSandbox, publicKey);
        
        String paymentId = "my_test_payment_id";
        
        CompletableFuture<RefundResponse> refundResponse = checkoutApi.paymentsClient().refundAsync(paymentId);
        // etc...
    }
}

Please see the tests for more examples. There is also a growing collection of samples available under samples.

👷 Building Locally

The tests require a sandbox account to connect to. Once you have one, you can specify the CHECKOUT_PUBLIC_KEY and CHECKOUT_SECRET_KEY using environment variables.

Then just run:

gradlew build

✨ Contributing and Release Process

This is based on the OSM Lab Atlas project, who have a very helpful document here.

dev is the default branch, and all commits/pull requests that are accepted should be merged into here. Travis will then automatically build and test the project, and if successful will merge into master. This is the only way code should end up in master.

To perform an actual release (and you need permissions on the project to do this, not just anyone can run this) you should:

  • run the script .travis/trigger-release.sh locally - or just use the Travis UI if you prefer to manually trigger a build on master, with the parameters: "before_script": "export MANUAL_RELEASE_TRIGGERED=true".
  • This should build master, and publish to https://oss.sonatype.org a release. The version number is taken from the version field in the gradle.properties file, and the -SNAPSHOT suffix removed.
  • Finally a tag is made in Github with that version number.
  • As a manual next step, you should update references in the documentation to the new version number, turn the tag into a GitHub release with documentation on what has changed (and how to access that particular release), and increment the version number in gradle.properties, being sure to keep the -SNAPSHOT suffix.

⚠️ Note

Sometimes there can be random failures when uploading to https://oss.sonatype.org due to timeouts or other difficult to diagnose problems. Generally just trying again should work.

About

Checkout.com SDK for Java

https://bit.ly/2CQDiba

License:MIT License


Languages

Language:Java 97.1%Language:Shell 2.9%