iOS Redirection SDK (Deprecated)

Paytm iOS SDK is a secure and PCI-compliant way to accept Debit/Credit card, Net-Banking, UPI and Paytm wallet payments from your customers in your iOS app.


This SDK has been deprecated. For integrating our new SDK with advance features, please refer to this link.

Demo of Paytm checkout flow in your app

Overview of payment processing via Paytm checkout

  1. When a customer clicks the Pay button, order related payload is passed to your server by the app.
  2. This order payload is used to generate checksumhash by our server-side utility and merchant key on your server. Checksumhash is a signature used by Paytm to ensure that the request has not tampered. Utility to generate checksumhash is available here.
  3. Your server passes the payload and checksumhash back to the app which hands over these details to Paytm SDK.
  4. SDK verifies payload and displays Paytm payment checkout page.
  5. Customer fills the payment details and completes the payment authentication.
  6. Once the payment is complete, response is posted back to your app via callback.
  7. Verify checksumhash received in response on your server-side. Utility to verify checksumhash is available here.
  8. Verify transaction status with Transaction Status API via server to server call. This protects you from scenarios where your account credentials are compromised or request/response has tampered.

Find the detailed interaction of each system component in the flow chart below:



Steps to start accepting payments via Paytm iOS SDK

Step 1: Importing the library

Follow the steps below to download and import library in your project:

  • For Swift

  1. Download the SDK from here. You get an option to download bitcode enabled and disabled SDK.
  2. Open your project in XCode from File menu, and then select Add files to "yourproject".
  3. Select Paytm.framework in the directory you just unzipped.
  4. Make sure you select the Copy items if needed checkbox and then click Add.
  5. Under the Link Binary With Libraries in the Build Phases tab of your project settings, add SystemConfiguration.framework.
  6. Check if PaytmSDK.framework is added in both Link Binary With Libraries and Embedded Binaries. If not, add by clicking the plus icon.
  • For Objective C

  1. Download the SDK from here. You get an option to download bitcode enabled and disabled SDK.
  2. Open your project in XCode.
  3. Under the Build Phases tab, expand Link Binary With Libraries section, and then click the + button.
  4. In the newly appeared Choose items to add window, click the Add Other.. button, and then specify the path to libPaymentsSDK.a library file.
  5. Click the Open button.
  6. In the Link Frameworks and Libraries section, click the + button again.
  7. Find the SystemConfiguration.framework in the list, and click the Add button.

Step 2: Initiate Payment

Follow the steps below to start a payment transaction:

  1. Choose the Paytm server based on your environment:

    • For Staging - Create an instance of the PGServerEnvironment and set the serverType to eServerTypeStaging

    • For Production - Create an instance of the PGServerEnvironment and set the serverType to eServerTypeProduction

  2. Create a PGOrder instance with the mandatory parameters as given below in the code snippet. In addition to this, you may add other optional parameters as needed. Parameters with their detailed meaning is provided after the code snippet.

  3. Create an instance of PGTransactionViewController by calling initTransactionForOrder and pass the PGOrder instance as parameter.

  4. Push the PGTransactionViewController as given below in the code snippet.

func beginPayment() {
	serv = serv.createProductionEnvironment()
	let type :ServerType = .eServerTypeProduction
	let order = PGOrder(orderID: "", customerID: "", amount: "", eMail: "", mobile: "")
	order.params = ["MID": "rxazcv89315285244163",
		"ORDER_ID": "order1",
		"CUST_ID": "cust123",
		"MOBILE_NO": "7777777777",
		"EMAIL": "",
		"TXN_AMOUNT": "100.12",
		"INDUSTRY_TYPE_ID": "Retail",
		"CHECKSUMHASH": "oCDBVF+hvVb68JvzbKI40TOtcxlNjMdixi9FnRSh80Ub7XfjvgNr9NrfrOCPLmt65UhStCkrDnlYkclz1qE0uBMOrmuKLGlybuErulbLYSQ=",
	self.txnController =  self.txnController.initTransaction(for: order) as?PGTransactionViewController
	self.txnController.title = "Paytm Payments"
	if(type != ServerType.eServerTypeNone) {
		self.txnController.serverType = type;
	} else {
	self.txnController.merchant = PGMerchantConfiguration.defaultConfiguration()
	self.txnController.delegate = self
	self.navigationController?.pushViewController(self.txnController, animated: true)


- (void)beginPayment{
	PGOrder *order = [PGOrder orderForOrderID:@""
	order.params =   @{@"MID" : @"rxazcv89315285244163",
		@"ORDER_ID": @"order1",
		@"CUST_ID" : @"cust123",
		@"MOBILE_NO" : @"7777777777",
		@"EMAIL" : @"",
		@"CHANNEL_ID": @"WAP",
		@"TXN_AMOUNT": @"100.12",
		@"INDUSTRY_TYPE_ID": @"Retail",
	PGTransactionViewController *txnController = [[PGTransactionViewController alloc] initTransactionForOrder:order];
	txnController.loggingEnabled = YES;
	if (type != eServerTypeNone)
		txnController.serverType = type;
	txnController.merchant = [PGMerchantConfiguration defaultConfiguration];
	txnController.delegate = self;
	[self.navigationController pushViewController:txnController animated:YES];


You can see the parameters with their description in the table below:




Unique identifier provided to every merchant by Paytm as a part of your account credentials which is different on staging and production environment. Your staging MID is available here and production MID will be available once your activation is complete. Yes



Unique reference ID for a transaction which is generated by merchant. The special characters allowed in Order ID are: “@” “-” “_” “.”. Yes



Unique reference ID for every customer which is generated by merchant. The special characters allowed in Cust_ID are @, ! ,_ $. Yes



Amount in INR payable by customer. It must contain digits up to two decimal points and should not include any separator like (“,”). Yes



Used to control the theme of the payment page. Based on the channel passed, Paytm will render the layout suitable for that specific platform.
- For App, the value is WAP.



  • For Staging Environment: WEBSTAGING
  • For Production Environment: Will be available here once your activation is complete



  • For Staging Environment: "Retail"
  • For Production Environment: Will be available here once your activation is complete



Security parameter to avoid tampering which is generated using the server-side checksum utility provided by Paytm. Merchant has to ensure that this always gets generated on server. Utilities to generate checksumhash is available here. Yes



Customer's mobile number. Passing this enables faster login for customer into their Paytm account. No



Customer's email ID. Passing this enables faster login for customer into their mobile wallet. No




STEP 3: Handle error and success responses

To handle success/errors on completion of payment, implement  didFinishedResponsedidCancelTrasactionerrorMisssingParameter  methods of the PGTransactionDelegate. The code snippet are provided below:


//this function triggers when transaction gets finished
func didFinishedResponse(_ controller: PGTransactionViewController, response responseString: String) {
	let msg : String = responseString
	var titlemsg : String = ""
	if let data = String.Encoding.utf8) {
		do {
			if let jsonresponse = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String:Any] , jsonresponse.count > 0{
				titlemsg = jsonresponse["STATUS"] as? String ?? ""
		} catch {
			print("Something went wrong")
	let actionSheetController: UIAlertController = UIAlertController(title: titlemsg , message: msg, preferredStyle: .alert)
	let cancelAction : UIAlertAction = UIAlertAction(title: "OK", style: .cancel) { 
		action -> Void in
		controller.navigationController?.popViewController(animated: true)
	self.present(actionSheetController, animated: true, completion: nil)
//this function triggers when transaction gets cancelled
func didCancelTrasaction(_ controller : PGTransactionViewController) {
	controller.navigationController?.popViewController(animated: true)
//Called when a required parameter is missing.
func errorMisssingParameter(_ controller : PGTransactionViewController, error : NSError?) {
	controller.navigationController?.popViewController(animated: true)


//this function triggers when transaction gets finished
-(void)didFinishedResponse:(PGTransactionViewController *)controller response:(NSString *)responseString {
    [controller.navigationController popViewControllerAnimated:YES];
//this function triggers when transaction gets cancelled
-(void)didCancelTrasaction:(PGTransactionViewController *)controller {
    [_statusTimer invalidate];
    NSString *msg = [NSString stringWithFormat:@"UnSuccessful"];
    [[[UIAlertView alloc] initWithTitle:@"Transaction Cancel" message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
    [controller.navigationController popViewControllerAnimated:YES];
//Called when a required parameter is missing.
-(void)errorMisssingParameter:(PGTransactionViewController *)controller error:(NSError *) error {
    [controller.navigationController popViewControllerAnimated:YES];


Post Integration Steps

Post completion of integration on your staging environment, do a complete transaction from order summary page on your website or mobile app.

  1. Attempt a test transaction using test paymodes credentials.
  2. Ensure you re-verify transaction response with Transaction Status API via server to server call in payment flow and not separately as a one-time activity.
  3. See the transaction details in the “Test Data” mode on your dashboard.

Once the test transaction is complete, move your code to live environment with production account details. Note that production accounts details are available after you have activated your account on the dashboard.


Lastly, it's recommended that you read about Managing Refunds and Late payment notifications.


In case of any issues with integration, please Get in touch.