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 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 JSON Payments API](#step-3-create-a...
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 JSON Payments API
Use the following API to create a payment withapp as the payment method:
/payments/create/json
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 Parameters
If the payment request is valid, the response contains the following fields.razorpay_payment_id
: string Unique identifier of the payment. Present for all responses.
next
: array A list of action objects available to you to continue the payment process. Present when the payment requires further processing.
action
: string An indication of the next step available to you to continue the payment process. Possible value:
redirect: Use this URL to redirect customers to the Twid page. Customers should select the reward points here and complete the redemption process/
url
: string URL to be used for the action indicated.
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