Create an invoice
Attributes
Attribute
Type
Description
Required
external_id
string
ID of your choice (typically the unique identifier of an invoice in your system).
example: INV001/V/2022
✅
amount
number
Amount on the invoice
✅
description
string
Description of invoice
for more information,here
POST
https://us-central1-appgregator.cloudfunctions.net/xendit/invoices/
Query Parameters
Name
Type
Description
name*
String
ft-4
connection_name*
String
xendit-sanbox-1
callback_url*
String
https://example.com/callback
Headers
Name
Type
Description
x-api-key*
String
U2Fsd...
{
"id": "62f00ac409accd62c85673c4",
"external_id": "INV0048/VIII/2022",
"user_id": "6279ce4495d10c9afc3171b8",
"status": "PENDING",
"merchant_name": "aplikasi keuangan",
"merchant_profile_picture_url": "https://du8nwjtfkinx.cloudfront.net/xendit.png",
"amount": 8500000,
"description": "Invoice Demo #INV0048",
"expiry_date": "2022-08-08T18:56:04.164Z",
"invoice_url": "https://checkout-staging.xendit.co/web/62f00ac409accd62c85673c4",
"available_banks": [
{
"bank_code": "MANDIRI",
"collection_type": "POOL",
"transfer_amount": 8500000,
"bank_branch": "Virtual Account",
"account_holder_name": "APLIKASI KEUANGAN",
"identity_amount": 0
},
{
"bank_code": "BRI",
"collection_type": "POOL",
"transfer_amount": 8500000,
"bank_branch": "Virtual Account",
"account_holder_name": "APLIKASI KEUANGAN",
"identity_amount": 0
},
{
"bank_code": "BNI",
"collection_type": "POOL",
"transfer_amount": 8500000,
"bank_branch": "Virtual Account",
"account_holder_name": "APLIKASI KEUANGAN",
"identity_amount": 0
},
{
"bank_code": "PERMATA",
"collection_type": "POOL",
"transfer_amount": 8500000,
"bank_branch": "Virtual Account",
"account_holder_name": "APLIKASI KEUANGAN",
"identity_amount": 0
},
{
"bank_code": "BCA",
"collection_type": "POOL",
"transfer_amount": 8500000,
"bank_branch": "Virtual Account",
"account_holder_name": "APLIKASI KEUANGAN",
"identity_amount": 0
}
],
"available_retail_outlets": [
{
"retail_outlet_name": "ALFAMART"
},
{
"retail_outlet_name": "INDOMARET"
}
],
"available_ewallets": [
{
"ewallet_type": "OVO"
},
{
"ewallet_type": "DANA"
},
{
"ewallet_type": "SHOPEEPAY"
},
{
"ewallet_type": "LINKAJA"
}
],
"available_direct_debits": [
{
"direct_debit_type": "DD_BRI"
}
],
"available_paylaters": [],
"should_exclude_credit_card": false,
"should_send_email": false,
"success_redirect_url": "https://projeq.id/?status=success&external_id=INV0035/VIII/2022",
"failure_redirect_url": "https://projeq.id/?status=failure&external_id=INV0035/VIII/2022",
"created": "2022-08-07T18:56:04.761Z",
"updated": "2022-08-07T18:56:04.761Z",
"currency": "IDR",
"customer": {
"given_names": "John",
"surname": "Doe",
"email": "johndoe@example.com",
"mobile_number": "+6287774441111",
"addresses": [
{
"city": "Jakarta Selatan",
"country": "Indonesia",
"postal_code": "12345",
"state": "Daerah Khusus Ibukota Jakarta",
"street_line1": "Jalan Makan",
"street_line2": "Kecamatan Kebayoran Baru"
}
]
},
"project_name": "ft-4",
"connection_name": "xendit-sanbox-1",
"callback_url": "http://localhost:5001/appgregator/us-central1/xendit/invoices/callback/success"
}
Body JSON
{
"external_id": "INV0048/VIII/2022",
"amount": 8500000,
"description": "Invoice Demo #INV0048",
"invoice_duration": 86400,
"success_redirect_url" : "https://projeq.id/?status=success&external_id=INV0035/VIII/2022",
"failure_redirect_url" : "https://projeq.id/?status=failure&external_id=INV0035/VIII/2022",
"customer": {
"given_names": "John",
"surname": "Doe",
"email": "johndoe@example.com",
"mobile_number": "+6287774441111",
"addresses": [
{
"city": "Jakarta Selatan",
"country": "Indonesia",
"postal_code": "12345",
"state": "Daerah Khusus Ibukota Jakarta",
"street_line1": "Jalan Makan",
"street_line2": "Kecamatan Kebayoran Baru"
}
]
}
}
curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/xendit/invoices?name=ft-4&connection_name=xendit-sanbox-1' \
--header 'x-api-key: U2Fsd...' \
--header 'Content-Type: application/json' \
--data-raw '{
"external_id": "INV0055/VIII/2022",
"amount": 8500000,
"description": "Invoice Demo #INV0055",
"invoice_duration": 86400,
"success_redirect_url" : "https://projeq.id/?status=success&external_id=INV0035/VIII/2022",
"failure_redirect_url" : "https://projeq.id/?status=failure&external_id=INV0035/VIII/2022",
"customer": {
"given_names": "John",
"surname": "Doe",
"email": "johndoe@example.com",
"mobile_number": "+6287774441111",
"addresses": [
{
"city": "Jakarta Selatan",
"country": "Indonesia",
"postal_code": "12345",
"state": "Daerah Khusus Ibukota Jakarta",
"street_line1": "Jalan Makan",
"street_line2": "Kecamatan Kebayoran Baru"
}
]
}
}'
var axios = require('axios');
var data = JSON.stringify({
"external_id": "INV0055/VIII/2022",
"amount": 8500000,
"description": "Invoice Demo #INV0055",
"invoice_duration": 86400,
"success_redirect_url": "https://projeq.id/?status=success&external_id=INV0035/VIII/2022",
"failure_redirect_url": "https://projeq.id/?status=failure&external_id=INV0035/VIII/2022",
"customer": {
"given_names": "John",
"surname": "Doe",
"email": "johndoe@example.com",
"mobile_number": "+6287774441111",
"addresses": [
{
"city": "Jakarta Selatan",
"country": "Indonesia",
"postal_code": "12345",
"state": "Daerah Khusus Ibukota Jakarta",
"street_line1": "Jalan Makan",
"street_line2": "Kecamatan Kebayoran Baru"
}
]
}
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/xendit/invoices?name=ft-4&connection_name=xendit-sanbox-1',
headers: {
'x-api-key': 'U2Fsd...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/xendit/invoices?name=ft-4&connection_name=xendit-sanbox-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 =>'{
"external_id": "INV0048/VIII/2022",
"amount": 8500000,
"description": "Invoice Demo #INV0048",
"invoice_duration": 86400,
"success_redirect_url" : "https://projeq.id/?status=success&external_id=INV0035/VIII/2022",
"failure_redirect_url" : "https://projeq.id/?status=failure&external_id=INV0035/VIII/2022",
"customer": {
"given_names": "John",
"surname": "Doe",
"email": "johndoe@example.com",
"mobile_number": "+6287774441111",
"addresses": [
{
"city": "Jakarta Selatan",
"country": "Indonesia",
"postal_code": "12345",
"state": "Daerah Khusus Ibukota Jakarta",
"street_line1": "Jalan Makan",
"street_line2": "Kecamatan Kebayoran Baru"
}
]
}
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: U2Fsd...',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last updated