Skip to main content

Android SDK


To integrate the Android SDK into your application, you first need to initialize it in your Application class or main Activity. This is usually done once:

import com.gini.rtp.androidsdk.RequestToPaySDK;

public class MyApp extends Application {

public void onCreate() {

// Initialize the SDK


After you initialize it, the SDK needs to be configured before is rendered on the screen. The reason for this, is that you need to have the bearer token as explained on the recipe:

RequestToPaySDK.Config config = new RequestToPaySDK.Config();
config.setBearerToken("BearerToken"); //Obtained in the authentication step
config.setEnvironment(RequestToPaySDK.Environment.PRODUCTION); // This is for testing purposes only


Displaying and Using the Request To Pay Button

First, you need to add and configure the button to your layout file. Here's a sample XML layout:

android:text="Request Payment"/>

Merchants must set up the code that the button must run once the customer clicks on the button in order to start the payment. It's needed to communicate with the Merchant's server in order to initiate the payment via an Api to Api call due to security reasons, as explained on the mobile recipe. For this, you can grab your button from your Activity or Fragment, and set the listener's code as follows:

RequestToPayButton button = findViewById(;

button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// It's needed to call merchant's API in order
// to initiate the backend to backend RTP payment

// Once the paymentRequestId is returned, the
// payment can be initiated via our SDK method
// as follows
// Your clients bank application will be opened via deeplink