UPI Intent on iOS - S2S

Integrate with Razorpay APIs to support UPI Intent flow on your app.


You can collect payments using the UPI intent flow that is handled by UPI apps installed on your customers' mobile devices. We support UPI Intent on iOS for these PSP apps:

  • Google Pay
  • PhonePe
  • Paytm

To enable UPI Intent on your customer's iOS device:

  1. .
  2. .
  3. .
  4. .
  5. .
  6. .

Order is an important step in the payment process.

  • An order should be created for every payment.
  • You can create an order using the . It is a server-side API call. Know how to Orders API.
  • The order_id received in the response should be passed to the checkout. This ties the order with the payment and secures the request from being tampered.

Watch Out!

Payments made without an order_id cannot be captured and will be automatically refunded. You must create an order before initiating payments to ensure proper payment processing.

Create an order by manually integrating the API sample codes on your server.

Use this endpoint to create an order using the Orders API.

POST
/orders
curl -X POST https://api.razorpay.com/v1/orders
-U [YOUR_KEY_ID]:[YOUR_KEY_SECRET]
-H 'content-type:application/json'
-d '{
"amount": 50000,
"currency": "",
"receipt": "qwsaq1",
"partial_payment": true,
"first_payment_min_amount": 230,
"notes": {
"key1": "value3",
"key2": "value2"
}
}'
{
"id": "order_IluGWxBm9U8zJ8",
"entity": "order",
"amount": 50000,
"amount_paid": 0,
"amount_due": 50000,
"currency": "",
"receipt": "rcptid_11",
"offer_id": null,
"status": "created",
"attempts": 0,
"notes": [],
"created_at": 1642662092
}

Request Parameters

amount

mandatory

integer Payment amount in the smallest currency subunit. For example, if the amount is S$500, enter 50000.

currency

mandatory

string The currency in which the payment should be made by the customer. Length must be of 3 characters.

receipt

optional

string Your receipt id for this order should be passed here. Maximum length is 40 characters.

notes

optional

json 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”.

partial_payment

optional

boolean Indicates whether the customer can make a partial payment. Possible values:

  • true: The customer can make partial payments.
  • false (default): The customer cannot make partial payments.

first_payment_min_amount

optional

integer Minimum amount that must be paid by the customer as the first partial payment. For example, if an amount of S$7,000 is to be received from the customer in two installments of #1 - S$5,000, #2 - S$2,000 then you can set this value as 500000. This parameter should be passed only if partial_payment is true.

Know more about

.

Response Parameters

Descriptions for the response parameters are present in the

parameters table.

Error Response Parameters

The error response parameters are available in the

.

Your iOS app must seek permission from the device to open the UPI PSP app that the customer selects on Checkout. For this, you must make the following changes in 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>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-upi</string>
<string>bobupi</string>
<string>shriramone</string>
<string>indusmobile</string>
<string>whatsapp</string>
<string>kotakbank</string>
</array>

You must ensure that the UPI PSP app (Google Pay, PhonePe or Paytm) is available on the customer's device. This can be done by checking the URI scheme.

If an app is not available, it will not be displayed on the Checkout. For example, if you want to determine availability of PhonePe on customer's device:

let urlPhonePe = "phonepe://" // This will open PhonePe URL.
if let urlString = urlPhonePe.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {
if let phonepeURL = URL(string: urlString) {
if UIApplication.shared.canOpenURL(phonepeURL) {
//Show Phonepe image
} else {
// Hide Phonepe icon
}
}
}

POST
/payments/create/upi

Following are the request parameters:

amount

mandatory

integer Amount in paisa. The amount associated with the payment in smallest unit of the supported currency. For example, 2000 means ₹20.

currency

mandatory

string ISO code of the currency associated with the payment amount. In this case, it is INR.

order_id

mandatory

string Unique identifier of the order, obtained from the response of the previous step.

contact

mandatory

string Phone number of the customer.

email

mandatory

string Email address of the customer.

method

mandatory

string Method used to make the payment. Here, it is upi.

flow

mandatory

string Type of the UPI method. In this case, it is flow.

ip

mandatory

string Client's browser IP address. For example, 117.217.74.98

referer

mandatory

string Value of thereferer header passed by the client's browser. For example,

user_agent

mandatory

string Value of the user_agent header passed by client's browser. For example, Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36

notes

optional

json 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”.

description

optional

string Descriptive text of the payment.

callback_URL

optional

string URL where Razorpay will submit the final payment status.

After the URL is generated in the response of the previous step, you should edit it and prefix the app name to the URL. For example, if you detect the presence of PhonePe on the customer's device, you should add a prefix to the URL as shown below:

For Google Pay and Paytm, you should append the prefix to the URL as shown:

You can subscribe to the order.paid, payment.authorized and payment.captured Webhook events to get notified once the customer completes the UPI payment. Know more about

.

You can also poll our APIs at regular intervals to track the status of the

made for an order.

If the order is not marked paid within 2-3 minutes, you can re-initiate payment for the same order.


Is this integration guide useful?