Giter Club home page Giter Club logo

chargily-epay-java's Introduction

Chargily Epay Gateway JAVA Package

Chargily ePay Gateway

This Plugin is to integrate ePayment gateway with Chargily easily.

  • Currently support payment by CIB / EDAHABIA cards and soon by Visa / Mastercard
  • This repo is recently created for Java Library, If you are a developer and want to collaborate to the development of this library, you are welcomed!

Instaltation:

To install add Jitpack Repository & chargily package dependency to build.gradle gradle build file:

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.chargily:chargily-epay-java:1.1'
}

Example Usage

Sync

import chargily.epay.java.*;

class ChargilyApp {
    public static void main() {
        ChargilyClient client = new ChargilyClient("[API_KEY]");
        Invoice invoice = new Invoice(
                "Chakhoum Ahmed",
                "[email protected]",
                5.0,
                "https://backend.com/webhook_endpoint",
                "https://frontend.com",
                PaymentMethod.EDAHABIA,
                "5001",
                10000.0);
        try {
            ChargilyResponse response = client.submitInvoice(invoice);
            if (response.isSuccess()) {
                response.getStatusCode();
                response.getCheckoutUrl();
            } else {
                response.getStatusCode();
                response.getErrorBody();
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}

Async

import chargily.epay.java.*;

class ChargilyApp {
    public static void main() {

        ChargilyClient client = new ChargilyClient("[API_KEY]");
        Invoice invoice = new Invoice(
                "Chakhoum Ahmed",
                "[email protected]",
                5.0,
                "https://backend.com/webhook_endpoint",
                "https://frontend.com",
                PaymentMethod.EDAHABIA,
                "5001",
                10000.0);

        ChargilyCallback<ChargilyResponse> responseCallback = new ChargilyCallback<>() {

            @Override
            public void onResponse(@Nonnull Call<ChargilyResponse> call, ChargilyResponse response) {
                // do something on response
                if (response.isSuccess()) {
                    response.getStatusCode();
                    response.getCheckoutUrl();
                } else {
                    response.getStatusCode();
                    response.getErrorBody();
                }
            }

            @Override
            public void onFailure(@Nonnull Call<ChargilyResponse> call, @Nonnull Throwable t) {
                // do something on failure
            }
        };

        client.submitInvoiceAsync(invoice, responseCallback);
    }
}

chargily-epay-java's People

Contributors

chargilydev avatar deepsource-io[bot] avatar hichamzoubiri avatar mrsofiane avatar rainxh11 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.