Create Invoice API
The following endpoint creates an Invoice
Request Attributes
amount
The amount for which the Invoice was created. Example: "10000"
or "10000.23"
for amount with decimal value
remaining_amount
The remaining amount for which the Invoice was created. Example: "10000"
or "5000.23"
for amount with decimal value
invoice_ref_id
The unique identifier of Invoice from the merchant. Example: "INV/1/2021"
title
The title of the invoice.
customer
The customer fields including id
, email
, mobile
, first_name
, given_name
, address
json object, customer_ref_id
. One of id
, mobile
, email
is mandatory
field whereas others are optional
.
Hide customer object
Field | Type | Description |
---|---|---|
customer_ref_idOptional | string | The customer ID from the merchant |
emailMandatory | string | The customer's email address. Should of the format |
mobileMandatory | string | The customer's mobile number. Please ensure that the number follows Indonesia's phone number format : |
first_nameOptional | string | The customer's first name |
given_nameMandatory | string | The customer's given name |
addressOptional | object | The address fields includes receiver_name, receiver_phone, label, address_line, city, region, postal_code, landmark Hide address object receiver_nameOptional string The receiver's name receiver_phoneOptional string The receiver's phone number labelOptional string The label for the address address_lineOptional string The address' line cityOptional string The receiver's city regionOptional string The address' region postal_codeOptional string The address' postal code landmarkOptional string The address' landmark |
enable_partial_transaction
Flag to indicate if partial transactions are allowed or not.
partial_transaction_config
Key-Value pair that can be used to store configuration about partial transactions like minimum acceptable amount for a partial transaction
start_date
The time stamp at which the invoice will become active. Please ensure that the value is in RFC3339 format (only date will be accepted). Example: "2023-03-29T00:00:00.000Z"
due_date
The time stamp at which the invoice's payment will be due. Please ensure that the value is in RFC3339 format (only date will be accepted). Example: "2023-03-29T00:00:00.000Z"
metadata
Any additional information can be stored. Note: limit 1000 chars
invoice_url
This is the url of invoice and will be used for the customer to download the invoice.
curl -X POST \
https://api.durianpay.id/v1/invoices \
-H 'authorization: [Base64({Your_Server_Key}:)]' \
-H 'content-type: application/json' \
-d '{
"amount": "20000.67",
"remaining_amount": "5000.67",
"title": "sample",
"invoice_ref_id": "inv_ref_001",
"customer": {
"customer_ref_id": "cust_001",
"given_name": "Jane Doe",
"email": "jane_doe@nomail.com",
"mobile": "85722173217",
"address": {
"receiver_name": "Jude Casper",
"receiver_phone": "8987654321",
"label": "Home Address",
"address_line_1": "Jl. HR. Rasuna Said",
"address_line_2": "Apartment #786",
"city": "Jakarta Selatan",
"region": "Jakarta",
"country": "Indonesia",
"postal_code": "560008",
"landmark": "Kota Jakarta Selatan"
}
},
"enable_partial_transaction": true,
"partial_transaction_config": {
"min_acceptable_amount": 10000
},
"start_date": "2022-11-22T10:00:00.000Z",
"due_date": "2022-11-22T10:00:00.000Z"
}'
Response Code
200 - Success
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{ "data": { "id": "inv_0dIWbuDJQ84078", "customer_id": "cus_ViPeX4iBYp2233", "invoice_ref_id": "inv_ref_001", "title": "sample", "amount": "15001.00", "remaining_amount": "10001.00" "currency": "IDR", "status": "outstanding", "is_live": true, "is_partial_transaction_enabled": true, "partial_transaction_config": { "min_acceptable_amount": 10000 } "start_date": "2022-03-28T00:00:00Z" "due_date": "2022-03-29T00:00:00Z", "is_blocked": false "checkout_url": "merchant.durianpay.id/random_chars", "checkout_url_expiry_at": "2023-01-22T10:00:00.000Z", "response_code": "0000" } }
400 - Invalid Request
401 - Unauthorized Access
500 - Internal Server Error