Server SDKs

Java

A server SDK for charges, payouts and webhook verification. Coming soon.

Coming soon

This library is not published yet. The REST API it will wrap works today; the example below calls it directly.

What it will do

  • Create and fetch charges and payouts from any JVM service, Spring Boot included.
  • Check that a webhook came from us in one call, before you act on it.

Until then

Call the API directly with java.net.http (Java 15 or later, for the text block). This creates a test charge of 5,000 RWF from an MTN wallet, with your test key in INVERSEPAY_TEST_KEY:

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String body = """
    {"idempotency_key": "order-1001", "amount_minor": 500000, "currency": "RWF",
     "payer": {"phone_number": "250788123456", "network": "MTN", "country_code": "RW"}}
    """;

HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.inversepay.app/api/b/v1/charges"))
    .header("Authorization", "Bearer " + System.getenv("INVERSEPAY_TEST_KEY"))
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();

HttpResponse<String> response =
    HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());

The Quickstart covers the response and what happens next, and the API reference lists every field.

Want it sooner?

Tell us at developers@inversepay.app.

On this page