Managing bank accounts
List, add and delete bank accounts.
Add a new bank account
Here's an example code to add a new bank account.
import { createSignature } from "./createSignature";
const axios = require('axios');
const apiKey = "{YOUR API KEY}";
const secret = "{YOUR SECRET}";
async function addBankAccount() {
const path = "https://idrx.co/api/auth/add-bank-account";
const req = {
"bankAccountNumber" : "{BANK ACCOUNT NUMBER}",
"bankCode" : "{BANK CODE}",
};
const bufferReq = Buffer.from(JSON.stringify(req), 'base64').toString('utf8');
const timestamp = Math.round((new Date()).getTime()).toString();
const sig = createSignature('POST', path, bufferReq, timestamp, secret);
const res = await axios.post(path, req, {
headers: {
'Content-Type': 'application/json',
'idrx-api-key': apiKey,
'idrx-api-sig': sig,
'idrx-api-ts' : timestamp,
},
});
console.log('res.data: ');
console.log(JSON.stringify(res.data, null, 4));
}
addBankAccount();You can get a list of available bank codes from this api.
After a successful request, you will get a response as follows:
Notice that a deposit wallet address is also included. Users can send funds to this deposit address to request a redeem to the associated bank account.
To list currently registered bank accounts, you can use this api.
Delete a bank account
Here's an example code to delete an existing bank account.
After a successful request, you will get a response as follows:
Last updated