Prerequisites
Prerequisites
- Contact our Support Team to get this feature enabled for your account.
- Keep the API key (combination of
Key_IdandKey_Secret) handy for integration. - Generate API Keys from the Dashboard if not done already.
- Configure the payment capture settings on the Dashboard.
1. Integration Flow
In TPV integration flow, Razorpay maps the investors’ bank accounts to ensure that the payment is processed only from their registered bank accounts. Follow the steps given below:1 Collect Investor Bank Account details
1 Collect Investor Bank Account details
2 Create an Order
2 Create an Order
bank_account array of the Orders API:POST /ordersThe investor needs to pay using the payment method specified by you in the order. For example, if you want the investor to pay using UPI, you must pass method=upi.Netbanking
Netbanking
method is netbanking.Debit Card
Debit Card
method is card.UPI
UPI
method is upi.Request Parameters
Create a request payload using the following attributes:amount mandatory
: integer The transaction amount expressed in paise (currency supported is INR). For example, for an actual amount of ₹1, the value of this field should be 100.currency mandatory
: string The currency in which the transaction should be made. You can create orders in INR only.receipt optional
: string Receipt number that corresponds to this order, set for your internal reference. Maximum length is 40 characters.notes optional
: json object 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”.method mandatory
: string The payment method used to make the payment. If this parameter is not passed, investors will be able to make payments using both netbanking and UPI payment methods. Possible values:netbanking: Investors can make payments only using netbanking.card: Investors can make payments using debit card.upi: Investors can make payments only using UPI.
bank_account mandatory
: object Details of the bank account that the investor has provided at the time of registration.account_number mandatory
: string The bank account number from which the investor should make the payment. For example, 765432123456789 Payments will not be processed for an incorrect account number.name mandatory
: string The name linked to the bank account. For example, Gaurav Kumar.ifsc mandatory
: string The bank IFSC. For example, HDFC0000053.3 Fetch Payment Methods
3 Fetch Payment Methods
4 Invoke Checkout and Pass Order Id and Other Options
4 Invoke Checkout and Pass Order Id and Other Options
4.1 Include the JavaScript code in your Webpage
4.1 Include the JavaScript code in your Webpage
<head> section of your page:https://checkout.razorpay.com/v1/razorpay.js instead of serving a copy from your own server. This allows new updates and bug fixes to the library to get automatically served to your application.We always maintain backward compatibility with our code.4.2 Instantiate Razorpay Custom Checkout
4.2 Instantiate Razorpay Custom Checkout
4.3 Submit Payment Details
4.3 Submit Payment Details
createPayment method:- Handler Function:
When you use the handler function, the response object of the successful payment (razorpay_payment_id,razorpay_order_idandrazorpay_signature) is submitted to the Checkout Form. You need to collect these and send them to your server. - Callback URL:
When you use a Callback URL, the response object of the successful payment (razorpay_payment_id,razorpay_order_idandrazorpay_signature) is submitted to the Callback URL.
5 Store Fields in Your Server
5 Store Fields in Your Server
Success Callback
Success Callback
- You need to store these fields in your server.
- You can confirm the authenticity of these details by verifying the signature in the next step.
razorpay_payment_id
: string Unique identifier for the payment returned by Checkout only for successful payments.razorpay_order_id
: string Unique identifier for the order returned by Checkout.razorpay_signature
: string Signature returned by the Checkout. This is used to verify the payment.6 Verify the Signature
6 Verify the Signature
To verify the `razorpay_signature` returned to you by the Checkout form:
To verify the `razorpay_signature` returned to you by the Checkout form:
-
Create a signature in your server using the following attributes:
order_id: Retrieve theorder_idfrom your server. Do not use therazorpay_order_idreturned by Checkout.razorpay_payment_id: Returned by Checkout.key_secret: Available in your server. Thekey_secretthat was generated from the Dashboard.
-
Use the SHA256 algorithm, the
razorpay_payment_idand theorder_idto construct a HMAC hex digest as shown below:
- If the signature you generate on your server matches the
razorpay_signaturereturned to you by the Checkout form, the payment received is from an authentic source.
Generate Signature on Your Server
Generate Signature on Your Server
Post Signature Verification
Post Signature Verification
Related Information
- Webhooks (Recommended)
- Error Codes (Recommended)
- How Payment Gateway Works
- Payment States
- Settlements
- Refunds