Integration - Verify Bank Account
Bank account verification is a sub-service of Cashfree payouts that allows a merchant to verify their end customer's bank details. This section provides details on how to integrate bank account verification from scratch.
Steps
- Setup
- Initiatlization and Authorization
- Verify bank account
Check out our Libraries and Samples section for the integration code hosted on GitHub.
Step 1: Setup
Get your corresponding clientId and clientSecret from your payout dashboard and ensure that your IP is whitelisted as well. Check our development quickstart here.
Host URL: Use the following URL for PROD and TEST, respectively:
For the production environment: https://payout-api.cashfree.com
For the test environment: https://payout-gamma.cashfree.com
Step 2: Initialization and Authorisation
Call the authenticate API to Cashfree's system/server to obtain an Authorization Bearer token. All other API calls must have this token as Authorization header in the format 'Bearer ' (without quotes) for them to be processed.
curl -X POST \
'http://{{Host%20Url}}/payout/v1/authorize' \
-H 'X-Client-Id: {{client id}}' \
-H 'X-Client-Secret: {{client secret}}' \
-H 'cache-control: no-cache'
//require CashfreeSDK
const cfSdk = require('cashfree-sdk');
//access the PayoutsSdk from CashfreeSDK
const {Payouts} = cfSdk;
// Instantiate Cashfree Payouts
const payoutsInstance = new Payouts({
env: 'TEST',
clientId: '<CLIENT_ID>',
clientSecret: '<CLIENT_SECRET>',
});
from cashfree_sdk.payouts import Payouts
from cashfree_sdk.payouts.validations import Validations
clientId = "your_client_id"
clientSecret = "your_client_secret"
env = "TEST"
Payouts.init(clientId, clientSecret, env)
import com.cashfree.lib.clients.Payouts;
import com.cashfree.lib.constants.Constants.Environment;
public static void main() {
Payouts payouts = Payouts.getInstance(
Environment.PRODUCTION, "<client_id>", "<client_secret>");
payouts.init();
}
Sample Response
{
"status":"SUCCESS",
"message":"Token generated",
"subCode":"200",
"data": {"token":"eyJ0eXA...fWStg", "expiry":1564130052}
}
Step 3: Verify Bank Account
Verify a bank account by passing a name, phone number, bank account, and ifsc. Verification will be done on the bank account and ifsc combination.
The operation returns a success response in two cases:
- The bank account or IFSC code or both are invalid.
- The bank account and IFSC combination are verified.
curl -X GET \
'http://{{Host%20Url}}/payout/v1/validation/bankDetails?name=John&phone=9908712345&bankAccount=026291800001191&ifsc=YESB0000262' \
-H 'Authorization: Bearer {{Token}}' \
-H 'cache-control: no-cache'
//validate bank details
const response = await payoutsInstance.validation.validateBankDetails({
name: "sameera",
phone: "9000000000",
bankAccount: "026291800001191",
ifsc: "YESB0000262"
});
bank_validation_result = Validations.bank_details_validation(
name = "sameera",
phone = "9000000000",
bankAccount = "026291800001191",
ifsc = "YESB0000262"
)
import com.cashfree.lib.clients.Payouts;
import com.cashfree.lib.clients.Validation;
import com.cashfree.lib.domains.request.BulkValidationRequest;
Payouts payouts = Payouts.getInstance(
Environment.PRODUCTION, "<client_id>", "<client_secret>");
payouts.init();
Validation validation = new Validation(payouts);
validation.validateBankDetails(
"JOHN", "9908712345", "026291800001191", "YESB0000262"));
}
Sample Response
{
"status": "SUCCESS",
"subCode": "200",
"message": "Amount Deposited Successfully",
"data": { "nameAtBank": "John Barnes Smith", "accountExists": "YES", "amountDeposited": "1.28", "refId": "5a7da061af50584d5992b2"
}
}
You now have a complete bank account validation integration for payouts. When testing your integration with your test API key, you can use the details available here to ensure that it works correctly.
Updated 5 months ago