Skip to main content

Mobile

Overview

Before diving into the SDK integration process, ensure you have all the necessary credentials. These are your client Id and your client secret, all needed to integrate the Gini Request-To-Pay flow. If you don't, please, go to this page and follow the instructions there in order to obtain all the required credentials. Once you have them, you can proceed with this recipe and integrate the SDK seamlessly into your mobile application.

Install and import Necessary Dependencies:

Before proceeding with this recipe, ensure that you have imported all the necessary dependencies and libraries required for the Gini Request-To-Pay flow.

In your build.gradle file, add the Gini SDK dependency:

 dependencies {
implementation 'net.gini:gini-sdk:1.0.0'
}

Diagram of the Mobile Integration Flow

Authenticate with Gini

You first need to authenticate with Gini to obtain a bearer token. For it, you need to authenticate through you API due to security reasons (you should send your client secret, so it could not be called directly through your Mobile App). You should also send your customer Id, which is used to fill the bank picker with the user's preferred bank.

For more information on how to do this request, please, direct to the authentication page. Once you received the bearer token you can continue with the Payment Button creation.

Payment Button Creation

Once you have the bearer token received on previous step, you can now proceed to the Payment Button creation. This is a mobile SDK method, which will render a native Android/iOS button with the correspondent bank picker so the user can select from their preferred bank account. For it, you can go to this page which will guide you through the SDK authentication and iOS or Android implementation, as well as how to set the button clicked listener so you can continue with the actual RTP payment.

Request-to-Pay Payment Initialization

Inside the click listener, this is, once your customer clicks on the Gini Request-to-Pay Payment button, you will receive the onClicked callback, where you must initiate the Payment through your API with the bearer token you obtained on first step. More information on this specific step can be found here.

Once you received the response and obtain it on your Mobile App, you should call the InitPayment SDK method (android or iOS) with the RTP Id you just received from this Payment Initialization and the deepLink you want the Bank App to open once your customer have finished the flow. This last deepLink is important because you will be in charge of managing the customer experience after payment.

In this deeplink, you will receive as well the payment probable status (success/failure). It's important that you understand this is not a 100% reliable status, since this payment status is obtained from payment initialization from the Bank Application (from user response to RTP Payment Screen on the Bank Application); but the payment status and payment itself are not one atomic action, where the payment can fail after it was initiated. However, this partial response could be reliable enough depending on your needs.

If you need to be 100% sure about the payment success/failure, you can show a loader on the deeplink provided while you wait until you receive the webhook with the reliable payment response. For this, you can do polling (or implement websockets between your application and your backend) until the webhook is received, or just ask the Gini Backend for the payment status (with polling). To obtain this information, you need to use the getPaymentRequest endpoint.