Android SDK Integration


To get started with integration, follow these steps:

The Android App Side Setup is about configuring and implementing the SDK (Software Development Kit) on your mobile application to interact with PhonePe Payment Gateway. Focuses on integrating the SDK in the mobile app to trigger the payment process and handle responses.

  • Install the SDK: You need to add PhonePe’s SDK into your mobile app so that it can communicate with PhonePe’s systems.
  • Configure the App: This includes editing the app’s settings (like in Info.plist for Android) to allow it to recognize different payment systems and handle transactions securely.
  • Start the Payment Flow: You’ll integrate a payment button or screen in your app. When the user proceeds with the payment, the app uses the SDK to initiate the transaction with PhonePe.
  • Handle Callbacks: After the payment is processed, the app receives a callback with the payment result. You need to implement logic to capture and handle these results (e.g., whether the payment was successful or failed).

The Server Side Setup is about configuring your backend (server) to interact with PhonePe’s system to handle things like order creation, authentication, and status tracking. 

  • Fetch Auth Token: Before you can create an order, your server needs to authenticate with PhonePe’s system. You do this by fetching an Auth Token that will be used to validate requests from your server.
  • Create Order: When a user initiates a payment in your app, your backend needs to create a payment order by calling the Create Order API on PhonePe’s server. The server receives an Order Token and Order ID in response.
  • Pass Order Token to App: After your server creates the order, it sends the Order Token and Order ID to the mobile app so the app can use it to complete the payment process.
  • Monitor Payment Status: Once the user makes a payment, your server should track the payment status. You can either listen for a Webhook notification from PhonePe or make periodic requests to check the payment status. Based on the response, you update the order’s status (whether the payment was successful or failed).

You have completed integration the Android SDK to your app and learned about the Webhook callback. Next, set up the SDK so your app can make payments smoothly inside the app.

Head over to the next section to learn how to set up the Android SDK.

Is this article helpful?