Additional Support For Payment Methods
Additional support features available for card, netbanking, EMI and more.
The Razorpay iOS Custom SDK lets you integrate the supported payment methods on your iOS app's Checkout form.
Use the
to fetch the payment methods available for your account.Below are the sample payloads for each payment method.
Add the following code where you want to initiate a card payment:
let options: [String: Any] = ["amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1."currency": "INR", // We support international currencies."email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0sJbb","method": "card","card[name]": "Gaurav Kumar","card[number]": "4111111111111111","card[expiry_month]": 06,"card[expiry_year]": 30,"card[cvv]": "123"]razorpay.authorize(options)
Check the
.This payment method allows you to display your Customer Identifier details on checkout. Your customers can make online bank transfers to this account.
Feature Request
- This is an on-demand feature. Please raise a request with our to get this feature activated on your Razorpay account.
- Watch this video to know how to raise a feature enablement request on the Razorpay Dashboard.
There are no specific request parameters to be passed. Instead, you must pass the fetchVirtualAccount
method for your Customer Identifier to get created and the details to appear on the checkout. Know more about
Add the following code where you want to initiate an EMI payment:
let options: [String: Any] = ["amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1."currency": "INR","email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0sJbb","method": "emi","emi_duration": 9,"card[name]": "Gaurav Kumar","card[number]": "4111111111111111","card[expiry_month]": 06,"card[expiry_year]": 30,"card[cvv]": "123"]razorpay.authorize(options)
Check the list of supported
and EMI providers.Add the following code where you want to initiate a cardless EMI payment:
let options: [String: Any] = ["amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1."currency": "INR","email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0sJbb","method": "cardless_emi","provider": "earlysalary"]razorpay.authorize(options)
Check the
.Add the following code where you want to initiate a netbanking payment:
let options: [String: Any] = ["amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1."currency": "INR", // We support international currencies."email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0sJbb","method": "netbanking","bank": "HDFC"]razorpay.authorize(options)
Check the
.Add the following code where you want to initiate a Pay Later payment:
let options: [String: Any] = ["amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1."currency": "INR","email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0sJbb", // From response of Step 3"method": "paylater","provider": "icic"]razorpay.authorize(options)
Check the
.Add the following code where you want to initiate a wallet payment:
let options = ["amount": "100","currency": "INR","email": "gaurav.kumar@example.com","order_id": "order_4xbQrmEoA5WJ0G","contact": "9000090000","method": "wallet","wallet": "mobikwik",]razorpay.authorize(options)
Specify upi
the method
parameter for UPI payments. The SDK supports two flows:
- Collect
- Intent
Customers enter their vpa
or
You can now pass the vpa
parameter in the upi
array as shown below.
The sample code below sends a collect request to the gaurav.kumar@exampleupi
handle:
let options: [String: Any] = ["amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1."currency": "INR","email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0sJbb","method": "upi","_[flow]": "collect","vpa": "gaurav.kumar@exampleupi"]razorpay.authorize(options)
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
vpa
is associated with the given number and get thevpa_token
for that number using the sample code given below:self.razorpay?.isValidVpa("9000090000", withSuccessCallback: { response in// VPA Validation Successful// get and store response.vpa_token for initiating payment// you will get response.masked_vpa in this response which you can show to the end user}, withFailure: { responseError inprint(responseError)// Error: no VPA associated with the given number}) - Pass the
vpa_token
parameter in theupi
array as shown below:let options: [String: Any] = ["amount": 5000,"currency": "INR","email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0XXXX","method": "upi","_[flow]": "collect","vpa_token": "f731951149df8903d374b117f921ab41"]razorpay.authorize(options)
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_name
value. Possible values forupi_app_package_name
are:google_pay
phonepe
paytm
cred
- The customer enters their UPI PIN to complete the transaction.
- The customer returns to your app manually without redirection.
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:
<key>LSApplicationQueriesSchemes</key><array><string>tez</string><string>phonepe</string><string>paytmmp</string><string>credpay</string><string>mobikwik</string><string>freecharge</string><string>in.fampay.app</string><string>bhim</string><string>amazonpay</string><string>navi</string><string>kiwi</string><string>payzapp</string><string>jupiter</string><string>omnicard</string><string>icici</string><string>popclubapp</string><string>sbiyono</string><string>myjio</string><string>slice</string><string>bobupi</string><string>shriramone</string><string>indusmobile</string><string>whatsapp</string></array>
This sample code fetches the list of apps on the customer's device that support UPI payments.
RazorpayCheckout.getAppsWhichSupportUpi { (upiApps) inprint(upiApps)}
The sample code below invokes the UPI intent where the user can select the desired application.
Ensure that the upi_app_package_name
is passed from the getAppsWhichSupportUpi()
method value. Otherwise, it will not pass the validation.
let options: [String: Any] = ["amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1."currency": "INR","email": "gaurav.kumar@example.com","contact": "9000090000","order_id": "order_DBJOWzybf0sJbb","method": "upi","_[flow]": "intent","upi_app_package_name": "google_pay"]razorpay?.authorize(options)
Configure and initiate a recurring payment transaction on UPI Intent:
let options: [String:Any] = ["key": "YOUR_KEY_ID","order_id": "order_DBJOWzybfXXXX","customer_id": "cust_BtQNqzmBlXXXX","contact": "9000000000","amount": 10000, // Amount should match the order amount"email": "gaurav.kumar@example.com","currency": "INR","recurring": 1, // This key value pair is mandatory for Intent Recurring Payment."upi_app_package_name": "<psp-app>","method": "upi","_[flow]": "intent"]
Make UPI payments a faster, 2-step experience for your customers with Razorpay's Turbo UPI SDK.
Know more about the
and .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:
Handy Tips
Ensure you have integrated with Razorpay iOS SDK version 1.3.5 or higher.
For both collect and intent flow, you need to pass the app_offer
parameter in the Orders API.
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \-X POST https://api.razorpay.com/v1/orders \-H "content-type: application/json" \-d '{"amount": 1000,"currency": "INR","receipt": "receipt#1","app_offer": true}'
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
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”
.
In the Collect Flow, the SDK sends a push notification to the contact
number passed in the create request. To initiate collect flow, send app_present
the parameter as 0
while creating the payment.
let options: [String: Any] = ["amount": 100,"currency": "INR","contact": "9000090000","order_id": "order_FNPoKwCtPyhJOt","email": "gaurav.kumar@example.com","method": "app","provider": "cred","app_present": 0]razorpay?.authorize(options)
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
boolean
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.
In Intent Flow, the SDK invokes an intent, which is handled by the Cred app installed on the iOS device. Follow these steps:
You must make the following changes to your iOS app's info.plist file:
<key>LSApplicationQueriesSchemes</key><array><string>credpay</string></array>
-
Check if the CRED app is present on the customer's mobile using the
isCredAppAvailable()
method./// This checks if the app is available on the device or not.private func isCredAppAvailable() -> Int {let credURIScheme = "credpay://" // This will open the CRED URL.if let urlString = credURIScheme.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {if let credURL = URL(string: urlString) {if UIApplication.shared.canOpenURL(credURL) {return 1}}}return 0} -
CRED app listens to the URI Schema.
credpay://This can be passed in the
uriSchema
parameter in the above function.isCredAppAvailable()
returns a boolean value informing whether the app is present on the device or not.if (isCredAppAvailable()) {payWithCredBtn.setText("CRED Pay (Intent Flow)");} else {payWithCredBtn.setText("CRED Pay (Collect Flow)");} -
If the CRED app is installed, pass the
callback_url
parameter in the payload:options["callback_url"] = "<MerchantApp URI-Scheme>://"
Handy Tips
The 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 in the AppDelegate
class by implementing the open url
method. Handle the success response.
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {DispatchQueue.main.asyncAfter(deadline: .now() + 4.0) {/** Post the notification to CustomWebVC **/NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CREDPAYURIEVENT"), object: nil, userInfo: ["response":url.absoluteString])}return false}
Register for notification in CustomWebVC using the code sample given below:
NotificationCenter.default.addObserver(self, selector: #selector(self.statusCredData(_:)), name:NSNotification.Name(rawValue: "CREDPAYURIEVENT"), object: nil);
Use the code given below to handle payment data:
@objc func statusCredData(_ notification: NSNotification) {if let dict = notification.userInfo {if let uriScheme = dict["response"] as? String {DispatchQueue.main.async {self.razorpay?.publishUri(with: uriScheme)}}}}
To initiate intent flow, send the app_present
parameter as 1
while creating the payment.
let options: [String:Any] = ["amount": 100,"currency": "INR","contact": "9000090000","order_id": "order_FNPoKwCtPyhJOt","email": "gaurav.kumar@example.com","method": "app","provider": "cred","app_present": 1,"callback_url": "<MerchantApp URI-Scheme>://"]razorpay.payWithCred(options)
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
boolean
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.
Is this integration guide useful?