Available in🇮🇳 India
You can now create an order along with a payment using a single API for netbanking, cards and UPI. Given below are details and examples for all three payment methods followed by steps to integrate S2S JSON API and accept payments using netbanking, cards and UPI.
Netbanking
Netbanking
Create an order along with payment using the consolidated order and payment API. This single API call combines order and payment creation, resulting in a more efficient and faster transaction process.Create a order along with payment by:
- Making a single API call to Razorpay, combining order and payment creation.
- Authenticating using the provided credentials, ensuring access to the consolidated payment API.
- Manually integrating the API sample codes on your server.
netbanking as the payment method:Request Parameters
The amount for which the order was created in currency subunits. For example, for an amount of ₹295.00, enter 29500. The same amount will be used for the payment creation. For the partial payment scenario, we will use the amount specified in the payment request object in case.
The currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.
Receipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
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.
Minimum amount that must be paid by the customer as the first partial payment. For example, if an amount of ₹7,000 is to be received from the customer in two installments of #1 - ₹5,000, #2 - ₹2,000, then you can set this value as
500000. This parameter should be passed only if partial_payment is true.The currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.
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".Indicates whether the account settlement for transfer is on hold. Possible values:
true: Puts the settlement on hold.false: Releases the settlement.
Payment capture settings for the payment. The options sent here override the account level auto-capture settings configured using the Dashboard.
Option to automatically capture payment. Possible values:
automatic: Payments are auto-captured according to the configurations specified in thecapture_optionsarray.manual: You have to manually capture payments using our Capture API or from the Dashboard.
Use this array to determine the expiry period for automatic and manual capture of payments and the refund speed in the case of non-capture.
Time in minutes till when payments in the
authorized state should be auto-captured.
Minimum value 12 minutes. This parameter is mandatory only if the value of capture parameter is automatic.Time in minutes till when you can manually capture payments in the
authorized state.- Must be equal to or greater than the
automatic_expiry_periodvalue. - Default value
7200minutes. - Maximum value
7200minutes. - Payments in the
authorizedstate after themanual_expiry_periodare auto-refunded.
Refund speed for payments that were not captured (automatically or manually). Possible values:
optimum: We try to process the refund instantly. We charge a small fee for this. If it is not possible to process an instant refund, we will process a normal refund in 5-7 working days. Learn more about instant refunds.normal: The refund is processed in 5-7 working days.
If no value is passed, the refund is processed using the default speed set on the Dashboard.
The amount for which the order was created in currency subunits. For example, for an amount of ₹295.00, enter 29500. The same amount will be used for the payment creation. For the partial payment scenario, we will use the amount specified in the payment request object in case.
Description of the payment.Descriptions for the response parameters are present in the Response parameter table.
Cards
Cards
The following API will create a payment with Descriptions for the response parameters are present in the Response parameter table.
cards as the payment method:Request Parameters
The amount for which the order was created in currency subunits. For example, for an amount of ₹295.00, enter 29500. The same amount will be used for the payment creation. For the partial payment scenario, we will use the amount specified in the payment request object in case.
The currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.
Receipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
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.
Minimum amount that must be paid by the customer as the first partial payment. For example, if an amount of ₹7,000 is to be received from the customer in two installments of #1 - ₹5,000, #2 - ₹2,000, then you can set this value as
500000. This parameter should be passed only if partial_payment is true.The currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.
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".Indicates whether the account settlement for transfer is on hold. Possible values:
true: Puts the settlement on hold.false: Releases the settlement.
Payment capture settings for the payment. The options sent here override the account level auto-capture settings configured using the Dashboard.
Option to automatically capture payment. Possible values:
automatic: Payments are auto-captured according to the configurations specified in thecapture_optionsarray.manual: You have to manually capture payments using our Capture API or from the Dashboard.
Use this array to determine the expiry period for automatic and manual capture of payments and the refund speed in the case of non-capture.
Time in minutes till when payments in the
authorized state should be auto-captured.
Minimum value 12 minutes. This parameter is mandatory only if the value of capture parameter is automatic.Time in minutes till when you can manually capture payments in the
authorized state.- Must be equal to or greater than the
automatic_expiry_periodvalue. - Default value
7200minutes. - Maximum value
7200minutes. - Payments in the
authorizedstate after themanual_expiry_periodare auto-refunded.
Refund speed for payments that were not captured (automatically or manually). Possible values:
optimum: We try to process the refund instantly. We charge a small fee for this. If it is not possible to process an instant refund, we will process a normal refund in 5-7 working days. Learn more about instant refunds.normal: The refund is processed in 5-7 working days.
If no value is passed, the refund is processed using the default speed set on the Dashboard.
The amount for which the order was created in currency subunits. For example, for an amount of ₹295.00, enter 29500. The same amount will be used for the payment creation. For the partial payment scenario, we will use the amount specified in the payment request object in case.
The User-Agent header of the user’s browser. The default value will be passed by Razorpay if not provided by you.
Specifies the channel through which authentication is performed. In this example, it’s set to browser.
Information regarding the customer’s browser. This parameter need not be passed when
authentication_channel=app.Indicates whether the customer’s browser supports Java. Obtained from the
navigator HTML DOM object.Indicates whether the customer’s browser can execute JavaScript.Obtained from the
navigator HTML DOM object.Time difference between UTC time and the cardholder’s browser local time. Obtained from the
getTimezoneOffset() method applied to the Date object.Total width of the payer’s screen in pixels. Obtained from the
screen.width HTML DOM property.UPI
UPI
The following API will create a payment with Descriptions for the response parameters are present in the Response parameter table.
UPI as the payment method:Request Parameters
The amount for which the order was created in currency subunits. For example, for an amount of ₹295.00, enter 29500. The same amount will be used for the payment creation. For the partial payment scenario, we will use the amount specified in the payment request object in case.
The currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.
Receipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
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.
Minimum amount that must be paid by the customer as the first partial payment. For example, if an amount of ₹7,000 is to be received from the customer in two installments of #1 - ₹5,000, #2 - ₹2,000, then you can set this value as
500000. This parameter should be passed only if partial_payment is true.The currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.
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".Indicates whether the account settlement for transfer is on hold. Possible values:
true: Puts the settlement on hold.false: Releases the settlement.
Payment capture settings for the payment. The options sent here override the account level auto-capture settings configured using the Dashboard.
Option to automatically capture payment. Possible values:
automatic: Payments are auto-captured according to the configurations specified in thecapture_optionsarray.manual: You have to manually capture payments using our Capture API or from the Dashboard.
Use this array to determine the expiry period for automatic and manual capture of payments and the refund speed in the case of non-capture.
Time in minutes till when payments in the
authorized state should be auto-captured.
Minimum value 12 minutes. This parameter is mandatory only if the value of capture parameter is automatic.Time in minutes till when you can manually capture payments in the
authorized state.- Must be equal to or greater than the
automatic_expiry_periodvalue. - Default value
7200minutes. - Maximum value
7200minutes. - Payments in the
authorizedstate after themanual_expiry_periodare auto-refunded.
Refund speed for payments that were not captured (automatically or manually). Possible values:
optimum: We try to process the refund instantly. We charge a small fee for this. If it is not possible to process an instant refund, we will process a normal refund in 5-7 working days. Learn more about instant refunds.normal: The refund is processed in 5-7 working days.
If no value is passed, the refund is processed using the default speed set on the Dashboard.
The amount for which the order was created in currency subunits. For example, for an amount of ₹299. The same amount will be used for the payment creation. For the partial payment scenario, we will use the amount specified in the payment request object in case.
Phone number of the customer. The maximum length supported is 15 characters, inclusive of country code.
The customer’s VPA (Virtual Payment Address) or UPI id used to make the payment. For example, gauravkumar@exampleupi. Required when
flow is collect.The User-Agent header of the user’s browser. The default value will be passed by Razorpay if not provided by you.
Response Parameters
Response Parameters
Response Parameters
If the payment request is valid, the response contains the following fields.Receipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
Status of the order. Possible values:
attempted: An order moves fromcreatedtoattemptedstate when a payment is first attempted on it. It remains in theattemptedstate till one payment associated with that order is captured.created: When you create an order it is in thecreatedstate. It stays in this state till a payment is attempted on it.paid: After the successful capture of the payment, the order moves to thepaidstate. No further payment requests are permitted once the order moves to thepaidstate. The order stays in thepaidstate even if the payment associated with the order is refunded.
The amount for which the order was created, in currency subunits. For example, for an amount of ₹295.00, enter
29500.The currency in which the transaction was made. See the list of supported currencies. Length must be of 3 characters.
The number of payment attempts, successful and failed, that have been made against this order.
Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each.
A list of action objects available to you to continue the payment process. Present when the payment requires further processing.
An indication of the next step available to you to continue the payment process. Possible values:
otp_generate: Use this URL to allow the customer to generate OTP and complete the payment on your webpage.redirect: Use this URL to redirect the customer to submit the OTP on the bank page.
1 Handle Payment Success and Error Events
1 Handle Payment Success and Error Events
Once a customer completes the payment, a Given below is a sample error code you will receive when the payment fails.The following error occurs when the order was processed, payment was created in Razorpay but failed at gateway level.
POST request is made to the callback_url provided in the payment request. The data contained in this request will depend on whether the payment was a success or a failure.Success Callback
If the payment made by the customer is successful, the following fields are sent:razorpay_payment_idrazorpay_order_idrazorpay_signature
Callback Example
Failure Callback
If the payment has failed, the callback will contain details of the error. Refer to Errors for details.Given below is a sample error code you will receive when the order fails.Order Create Failure Example
Payment Create Failure Example
Gateway Processing Error Example
2 Retry/Re-Attempt Request
2 Retry/Re-Attempt Request
Use the following sample code example to make a retry request using
Order id and Receipt in the request.3 Verify Payment Signature
3 Verify Payment Signature
Signature verification is a mandatory step to ensure that the callback is sent by Razorpay. The
razorpay_signature contained in the callback can be regenerated by your system and verified as follows.Create a string to be hashed using the razorpay_payment_id contained in the callback and the Order ID generated in the first step, separated by a |. Hash this string using SHA256 and your API Secret.Generate Signature on your Server
4 Integrate Payments Rainy Day Kit
4 Integrate Payments Rainy Day Kit
Use Payments Rainy Day kit to overcome payments exceptions such as:
5 Verify Payment Status
5 Verify Payment Status
Handy TipsOn the Razorpay Dashboard, ensure that the payment status is
captured. Refer to the payment capture settings page to 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 navigate to Transactions → Payments.
- Check if a Payment Id has been generated and note the status. In case of a successful payment, the status is marked as Captured.
