Feature Request
Prerequisites
- Sign up for a Razorpay account.
- Generate API Keys on the Dashboard.
- Configure payment capture settings on the Dashboard.
- Follow the Razorpay S2S Integration (Redirect) documentation.
- Customers should have earned reward points. In the absence of reward points, customers will get an error and will not be able to proceed with
Pay with Reward Points.
Integration Steps
Given below are the integration steps:1
[Fetch payment methods using the Methods API](#step-1-fetch-payment...
2
[Create an order using the Orders API](#step-2-create-an-order-usin...
3
[Create a payment using the S2S Payments Redirect API](#step-3-crea...
4
[Handle payment success and failure](#step-4-handle-payment-success...
5
[Fetch payment status](#step-5-fetch-payment-status).
Step 1: Fetch Payment Methods using Methods API
To fetch a list of payment methods enabled for your account, send the following request: /methodsRequest
Step 2: Create an order using Orders API
Create an order using the Orders API. Send the order request parameters to the following endpoint: Order is an important step in the payment process.- An order should be created for every payment.
- You can create an order using the Orders API. It is a server-side API call. Know how to authenticate Orders API.
- The
order_idreceived in the response should be passed to the checkout. This ties the order with the payment and secures the request from being tampered.
Request Parameters
amount mandatory
: integer Payment amount in the smallest currency subunit. For example, if the amount to be charged is 299, then pass 29900 in this field. In the case of three decimal currencies, such as KWD, BHD and OMR, to accept a payment of 295.991, pass the value as 295990. And in the case of zero decimal currencies such as JPY, to accept a payment of 295, pass the value as 295.
Response Parameters
Descriptions for the response parameters are present in the Orders Entity parameters table.Error Response Parameters
The error response parameters are available in the API Reference Guide.Step 3: Create a Payment using S2S Redirect Payments API
Use the following API to create a payment withapp as the payment method:
/payments/create/redirect
curl
Request Parameters
amount mandatory
: integer The amount to be paid by the customer in currency subunits. For example, if the amount is ₹100, enter 10000.
currency mandatory
: string The currency in which the payment should be made by the customer. See the list of supported currencies.
order_id mandatory
: string Order ID generated in the previous step.
email mandatory
: string Email address of the customer.
contact mandatory
: string Phone number of the customer.
method mandatory
: string Name of the payment method. Enter the value app.
provider mandatory
: string Name of the service provider partnered with Razorpay. Enter the value twid.
notes optional
: object Set of key-value pairs used to store additional information about the payment. It can hold a maximum of 15 key-value pairs, each 256 characters long (maximum).
callback_url optional
: string URL endpoint where Razorpay will submit the final payment status.
ip optional
: string Customer IP Address.
referrer optional
: string Customer referrer.
user_agent optional
: string Customer user-agent.
Response Types
2OO OK
: In this case, the response contains 200 OK code along with the HTML content that needs to be opened in the customer’s browser. This HTML content contains form fields that will be automatically posted to the bank or wallet URL (specified in the form) to continue with the payment process.
400 Bad Request
: This can happen when incorrect parameters are passed in the request. For example, passing an invalid currency or wrong card number.
400 Bad Request
Step 4: Handle Payment Success and Failure
Once the customer completes the payment, aPOST 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