#API integration guide
A clientID and secret together is called an API key. An API key can be used to access resources on one deployment environment specifically, either Test or Live, but not both. Once you get the clientID and secret from Setu, use them to generate tokens to authorise all API requests.
#Generate access token
An API to generate access tokens, which are used to authorise any other API requests made to Setu.
Request
| Host | https://accountservice.setu.co |
|---|---|
| Method | POST |
| Path | /v1/users/login |
| Header | client— will be bridgeContent-Type— will be application/json |
{"clientID": "client_id","secret": "client_secret","grant_type": "client_credentials"}
💡 The access_token is valid for 300s. The access_token can be reused any number of times within its expiry, so it is advised to cache the token.
How to use the access token
- Once you have a valid token, you can use it to authorise an API calls made to Setu, by setting the
Authorizationrequest header asBearer <access_token>. - To get the new token, call the same
loginAPI at the 4th minute of token expiry and get the new token for the further API calls.
#Proceed with integration
Merchants
Integrate as a merchant to start accepting payments over UPI.
Aggregators
Integrate as an aggregator, to on-board and manage multiple merchants.
Was this page helpful?