Dark Mode

Update Invoice API


The following endpoint updates an Invoice:

/invoices/:id

Path Attributes

id

String
Mandatory

Unique identifier of the Invoice to be updated

Request Attributes

Following are the parameters to be sent in the request body:

invoice_ref_id

String
Optional

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

remaining_amount

String
Mandatory

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

title

String
Optional

Title of the invoice

start_date

String
Optional

Timestamp 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

String
Optional

Timestamp 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"

invoice_url

String
Optional

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

enable_partial_transaction

Boolean
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

is_blocked

Boolean
Optional

Flag to block transactions for an Invoice. Setting this parameter to true will cancel any ongoing transaction and will not allow any further transactions unless unblocked. To unblock the invoice set the value as false

remaining_amount

String
Optional

Remaining amount of Invoice

metadata

Object
Optional

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

Example
curl -X PUT \
  https://api.durianpay.id/v1/invoices/inv_JaQGjzJDdz0460 \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "invoice_ref_id": "inv_ref_001",
    "remaining_amount": "5000.67",
    "title": "sample invoice",
    "enable_partial_transaction": true,
    "partial_transaction_config": {
        "min_acceptable_amount": 10000
    },
    "start_date": "2023-03-28T00:00:00.000Z",
    "due_date": "2023-03-29T00:00:00.000Z",
    "metadata": {
        "invoice_type": "internal"
    }
    }'

Response Code

200 - Success

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
    "id": "inv_JaQGjzJDdz0460",
    "invoice_ref_id": "inv_ref_001",
    "remaining_amount": "5000.67",
    "title": "sample invoice",
    "amount": 100000
    "remaining_amount": 100000
    "enable_partial_transaction": true,
    "partial_transaction_config": {
        "min_acceptable_amount": 10000
    },
    "start_date": "2022-03-28",
    "due_date": "2022-03-29",
    "is_blocked": false,
    "response_code": "0000"
}

400 - Invalid Request

401 - Unauthorized Access

404 - Not Found

422 - Unprocessable Entity

500 - Internal Server Error