Skip to main content
Available in🇮🇳 India
Follow these steps to add Embedded Quick Buy to your mobile website. The integration builds on Razorpay Custom Checkout and shows a customer’s recommended saved card or UPI app on your product or cart page, before the full checkout opens.
Already on Custom Checkout?If you have already integrated Razorpay Custom Checkout on your mobile website, the only new step is 1.5 Fetch Recommended Instruments. Make sure you also create customers (step 1.2), as Quick Buy needs them. All other steps stay the same.
1.1 Include razorpay.js in Your Webpage. 1.2 Create a Customer. Required for Quick Buy. 1.3 Create an Order in Server. 1.4 Instantiate Custom Checkout. 1.5 Fetch Recommended Instruments. New for Quick Buy. 1.6 Submit Payment. 1.7 Store Fields in Your Server. 1.8 Verify Payment Signature. 1.9 Verify Payment Status.

1.1 Include razorpay.js in Your Webpage

Add the razorpay.js script to the <head> section of every page where the Quick Buy button appears:
HTML
Handy TipsAlways load the script directly from https://checkout.razorpay.com/v1/razorpay.js. Do not host it yourself. This way your integration automatically receives the latest updates and bug fixes.

1.2 Create a Customer

Create a customer on your server with the Customers API. You can do this asynchronously, for example when the customer registers or starts checkout. Use the customer_id returned in the response to fetch recommended instruments in step 1.5.

1.3 Create an Order in Server

Create an order on your server using the Orders API. Create the order before you fetch recommended instruments, so that all instrument types are eligible.
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.2. 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.

1.4 Instantiate Custom Checkout

Create a Razorpay instance with your API Key ID. Know more about instantiating Custom Checkout.
JavaScript
Call Razorpay.getRecommendedInstruments() to get the customer’s recommended payment instruments. On mobile web, this is a JavaScript function in razorpay.js.
  • 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 response includes the logos you need to render the Quick Buy button.
  • Pass the order_id from step 1.3. If you do not, the response is limited to UPI intent apps and amount and currency become mandatory.
  • Pass the customer_id. If you do not have one, pass the customer’s contact number in customer.contact.
JavaScript
Watch Out!
  • Always show a Change payment method option next to the Quick Buy button. It should open the full Razorpay Checkout, as in your current integration.
  • If the response has no instruments, or the call fails, show your regular checkout button instead of the Quick Buy button.
  • The browser cannot check whether a UPI app is installed. Show every UPI app returned. If an app is not installed, the device handles the failed deep link.

Sample Response

Response

Response Parameters

1.6 Submit Payment

When the customer taps the Quick Buy button, call razorpay.createPayment() inside the click event listener. Pass the fields for the recommended instrument’s method, for example the saved card token or the UPI app. Use the same createPayment() payloads as your existing Custom Checkout integration. Know more about submitting payment details.

1.7 Store Fields in Your Server

A successful payment returns razorpay_payment_id, razorpay_order_id and razorpay_signature. Store these on your server. Know more about storing fields in your server.

1.8 Verify Payment Signature

Verify the signature on your server to confirm the payment is authentic. This step is mandatory. Know more about verifying the payment signature.

1.9 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.
Know more about verifying the payment status.
Handy TipsUse Payment Capture Settings to capture payments automatically.

Next Steps

  • Test your integration in Test Mode.
  • Set up the full checkout as the fallback for customers who tap Change payment method.
  • Replace your test API keys with live keys when you are ready to go live.