Giter VIP home page Giter VIP logo

omise-java's Introduction

OMISE-JAVA

Maven Central Github Actions Discourse Forum

omise-java provides a set of Java bindings to the Omise REST API. Please contact [email protected] 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

omise-java's People

Contributors

chakrit avatar keeratita avatar namiii avatar nlogx avatar nuxzero avatar pitiphong-p avatar ratchagarn avatar rezigned avatar thanapolr avatar tookaa2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.