Dark Mode

Create Invoice API


The following endpoint creates an Invoice

/invoices

Request Attributes

amount

String
Mandatory

The amount for which the Invoice was created. Example: "10000" or "10000.23" for amount with decimal value

remaining_amount

String
Mandatory

The remaining amount for which the Invoice was created. Example: "10000" or "5000.23" for amount with decimal value

invoice_ref_id

String
Mandatory

The unique identifier of Invoice from the merchant. Example: "INV/1/2021"

title

String
Mandatory

The title of the invoice.

customer

Object
Mandatory
json object

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

FieldTypeDescription

customer_ref_idOptional

string

The customer ID from the merchant

emailMandatory

string

The customer's email address. Should of the format jane.doe@gmail.com and should not contain any invalid special characters (¢,£,§,©,etc)

mobileMandatory

string

The customer's mobile number. Please ensure that the number follows Indonesia's phone number format : +62xxxxxxxxxx or 08xxxxxxxxxx.

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_name

Optional
string

The receiver's name

receiver_phone

Optional
string

The receiver's phone number

label

Optional
string

The label for the address

address_line

Optional
string

The address' line

city

Optional
string

The receiver's city

region

Optional
string

The address' region

postal_code

Optional
string

The address' postal code

landmark

Optional
string

The address' landmark

enable_partial_transaction

Boolean (default:false)
Optional

Flag to indicate if partial transactions are allowed or not.

partial_transaction_config

Object
Optional

Key-Value pair that can be used to store configuration about partial transactions like minimum acceptable amount for a partial transaction

start_date

Timestamp (default:current timestamp)
Optional

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

Timestamp
Mandatory

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

Object
Optional

Any additional information can be stored. Note: limit 1000 chars

invoice_url

String
Optional

This is the url of invoice and will be used for the customer to download the invoice.

Example
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": "Jude'\''s 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-28"
      "due_date": "2022-03-29",
      "created_at": "2022-03-28T14:39:37.860426Z",
      "checkout_url": "merchant.durianpay.id/random_chars",
      "checkout_url_expiry_at": "2023-01-22T10:00:00.000Z",
      "reponse_code": "0000"
    }
}

400 - Invalid Request

401 - Unauthorized Access

500 - Internal Server Error