201: Created Success 400: Bad Request Bad request
Copy {
"id": 42613,
"user_id": 423304,
"amount": 10000,
"status": "PENDING",
"reason": "",
"timestamp": "2022-07-22 16:44:36",
"bank_code": "bca",
"account_number": "5465327020",
"recipient_name": "",
"sender_bank": "bca",
"remark": "some remark",
"receipt": "",
"time_served": "(not set)",
"bundle_id": 0,
"company_id": 5770,
"recipient_city": 391,
"created_from": "API",
"direction": "DOMESTIC_TRANSFER",
"sender": null,
"fee": 4000,
"beneficiary_email": "test@mail.com,user@mail.com",
"idempotency_key": "JYsyd..."
}
Copy Request failed with status code 422
cURL NodeJs - Axios PHP - cURL
Copy curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/flipSandbox/disbursement/create?name=ft-4&connection_name=flip-entre-1' \
--header 'x-api-key: U2FsdGVk...' \
--header 'Content-Type: application/json' \
--data-raw '{
"account_number" : 4210343721,
"bank_code" : "bca",
"amount" : 20000,
"remark" : "testing",
"beneficiary_email" : "testing@gmail.com",
"recipient_city" : "109",
"idempotency_key" : "JYsyd5to..."
}'
Copy var axios = require('axios');
var data = JSON.stringify({
"account_number": 4210343721,
"bank_code": "bca",
"amount": 20000,
"remark": "testing",
"beneficiary_email": "testing@gmail.com",
"recipient_city": "109",
"idempotency_key": "JYsyd5to..."
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/flipSandbox/disbursement/create?name=ft-4&connection_name=flip-entre-1',
headers: {
'x-api-key': 'U2FsdGVk...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Copy <?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/flipSandbox/disbursement/create?name=ft-4&connection_name=flip-entre-1',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"account_number" : 4210343721,
"bank_code" : "bca",
"amount" : 20000,
"remark" : "testing",
"beneficiary_email" : "testing@gmail.com",
"recipient_city" : "109",
"idempotency_key" : "JYsyd5to..."
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: U2FsdGVk...',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;