Skip to main content
Available in🇮🇳 India
Follow these steps to add Embedded Quick Buy to your React Native app. The integration builds on the React Native Custom UI SDK. You render your own payment UI, and Razorpay processes the payment.
Already on the React Native Custom UI SDK?The steps specific to Quick Buy are 1.3 Create a Customer and 1.4 Fetch Recommended Instruments. All other steps follow the standard Custom UI SDK integration.If you use the React Native Standard SDK (react-native-razorpay), add react-native-customui alongside it. The Custom UI SDK powers the Quick Buy button. Your Standard Checkout continues to open when the customer taps Change payment method.
1.1 Install the SDK. 1.2 Link the SDK. 1.3 Create a Customer. New for Quick Buy. 1.4 Fetch Recommended Instruments. New for Quick Buy. 1.5 Create an Order in Server. 1.6 Import the Razorpay Module. 1.7 Submit Payment. 1.8 Store Fields in Your Server. 1.9 Verify Payment Signature. 1.10 Verify Payment Status.

1.1 Install the SDK

Install react-native-customui version 2.2.9 or later. Earlier versions do not support getRecommendedInstruments().
Automatic linking
  1. Install the SDK:
    Terminal
  2. Go to the ios folder and run pod install.
Handy TipsMake sure Razorpay.framework is added in the Embedded Binaries section and that Always Embed Swift Standard Libraries is set to Yes in Build Settings.
Manual linking with CocoaPods
  1. Add this line to your build targets in your Podfile:
    Podfile
  2. Run pod install.
Manual linking without CocoaPods
  1. In Xcode, right-click Libraries → Add Files to [your project’s name]. Go to node_modules/react-native-customui and add the .xcodeproj file.
  2. Select your project in the navigator. Add libRNDeviceInfo.a from the deviceinfo project to Build Phases → Link Binary With Libraries.
  3. In Build Settings, select All. Under Header Search Paths, check that $(SRCROOT)/../react-native/React and $(SRCROOT)/../../React are present and set to recursive.
  4. Run the project with Cmd + R.
ExpoAfter adding the package, prebuild the app to generate the native iOS folders:
Terminal
M1 MacIf you build on an Apple Silicon (M1) Mac, add this inside post_install do |installer| in your Podfile:
Podfile

1.3 Create a Customer

Create a customer on your server with the Customers API. You can do this asynchronously, for example when you collect the customer’s details. Use the customer_id returned in the response to fetch recommended instruments in step 1.4.
Initialise the SDK with Razorpay.initRazorpay(), then call Razorpay.getRecommendedInstruments() to get the customer’s recommended payment instruments.
  • The response contains up to 3 instruments, ranked by how likely the customer is to complete the payment. items[0] is the strongest recommendation.
  • The SDK checks which UPI apps are installed on the device and returns only those.
  • The response includes the logos you need to render the Quick Buy button.
  • Pass the order_id so that all instrument types are eligible. Without an order_id, the response is limited to UPI intent apps and amount and currency become mandatory.
  • Pass the customer’s contact number in customer.contact. It is mandatory by default, although this depends on your account configuration. If it is required and missing, the call fails.
JavaScript
Watch Out!
  • initRazorpay() does not return a promise. On Android, the SDK initialises on the UI thread, so calling getRecommendedInstruments() immediately after it can fail. Call initRazorpay() earlier in the flow, for example when the checkout screen loads, and fetch recommendations after it.
  • Always show a Change payment method option next to the Quick Buy button. It should open the full Razorpay Checkout, as per the React Native Standard Checkout integration. Take the customer straight to the full checkout rather than to an intermediate screen.
  • If the response has no instruments, or the call fails, show your regular checkout instead of the Quick Buy button.

Sample Response

Response

Response Parameters

1.5 Create an Order in Server

Create an order on your server using the Orders API when the customer taps the Quick Buy button, or earlier if you pass the order_id in step 1.4.
Watch Out!Create an order for every payment, server-side, using your API Key ID and secret. Payments made without an order_id cannot be captured and are automatically refunded.

Request Parameters

amount mandatory : integer Payment amount in the smallest currency sub-unit. For example, pass 50000 for ₹500. currency mandatory : string The 3-letter ISO currency code. For example, INR. customer_id mandatory : string The customer ID returned in step 1.3. receipt optional : string Your receipt number for the order. Maximum 40 characters. notes optional : object Key-value pairs for additional information. Maximum 15 pairs of 256 characters each. partial_payment optional : boolean Set to true to accept partial payments. Defaults to false. first_payment_min_amount optional : integer Minimum amount for the first partial payment. Use only when partial_payment is true.

1.6 Import the Razorpay Module

Import the Razorpay module into your React Native component:
JavaScript

1.7 Submit Payment

When the customer taps the Quick Buy button, call Razorpay.open() with the payment options for the recommended instrument. The method returns a promise:
  • then handles a successful payment.
  • catch handles a failed payment.
For a recommended UPI app, pass method: 'upi', _[flow]: 'intent' and the app’s package name in upi_app_package_name:
JavaScript
For other payment methods, use the same payloads as your existing React Native Custom UI integration.

Checkout Parameters

order_id mandatory : string The order ID created in step 1.5. description optional : string Description of the purchase. Must start with an alphanumeric character. image optional : string URL or base64 string of your business logo. notes optional : object Key-value pairs for additional information. Maximum 15 pairs of 256 characters each. callback_url optional : string URL to redirect the customer to after payment. It must accept POST requests. On success, it receives razorpay_payment_id, razorpay_order_id and razorpay_signature. redirect conditional : boolean Mandatory if you pass callback_url. Set to true to redirect the customer to callback_url or false to keep them in the app.

1.8 Store Fields in Your Server

A successful payment returns these fields. Store them on your server and verify the signature in the next step.
Success Response
razorpay_payment_id : string Unique identifier of the payment. Returned only for successful payments. razorpay_order_id : string Unique identifier of the order. razorpay_signature : string Signature used to verify that the payment is authentic.

1.9 Verify Payment Signature

Verify the signature on your server to confirm the payment is authentic. This step is mandatory. Never verify the signature in the app.
  1. Use the order_id stored on your server. Do not use the razorpay_order_id returned to the app.
  2. Create an HMAC-SHA256 hex digest of order_id + "|" + razorpay_payment_id using your API key secret.
  3. If the digest matches razorpay_signature, the payment is authentic.
Pseudocode
Java (server-side)

1.10 Verify Payment Status

Confirm that the payment status is captured. You can track it in 3 ways:
  • Dashboard: Log in to the Dashboard and go to Transactions → Payments. A successful payment has a payment ID and the status Captured.
  • Webhooks: Subscribe to payment webhook events for real-time updates.
  • API: Poll the Fetch a Payment API with the razorpay_payment_id.
Handy TipsUse Payment Capture Settings to capture payments automatically.

Next Steps

  • Test your integration in Test Mode.
  • Set up webhooks for real-time payment events.
  • Replace your test API keys with live keys when you are ready to go live.