TPV Standard Integration
Create a FiatPe order with the customer’s registered bank account, open Checkout with the returned order_id, and verify the completed payment on your server.
Prerequisites
- TPV is activated for your FiatPe account.
- Your server securely stores the customer’s verified bank details.
- You have FiatPe Test API credentials and have selected Hosted or Embedded Checkout for your customer journey.
- Your backend verifies signatures and the final payment status.
Choose a checkout experience
TPV supports both checkout options. Account ownership is validated using the registered bank_details; the checkout option determines where the customer completes payment.
Hosted Checkout
Create a Checkout Session on your server, include the verified customer bank details, and redirect the customer to FiatPe's secure hosted payment page.
- Lower frontend integration effort
- FiatPe manages the checkout-page interface
- Pass
bank_detailsin the session request
Embedded Checkout
Create a TPV order on your server and open Checkout.js from your own page using the returned order_id.
- Checkout starts from your website
- More control over the surrounding experience
- Pass
bank_detailsin the order request
1. Build the integration
- 1
Collect registered bank details
Collect and verify the customer’s account number, account-holder name, and IFSC during onboarding.
- 2
Create the TPV payment context
Send the customer’s registered bank account when creating a Checkout Session or order.
- 3
Open FiatPe Checkout
Redirect to Hosted Checkout or pass the returned order ID to Checkout.js for Embedded Checkout.
- 4
Handle the result
Handle success and failure callbacks without treating the browser response as authoritative.
- 5
Store identifiers
Persist the FiatPe order ID and payment ID against your internal customer and transaction records.
- 6
Verify the payment
Verify the SHA-512 signature and fetch the final payment status before fulfilment.
2. Create the TPV payment context
Always create the Checkout Session or order on your server. Include the customer's verified bank_details so FiatPe can perform TPV matching. Never accept these values from untrusted browser input.
https://api.fiatpe.com/v1/orders/session/Hosted Checkout: create a session
Use this flow when the customer completes payment on the FiatPe-hosted page. The session request must include the bank account registered and verified for that customer.
curl -X POST https://api.fiatpe.com/v1/orders/session/ \
-H "Authorization: Basic YOUR_BASE64_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"currency": "INR",
"method": "UPI",
"reference_id": "INVESTMENT_13375649",
"return_url": "https://example.com/",
"return_method": "POST",
"bank_details": {
"account_number": "765432123456789",
"name": "Customer Name",
"ifsc": "HDFC0000053"
},
"metadata": {
"customer_id": "customer_12345"
},
"expires_at": 1792998833
}'Hosted Checkout Session response
Store the returned order and session identifiers, then redirect the customer to data.checkout_url to continue payment on FiatPe Hosted Checkout.
{
"data": {
"id": "order_ecc8937cde1b4980",
"session_id": "74ea117bd1710e0a1e97e9f3ff6c1442ba6063a3c541580d6dc3d8cf1702ab00",
"entity": "order",
"currency": "INR",
"amount": 1000,
"amount_pending": 1000,
"amount_paid": 0,
"method": null,
"status": "created",
"metadata": {},
"checkout_url": "https://api.fiatpe.com/hosted/74ea117bd1710e0a1e97e9f3ff6c1442ba6063a3c541580d6dc3d8cf1702ab00/",
"return_url": null,
"return_method": "POST",
"expires_at": 1792998624,
"created_at": 1792822494,
"bank_details": null
},
"message": "order created successfully."
}How to collect the payment
The /v1/orders/session/ API does not collect payment by itself. It creates a secure checkout session and returns a checkout_url. Redirect the customer to that URL so they can choose a payment method and complete the payment.
- 1
Create the session on your backend
Call
POST /v1/orders/session/with the amount, return configuration, and verified TPV bank details. Never expose your API credentials in frontend code. - 2
Store the returned identifiers
Save
data.idanddata.session_idagainst your internal transaction before redirecting the customer. - 3
Redirect to Hosted Checkout
Send
data.checkout_urlto your frontend and redirect the customer to that exact URL. Do not construct the hosted URL manually. - 4
Handle the customer return
After checkout, FiatPe returns the customer to the configured
return_urlusing the selectedreturn_method. - 5
Verify before fulfilment
Confirm the authoritative payment status on your backend or through a verified webhook. Never treat the browser redirect alone as proof of payment.
// Response returned by your backend after it creates the Checkout Session
const session = await response.json();
// Redirect the customer to the exact checkout_url returned by FiatPe
window.location.assign(session.data.checkout_url);The session URL identifies the payment context. Do not edit it, generate it from the session ID, or expose server credentials while redirecting the customer.
Handle the Hosted Checkout return
After the payment attempt, FiatPe sends the result to the configured return_url. When return_method is POST, your return endpoint should accept the submitted form fields and render an appropriate success or failure experience.
Successful payment return
A successful return contains the payment ID, order ID, and signature. Verify the signature and confirm the final payment status on your backend before marking the transaction as paid.
{
"payment_id": "FIATPESTYQHKCXNANT1792823689",
"order_id": "order_604cb9510bdd4e52",
"signature": "e58e45536ff8aebe36ea0685c95aa738ba4c4864b350a70286c2bd0b92bd1370cbfa3b92f7f7b62079c5448a010450eec895c429339636348bd826f4a9c43774"
}Failed payment return
A failed return contains bracket-notation error fields. Parse these fields as submitted, retain the payment ID for support and reconciliation, and show the customer a safe retry option when appropriate.
{
"error[code]": "PAYMENT_FAILED",
"error[description]": "Insufficient balance in your bank account. Please add funds and try again.",
"error[source]": "business",
"error[step]": "payment_processing",
"error[reason]": "payment_failed",
"error[metadata][payment_id]": "FIATPEST8RRKLHIZO31792822902"
}Use the success payload for the customer journey, but verify its signature and authoritative server-side payment status before fulfilment. Never mark an order paid from the browser redirect alone.
Embedded Checkout: create an order
Send the bank account that was registered and verified for the customer.
curl -X POST https://api.fiatpe.com/v1/orders/ \
-H "Authorization: Basic YOUR_BASE64_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"currency": "INR",
"method": "UPI",
"reference_id": "INVESTMENT_13375649",
"bank_details": {
"account_number": "765432123456789",
"name": "Customer Name",
"ifsc": "HDFC0000053"
},
"metadata": {
"customer_id": "customer_12345"
}
}'Example response
{
"data": {
"id": "order_2f40f08f4baa4e5b",
"amount": 100,
"entity": "order",
"status": "created",
"currency": "INR",
"method": "UPI",
"metadata": {},
"created_at": 1788148983,
"return_url": null,
"amount_paid": 0,
"bank_details": {
"account_number": "765432123456789",
"name": "Customer Name",
"ifsc": "HDFC0000053"
},
"reference_id": null,
"return_method": "POST",
"amount_pending": 100
},
"message": "order created successfully."
}Request parameters
| Parameter | Required | Description |
|---|---|---|
amount | Yes | Payment amount in the currency’s smallest sub-unit. |
currency | Yes | Three-letter currency code. Use INR for this flow. |
method | No | Can use UPI to restrict the payment method to UPI. Otherwise, can choose any of the payment methods enabled for you. |
reference_id | Recommended | Your unique internal order or investment reference. |
return_url | Required for Hosted Checkout | The HTTPS page where FiatPe returns the customer after checkout. |
return_method | No | HTTP method used for the return flow. This example uses POST. |
bank_details | Yes for TPV | The bank account registered and verified for the customer. |
bank_details.account_number | Yes | Registered bank account number. |
bank_details.name | Yes | Name associated with the registered account. |
bank_details.ifsc | Yes | IFSC of the registered bank branch. |
metadata | No | Internal key-value data used for reconciliation. |
3. Test the integration
Use only FiatPe Test credentials and test payment details. Test successful matching, account mismatch, failure, cancellation, duplicate callback, and retry flows before going live.
4. Go live
Enable Live credentials only after FiatPe has activated TPV and your compliance team has approved the flow. Continue to verify the signature and authoritative payment status before fulfilling every transaction.
Never place the Salt Key or full registered bank details in browser code, URLs, analytics, or application logs.