Check Bank Account
POST
Validate bank account information before processing disbursement.
Endpoint
POST /api/v1/check-account
Request Headers
| Header |
Required |
Description |
Authorization |
Yes |
Bearer token from login |
Content-Type |
Yes |
application/json |
Accept |
Yes |
application/json |
Request Parameters
| Parameter |
Type |
Required |
Description |
bank_code |
string |
Yes |
Bank code to validate |
account_number |
string |
Yes |
Account number to validate |
Request Body
{
"bank_code": "5",
"account_number": "1234567890"
}
Response
Success Response (Valid Account)
{
"success": true,
"message": "Bank account validation successful",
"data": {
"bank_code": "5",
"bank_name": "Bank Central Asia",
"account_number": "1234567890",
"account_name": "John Doe",
"is_valid": true,
"status": "ACTIVE"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z"
}
}
Success Response (Invalid Account)
{
"success": true,
"message": "Bank account validation completed",
"data": {
"bank_code": "5",
"bank_name": "Bank Central Asia",
"account_number": "1234567890",
"account_name": null,
"is_valid": false,
"status": "NOT_FOUND"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z"
}
}
Response Fields
| Field |
Type |
Description |
bank_code |
string |
Bank code that was validated |
bank_name |
string |
Full bank name |
account_number |
string |
Account number that was validated |
account_name |
string |
Account holder name (null if invalid) |
is_valid |
boolean |
Whether the account is valid |
status |
string |
Account status (ACTIVE, INACTIVE, NOT_FOUND, BLOCKED) |
Account Status Types
| Status |
Description |
| ACTIVE |
Account is active and can receive funds |
| INACTIVE |
Account exists but is inactive |
| NOT_FOUND |
Account number does not exist |
| BLOCKED |
Account is blocked/suspended |
Code Examples
PHP Example
<?php
$data = [
'bank_code' => '5',
'account_number' => '1234567890'
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://openapi.swiftrans.id:7654/api/v1/check-account',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer ' . $accessToken,
'Content-Type: application/json',
'Accept: application/json'
),
));
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
$result = json_decode($response, true);
if ($httpCode === 200 && $result['success']) {
if ($result['data']['is_valid']) {
echo "Account is valid. Holder: " . $result['data']['account_name'];
} else {
echo "Account is invalid. Status: " . $result['data']['status'];
}
} else {
echo "Validation failed: " . $result['message'];
}
JavaScript Example
const accountData = {
bank_code: '5',
account_number: '1234567890'
};
try {
const response = await fetch('https://openapi.swiftrans.id:7654/api/v1/check-account', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify(accountData)
});
const result = await response.json();
if (response.ok && result.success) {
if (result.data.is_valid) {
console.log('Account is valid:', result.data.account_name);
} else {
console.log('Account is invalid:', result.data.status);
}
} else {
console.error('Validation failed:', result.message);
}
} catch (error) {
console.error('Validation error:', error);
}
cURL Example
curl -X POST https://openapi.swiftrans.id:7654/api/v1/check-account \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"bank_code": "5",
"account_number": "1234567890"
}'
Error Responses
Invalid Bank Code
{
"success": false,
"message": "Invalid bank code",
"error_code": "INVALID_BANK_CODE",
}
Invalid Account Number Format
{
"success": false,
"message": "Invalid account number format",
"error_code": "INVALID_FORMAT",
}
Service Unavailable
{
"success": false,
"message": "Bank validation service temporarily unavailable",
"error_code": "SERVICE_UNAVAILABLE"
}
Best Practices
- Always Validate: Check account validity before processing disbursement
- Handle Errors: Implement proper error handling for validation failures
- Cache Results: Cache valid account information to reduce API calls
- User Experience: Show account holder name for confirmation
- Retry Logic: Implement retry for temporary service unavailability
Rate Limiting
- Maximum 100 validation requests per minute
- Use caching to minimize repeated validations
- Implement exponential backoff for rate limit errors
Important Notes
- Account validation is real-time with bank systems
- Some banks may have temporary service interruptions
- Invalid accounts will prevent successful disbursement
- Account holder name matching is recommended for security