Skip to content

omise/omise-java

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OMISE-JAVA

Maven Central Github Actions

omise-java provides a set of Java bindings to the Omise REST API. Please contact support@opn.ooo if you have any questions regarding this library and the functionality it provides.

INSTALLATION

Android

WARNING: Android users should check out our omise-android repository instead.

This library requires Java 8 and up and is meant to be used with Java server implementations.

Gradle/Maven

Adds to your build.gradle file.

dependencies {
    compile 'co.omise:omise-java:4.0.+'
}

Shadow JAR

If you have dependency conflicts with omise-java jar you can try using the shadowed JAR version which has the JAR dependencies relocated to the co.omise.dependencies package.

You can obtain a shadowed jar by manually cloning the project and running the shadowJar task:

$ git clone git://github.com/omise/omise-java
$ cd omise-java
$ gradle shadowJar
:compileJava
:processResources
:classes
:shadowJar

BUILD SUCCESSFUL

$ ls builds/libs
omise-java-4.0.0-all.jar

Migration Guide

USAGE

Obtain a set of API keys from the Omise Dashboard and create a Client object

Client client = new Client.Builder()
                        .publicKey("pkey_test_123")
                        .secretKey("skey_test_123")
                        .build();

Access the API by creating a Request and sending it through the Client, for example to get current Balance

Request<Balance> request = new Balance.GetRequestBuilder().build();
Balance balance = client.sendRequest(request);

long total = balance.getTotal();

Creating a charge from a token

Client client = new Client.Builder()
                        .publicKey("pkey_test_123")
                        .build();

Request<Charge> request =
                    new Charge.CreateRequestBuilder()
                            .amount(100000) // 1,000 THB
                            .currency("thb")
                            .card("card_test_4xtsoy2nbfs7ujngyyq")
                            .build();
Charge charge = client.sendRequest(request);

System.out.println("created charge: " + charge.getId());

LICENSE

MIT license On February 23, 2023, we started redirecting users from search.maven.org to central.sonatype.com. Launched in September of 2022, central.sonatype.com provides the main functionality of search.maven.org with enhanced search results, including security vulnerability and software quality information.