Available in🇮🇳 India
The Razorpay iOS Custom SDK lets you integrate the supported payment methods on your iOS app’s Checkout form.
Fetch Payment Methods
Use the Fetch Payment Methods API to fetch the payment methods available for your account. Below are the sample payloads for each payment method.Debit and Credit Card
Add the following code where you want to initiate a card payment:Bank Transfer
This payment method allows you to display your Customer Identifier details on checkout. Your customers can make online bank transfers to this account.Feature RequestThis is an on-demand feature. Please raise a request with our Support team to get this feature activated on your Razorpay account.
fetchVirtualAccount method for your Customer Identifier to get created and the details to appear on the checkout. Know more about integrating bank transfer with Custom Checkout.
EMI on Debit and Credit Cards
Add the following code where you want to initiate an EMI payment:Cardless EMI
Add the following code where you want to initiate a cardless EMI payment:Netbanking
Add the following code where you want to initiate a netbanking payment:Pay Later
Add the following code where you want to initiate a Pay Later payment:Wallet
Add the following code where you want to initiate a wallet payment:UPI
Specifyupi the method parameter for UPI payments. The SDK supports two flows:
- Collect
- Intent
Collect Flow
Customers enter theirvpa or phone number on your UI and complete the payments on their respective UPI apps in collect flow.
You can now pass the vpa parameter in the upi array as shown below.
Sample Code
The sample code below sends a collect request to thegaurav.kumar@exampleupi handle:
UPI Payments Using Phone Number
UPI Payments Using Phone Number
You can accept UPI payments using phone number for the collect flow. Follow the steps given below:
- You must collect the customer’s phone number from your end.
- Check if any
vpais associated with the given number and get thevpa_tokenfor that number using the sample code given below:
- Pass the
vpa_tokenparameter in theupiarray as shown below:
Intent Flow
Provide your customers with a better payment experience by enabling UPI Intent on your app’s Checkout form. In the UPI Intent flow:- You have to fetch the list of UPI supported apps and show it in your app so that the customer can see only valid apps.
- After the customer selects the app, you have to pass the app name in
options, with the keyupi_app_package_namevalue. Possible values forupi_app_package_nameare:google_payphonepepaytmcred
- The customer enters their UPI PIN to complete the transaction.
- The customer returns to your app manually without redirection.
Step 1: Update the info.plist File
Your iOS app must seek permission from the device to open the UPI PSP app that the customer selects on the Checkout. For this, you must make the following changes to your iOS app’s info.plist file:info.plist
Step 2: Get a List of UPI Supported Apps
This sample code fetches the list of apps on the customer’s device that support UPI payments.upi_app_package_name is passed from the getAppsWhichSupportUpi() method value. Otherwise, it will not pass the validation.
UPI Intent on Recurring Payments
Configure and initiate a recurring payment transaction on UPI Intent:Turbo UPI
Make UPI payments a faster, 2-step experience for your customers with Razorpay’s Turbo UPI SDK. Know more about the Customer Onboarding and Integration Steps.CRED
Customers can make payments on your iOS app using their CRED Coins as well as the credit cards saved on CRED. The SDK supports two flows:Prerequisites
For both collect and intent flow, you need to pass theapp_offer parameter in the Orders API.
POST /orders
Request Parameters
amount mandatory
: integer The transaction amount, expressed in the currency subunit, such as paise (in case of INR). For example, for an actual amount of ₹299.35, the value of this field should be 29935.
currency mandatory
: string The currency in which the transaction should be made. See the list of supported currencies. Default is INR.
app_offer optional
: boolean Allow/do not allow customers to use CRED coins to make payments. This is used to prevent double discounting scenarios where customers have already availed discounts using voucher/coupon, and you do not want them to redeem Coins as well. Possible values:
true: Customer not allowed to use CRED coins to make payment.false(default): Customer can use CRED coins to make payment.
receipt optional
: string Your receipt id for this order should be passed here. Maximum length is 40 characters.notes optional
: object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.
Collect Flow
In the Collect Flow, the SDK sends a push notification to thecontact number passed in the create request. To initiate collect flow, send app_present the parameter as 0 while creating the payment.
Request Parameters
Along with the other payment creation request parameters, you must pass:method mandatory
: string The method used to make the payment. Here, it must be app.
provider mandatory if method=app
: string Name of the PSP app. Here, it must be cred.
app_present mandatory if app=cred
: integer Sets the payment flow as collect. Possible values:
1: Opens the CRED app on the customer’s device.0(default): Sends a push notification to the customer’s device.
Intent Flow
In Intent Flow, the SDK invokes an intent, which is handled by the Cred app installed on the iOS device. Follow these steps:Step 1: Update the info.plist File
You must make the following changes to your iOS app’s info.plist file:info.plist
Step 2: Detect CRED App in Customer’s Mobile
- Check if the CRED app is present on the customer’s mobile using the
isCredAppAvailable()method.
- CRED app listens to the URI Schema.
uriSchema parameter in the above function. isCredAppAvailable() returns a boolean value informing whether the app is present on the device or not.
- If the CRED app is installed, pass the
callback_urlparameter in the payload:
Handy TipsThe redirect happens from the CRED app based on the URL scheme passed in the payload. If not passed, the app will not redirect.
Listen to CRED Callback
Listen to CRED callback in theAppDelegate class by implementing the open url method. Handle the success response.
Register for Notification
Register for notification in CustomWebVC using the code sample given below:Initiate Intent Flow
To initiate intent flow, send theapp_present parameter as 1 while creating the payment.
Request Parameters
Along with the other payment creation request parameters, you must pass:method mandatory
: string The method used to make the payment. Here, it must be app.
provider mandatory if method=app
: string Name of the PSP app. Here, it must be cred.
app_present mandatory if app=cred
: integer Based upon response from the app present function, pass the value in this field. Possible values:
1: Opens the CRED app on customer’s device.0(default): Sends a push notification to the customer’s device.
callback_url mandatory
: string The URI scheme, using which the CRED app will be opened on the customer’s mobile device.