Source files on Github

How to use

To use this library add the jar to your project libraries (it will be added to maven when possible)

There are two ways to configure keys and secrets:

  • By providing your own configuration class like this

import ChargilyEpayClientConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static ChargilyEpayConfigParams.*;

    public class ChargilyEpayConfiguration {

        public ChargilyEpayClientConfig configureChargily(){
        ChargilyEpayClientConfig chargilyEpayClientConfig = new ChargilyEpayClientConfig();
        chargilyEpayClientConfig.put(BASE_URL, "");
        chargilyEpayClientConfig.put(API_KEY, "your_api_key");
        chargilyEpayClientConfig.put(SECRET, "your_secret");
        return chargilyEpayClientConfig;
  • or simply adding by these properties on file


then to make a payment simply inject the ChargilyClient in your service

either by constructor or field injection like this (constructor injection is preferred, but I will use field injection just for demo)

public class MyService{
private ChargilyEpayClient client;

public void makePayment(){
    InvoiceModel invoice = new InvoiceModel(
                "a comment"
    //handle response after you get it as a call back
    client.makePayment(invoice, new Callback() {
            public void onFailure(@NotNull Call call, @NotNull IOException e) {
                //in case of failure

            public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
                //in case of success

Here’s a demo