Disbursement
POST
Process fund disbursement to recipient bank accounts.
Endpoint
POST /api/v1/disbursement
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 |
reference_id |
string |
Yes |
Unique transaction reference ID |
amount |
decimal |
Yes |
Disbursement amount |
bank_code |
string |
Yes |
Recipient bank code |
account_number |
string |
Yes |
Recipient account number |
account_name |
string |
Yes |
Recipient account name |
description |
string |
No |
Transaction description |
Request Body
{
"reference_id": "TRN20240115001",
"amount": 100000,
"bank_code": "5",
"account_number": "1234567890",
"account_name": "John Doe",
"description": "Salary payment",
}
Response
Success Response
{
"success": true,
"message": "Disbursement request processed successfully",
"data": {
"transaction_id": "TRN_67890123456",
"reference_id": "TRN20240115001",
"amount": 100000,
"fee": 2500,
"total_amount": 102500,
"status": "PROCESS",
"bank_code": "5",
"bank_name": "Bank Central Asia",
"account_number": "1234567890",
"account_name": "John Doe",
"description": "Salary payment",
"created_at": "2024-01-15T10:30:00Z"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z"
}
}
Response Fields
| Field |
Type |
Description |
transaction_id |
string |
System generated transaction ID |
reference_id |
string |
Your unique reference ID |
amount |
decimal |
Disbursement amount |
fee |
decimal |
Transaction fee |
total_amount |
decimal |
Total amount (amount + fee) |
status |
string |
Transaction status (PROCESS, SUCCESS, FAILED) |
bank_code |
string |
Recipient bank code |
account_number |
string |
Recipient account number |
account_name |
string |
Recipient account name |
description |
string |
Transaction description |
created_at |
string |
Transaction creation timestamp |
Code Examples
PHP Example
<?php
$data = [
'reference_id' => 'TRN20240115001',
'amount' => 100000,
'bank_code' => '5',
'account_number' => '1234567890',
'account_name' => 'John Doe',
'description' => 'Salary payment',
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://openapi.swiftrans.id:7654/api/v1/disbursement',
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']) {
echo "Disbursement successful. Transaction ID: " . $result['data']['transaction_id'];
} else {
echo "Disbursement failed: " . $result['message'];
}
JavaScript Example
const disbursementData = {
reference_id: 'TRN20240115001',
amount: 100000,
bank_code: '5',
account_number: '1234567890',
account_name: 'John Doe',
description: 'Salary payment',
};
try {
const response = await fetch('https://openapi.swiftrans.id:7654/api/v1/disbursement', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify(disbursementData)
});
const result = await response.json();
if (response.ok && result.success) {
console.log('Disbursement successful:', result.data.transaction_id);
} else {
console.error('Disbursement failed:', result.message);
}
} catch (error) {
console.error('Disbursement error:', error);
}
cURL Example
curl -X POST https://openapi.swiftrans.id:7654/api/v1/disbursement \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"reference_id": "TRN20240115001",
"amount": 100000,
"bank_code": "5",
"account_number": "1234567890",
"account_name": "John Doe",
"description": "Salary payment",
}'
Error Responses
Insufficient Balance
{
"success": false,
"message": "Insufficient balance",
"error_code": "INSUFFICIENT_BALANCE"
}
Invalid Bank Account
{
"success": false,
"message": "Invalid bank account",
"error_code": "INVALID_ACCOUNT",
}
Duplicate Reference ID
{
"success": false,
"message": "Reference ID already exists",
"error_code": "DUPLICATE_REFERENCE"
}
Transaction Status
| Status |
Description |
| PROCESS |
Transaction is being processed |
| SUCCESS |
Transaction completed successfully |
| FAILED |
Transaction failed |
Important Notes
- Reference ID: Must be unique for each transaction
- Amount: Minimum amount is IDR 10,000
- Account Validation: Use the Check Bank Account API to validate before disbursement
- Idempotency: Duplicate reference_id will be rejected