/

to search

Introducing Setu Changelog Check it out ↗

#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—

  1. User initiates bill payment on Setu’s pre-built screen
  2. 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
  3. User is redirected to the one time link, and the payment is handled by you
  4. User completes payment
  5. We get webhook event confirming payment
  6. You redirect the user back to the post payment URL, depending on success or failure of payment.

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/json

Note 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—

  • success
  • invalid-mobile-number
  • insufficient-balance

The user will proceed to pay on the link. Once the payment is done, the following steps need to be completed by you—

  1. Send Setu the webhook event for payment.
  2. Redirect the user to post payment page at postPaymentUrl provided above.

Was this page helpful?