Available in🇮🇳 India
Pay Later lets your customers buy now and pay the provider later, using a credit line the provider has approved for them. The customer confirms the payment on the provider’s page. You receive the full amount in your settlement, and the customer repays the provider separately.
This page describes how to accept Pay Later payments using the S2S JSON API. Pay Later uses method=paylater together with a provider code.
Handy TipsContact our Support team to enable Pay Later and the providers you want for your account. Customers must have an account with the provider they choose.
Integration Steps
Follow these steps to integrate the S2S JSON API and accept payments using Pay Later: 1.1 Fetch the List of Pay Later Providers. 1.2 Create an Order. 1.3 Create a Payment. 1.4 Handle Payment Success and Error Events. 1.5 Fetch Payment Details and Status. 1.6 Verify Payment Signature. 1.7 Integrate Payments Rainy Day Kit. 1.8 Verify Payment Status.1.1 Fetch the List of Pay Later Providers
Fetch the Pay Later providers enabled on your account and their codes. You pass the provider code in theprovider field when you create a payment.
The response contains only the providers enabled for your account. A provider that is not enabled for you does not appear in the paylater object. Pass your key id as the key_id query parameter. Do not send the key secret to this endpoint.
GET /v1/methods
Supported providers
The provider approves each payment against the customer’s available credit limit.
Check eligibility before checkout (optional). To show only the providers a customer is eligible for, call the Eligibility Check API (
POST /v1/customers/eligibility) before you display Pay Later options. Know more about the Eligibility Check API.
1.2 Create an Order
Create an order for every payment. The order ties the payment to the purchase in your system and protects the request from tampering. Create the order from your server using the Orders API.POST /v1/orders
Request Parameters
Payment amount in the smallest currency sub-unit. For example, for ₹3,000, enter
300000.Key-value pairs for additional information. Maximum 15 pairs, 256 characters each. For example,
"note_key": "Beam me up Scotty".1.3 Create a Payment
After you create the order, create a payment withpaylater as the method and the provider code from step 1.1.
POST /v1/payments/create/json
Request Parameters
Payment amount in the smallest currency sub-unit. Must match the order amount. For example, for ₹3,000, enter
300000.The unique identifier of the order created in step 1.2.
Customer’s mobile number. Use an Indian mobile number. Pay Later providers identify the customer by this number.
Code of the Pay Later provider. Possible values:
lazypay: LazyPayamazonpay: Amazon Pay Later
paylater object in step 1.1.URL on your server where Razorpay sends a
POST request with the payment result after the customer completes or abandons the payment on the provider page. Pass this URL to receive the success and failure callbacks in step 1.4.Response Parameters
If the payment request is valid, the response contains these fields: Redirect the customer to theurl of the redirect action. The customer confirms the payment on the provider page, for example, by entering the OTP the provider sends. After that, Razorpay sends the customer back to your callback_url.
1.4 Handle Payment Success and Error Events
After the customer completes or cancels the payment, Razorpay sends aPOST request (form-encoded) to the callback_url you passed in the payment request. The fields depend on whether the payment succeeded or failed.
Success Callback
If the payment is successful, the callback contains these fields:razorpay_payment_idrazorpay_order_idrazorpay_signature
Callback Example
Failure Callback
If the payment fails, the callback contains anerror object. For example, this callback is sent when the customer cancels the payment on the provider page:
Callback Example
- The customer cancelled the payment on the provider page.
- The customer is not registered with or not eligible for the provider.
- The customer’s available credit limit is lower than the amount.
- The customer exceeded the OTP attempts on the provider page.
- The provider declined the payment, or the customer did not complete it in time.
description and let them retry with another payment method. Refer to Errors for the full list of error codes and reasons.
1.5 Fetch Payment Details and Status
Use therazorpay_payment_id from the callback to fetch the payment and check its status.
GET /v1/payments/:id
Handy TipsFor Pay Later payments, the payment entity returns the provider code in the
wallet field. For example, "wallet": "lazypay".1.6 Verify Payment Signature
Signature verification is mandatory. It confirms that the callback came from Razorpay. Build a string from theorder_id you created in step 1.2 and the razorpay_payment_id from the callback, separated by |. Generate an HMAC-SHA256 hex digest of this string using your key secret. Compare it with razorpay_signature.
Pseudocode
order_id stored on your server, not the razorpay_order_id from the callback.
1.7 Integrate Payments Rainy Day Kit
Use the Payments Rainy Day Kit to handle payment exceptions such as:1.8 Verify Payment Status
Handy TipsEnsure the payment status is
captured. A payment in authorized status is not settled to you until it is captured. Know how to capture payments automatically.You can track the payment status in three ways:
You can track the payment status in three ways:
- Verify Status from Dashboard
- Subscribe to Webhook Events
- Poll APIs
To verify the payment status from the Razorpay Dashboard:
- Log in to the Razorpay Dashboard and go to Transactions → Payments.
- Check that a payment id has been generated and note its status. A successful payment shows Captured.