Javatpoint Logo
Javatpoint Logo

Paytm SDK Integration in iOS

Paytm SDK provides a secure and seamless payment experience to the users by invoking the Paytm app (if installed on your user's smartphone) to finish the order.

It facilitates the users to accept payment by using Paytm Wallet, Paytm Payments Bank, Saved Debit/Credit Cards (if any), Net Banking, BHIM UPI, or EMI in the customer's Paytm account. If the Paytm app is not installed on a user's device, the transaction will be processed using web view within the SDK.

Paytm SDK provides the following features.

  1. OTP-based account linking is not required in case a user is already logged into the Paytm app.
  2. We don't get redirected to the web page for the payment if the Paytm app is installed on the user's device.
  3. Users can access the payment sources saved by Paytm.
  4. It reduces transaction time due to no login requirement.
  5. Increased the success rate
  6. Easy integration of SDK with significantly less size
  7. Support for subscription payments and bank offers
  8. SDK support for both Native and Hybrid apps
  9. Supports UPI onboarding if a user wants to link its UPI account for payment
  10. Complete flexibility with merchants to present single or multiple payments sources to the user on the Paytm app

Overview of payment through Paytm SDK

There are the following steps that are followed by Paytm SDK to complete the payment.

  1. First of all, the user opens the mobile application and adds items in the cart for which the payment is to be done.
  2. The Initiate Transaction API gets called by the backend server to get the transaction token.
  3. Launch Paytm SDK with the transaction token received in step 1.
  4. If the Paytm app is installed on the user's device, they complete the payment on the Paytm app using their login credentials; else, the transaction will be done using the web view within the SDK (the redirection flow is hosted by Paytm).
  5. Paytm backend server processes the transaction and returns the transaction response to the app.
  6. Then, the backend server calls the Transaction Status API for the verification of transaction response.
  7. After the successful validation of the transaction, the order status will be shown to the app's user.

SDK Integration

SDK integration for an All-in-One payment solution facilitates us to integrate the SDK in the applications for both Android and iOS apps. The integration facilitates the customers to make secure payments with Paytm despite the fact that the Paytm app is installed on the device or not.

There are the following flows supported by the Paytm SDK.

  1. App Invoke Flow: if the Paytm app is installed on the device, it will be launched to finish the transaction and provide the response back to the merchant app.
  2. Redirection Flow: if the Paytm app is not installed on the device, SDK will launch a web-view to complete the transaction and give the result back to the merchant.


There are the following perquisites before initiating the transaction.

  • Create an account on Paytm as a merchant
  • Get the merchant ID and merchant key for the integration environment once we create the account.
  • Use the checksum logic to generate and validate the checksum.
  • Get the staging iOS Paytm app for integration testing on the merchant staging environment.

Integration Steps

1. We need to call the Initiate Transaction API from the backend to generate the Transaction Token. If we want to allow/show specific payment sources, we need to pass the enablePaymode param in the Initiate Transaction API, as shown below. This feature enables us to create a cart payment page with multiple payment sources.

For Example, if we want to enable UPI as the only pay mode, we need to pass the below parameters within Initiate Transaction API.

2. Call the openPaytm method with the following mandatory parameters.

3. Delegate is a type of AIDelegate which have two protocols.

4. In case the Paytm app is not installed, redirect the user to Paytm hosted Checkout Page.

  1. An order is created in your order system, and the transaction token is also generated using Initiate Transaction API.
  2. In case the Paytm app does not exist, then the user has to implement delegate methods of AIDelegate. openPaymentWebVC will provide the merchant with the controller to present/push, which handles the Paytm hosted checkout page as described below.

5. In case the merchant doesn't have a callback URL, add an entry into Info.plist. LSApplicationQueriesSchemes(Array) Item 0 (String)->paytm.

  1. Add a URL Scheme "paytm"+"MID".
  2. Define the app delegate method to handle Paytm response. The client will get the response in Appdelegate Method.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA