This is a Chainlink External Adapter for connecting to a UPI (Unified Payments Interface) API provided by a partner bank or a PSP (Payment Service Provider).
This adapter has the necessary interfaces to add and support more than one bank API providers.
Currently there is existing support for these API providers:
-
Install dependencies
npm install
-
Build TypeScript files
npm run build
-
Set up Environment variables
-
Optional: Run tests
npm test
. Please read Testing first! -
Run this adapter using a serverless provider:
- use the
handler()
wrapper for AWS Lambda - use the
gcpservice()
wrapper for GCP
- use the
-
Use one of the available Available methods
- Set method name in
data.method
, along with method-specific parameters
- Set method name in
To create a ZIP file to upload to AWS/GCP, run:
zip -r cl-ea.zip .
docker build . -t upi-adapter
docker run -d \
-p 8080:8080 \
-e EA_PORT=8080 \
--env-file .env
upi-adapter
For a complete list of environment variable required see src/config.ts
.
You need to set atleast the chainlink NODE_* environment variables and any other bank API related parameters as env variables.
Before you start testing, make sure you have necessary PayPal developer credentials set up.
Set the MODE
env variable to sandbox
.
To test the getPayout method with another payout other than the one created in the test, set the TEST_PAYOUT_ID
env var.
The src/httpClients/index.ts
file has the up to date list of supported banks.
The bank can be specified by the bank
key in the request body.
Currently accepted values for the bank
field are:
mock
rbl
cashfree
Method can be specified by the method
key in the request body or the API_METHOD
environment variable. If the
environment variable is set, it takes precedence over the method specified in the request body.
Send a payout with the collectRequest API.
Variable | Type | Description | |
---|---|---|---|
amount |
Integer, decimal | Required | Amount to request from the payer VPA. |
sender |
String | Required | The VPA/UPI ID of the payer |
receiver |
String | Required | The VPA/UPI ID of the payee |
note |
String | Optional | Custom note for this collect request |
Please refer to the Bank API documentation for more information on each parameter.
Get details of a transaction.
Variable | Type | Description | |
---|---|---|---|
txId |
String | Required | The transaction ID of the payment to look up |
Please refer to the Bank API documentation for more information on each parameter.
- Add bug reporting
- Add logging collector/debugging
- Add metrics monitoring
- Have a scheduling mechanism for refreshing bank session token.
In order to use this adapter, you will need to create an account with and obtain credentials from a payments bank acting as a PSP for the UPI payments network and agree to and comply with their applicable terms, conditions and policies.