Website
Web integration with your own payment gateway
This quickstart explains how to integrate when you opt for your own payment gateway. Use this guide for Setu’s default UPI payment option.
The payment flow
The following steps describe a typical payment scenario—
- User initiates bill payment on Setu’s pre-built screen
- Setu calls the Get payment link API from Setu backend to your backend—you give us a one time link where we can redirect your customer for payment
- User is redirected to the one time link, and the payment is handled by you
- User completes payment
- We get webhook event confirming payment
- You redirect the user back to the post payment URL, depending on success or failure of payment.
Get payment link API
You need to implement the following API for this purpose
URL
As you provided by you, with the suffix: /setu/v1/getPaymentLink.
For example, if the URL provided by you is https://example.com, the URL for this API will be https://example.com/setu/v1/getPaymentLink.
Headers
X-SETU-BILLPAY-API-KEY: 77kxHrhbKNYXMwzHWFranymXV2xRkSRE
Content-Type: application/jsonNote that the API key is issued by you
Request
{
"orderId": "je9V7wWs9N3w",
"amount": 1201.00,
"customerMobileNumber": "9481773053",
"postPaymentUrl": "https://billpay.setu.co/payment/post-payment/c4e154e6-7b2b-4e0a-9749-60499b61ce93",
"allowedPaymentModes": [
"CASH", "UPI", "CREDIT CARD" // list of allowed values for "paymentMode" in webhooks
]
}Response
{
"code": "success",
"data": {
"link": "https://example.com/onetimepayment-link"
}
}The following codes are supported by Setu—
successinvalid-mobile-numberinsufficient-balance
The user will proceed to pay on the link. Once the payment is done, the following steps need to be completed by you—
- Send Setu the webhook event for payment.
- Redirect the user to post payment page at
postPaymentUrlprovided above.