POST {{baseurl}}/collection-accounts
- Staging
- Production
https://gw.stg.girostack.com/v1
https://gw.prod.girostack.com/v1
Headers
string
required
Pass your account’s secret key as the value.
Body Params
curl --location --request POST '{{API_BASE_URL}}/collection-accounts' \
--header 'x-giro-key: {{SECRET_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
"destination": "vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61",
"accountName": "John Doe",
"amount": 14500,
"expireIn": 1800
}'
const fetch = require("node-fetch");
const url = "{{API_BASE_URL}}/collection-accounts";
const headers = {
"x-giro-key": "{{SECRET_KEY}}",
"Content-Type": "application/json",
};
const body = JSON.stringify({
destination: "vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61",
accountName: "John Doe",
amount: 14500,
expireIn: 1800,
});
fetch(url, {
method: "POST",
headers: headers,
body: body,
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '{{API_BASE_URL}}/collection-accounts',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => array(
'x-giro-key: {{SECRET_KEY}}',
'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode(array(
'destination' => 'vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61',
'accountName' => 'John Doe',
'amount'=> 14500,
'expireIn' => 1800,
))
));
$response = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if (curl_errno($curl)) {
echo 'Error: ' . curl_error($curl);
} else {
echo "Response Code: $httpcode\n";
echo $response;
}
curl_close($curl);
?>
{
"meta": {
"statusCode": 201,
"success": true,
"message": "CollectionAccount successfully created"
},
"data": {
"publicId": "vba-6989bcba-15b0-4552-8d78-44fc0b1dd06d",
"account": "65b12bbf36e38c6bfbe35f95",
"reference": "4cacf856-9b10-4d13-9f53-0244d2c77514",
"parentAccountNumber": "9685018742",
"accountName": "John Doe",
"accountNumber": "9153058747",
"amount": 14500,
"bankName": "Source MFB",
"bankCode": "090641",
"live": true,
"processor": "source",
"expiration": "2024-05-27T09:30:40.942Z",
"id": 1,
"createdAt": "2024-05-27T09:00:40.978Z",
"updatedAt": "2024-05-27T09:00:40.978Z",
"currency": "NGN",
"active": true,
"status": "pending"
}
}
{
"meta": {
"statusCode": 400,
"error": {
"statusCode": 400,
"message": "Bad request / Validation error",
"messages": {
"destination": {
"isNotEmpty": "destination should not be empty",
"isString": "destination must be a string"
}
}
}
}
}