Developer Center

CreateInvoiceItem

Create a new item to the invoice according to the specified parameters.

Method / Endpoint

POST/ {{API_URL}} Billing/CreateInvoiceItem/ {{ID}}

Request Parameters

Parameter Name Type Requirement Description
{{ID}} Integer Yes Invoice ID Number
sequence Integer No Invoice Item Sequence Number
description String Yes Invoice Item Description
quantity Integer No Invoice Item Quantity. Default : 1
amount Double Yes Invoice Item Unit Price
total Double No Invoice Item Total Amount. Default: Unit Price
order_id Integer No The product/service ID number to which the invoice item is linked. This information can be obtained from the "id" field in the "users_products" table in the database.
due_date String No If the invoice item is linked to a product/service, it must have the same end date as the product/service. Format: YYYY-MM-DD HH:ii:ss
attributes Object No If the invoice item is linked to a product/service, it contains information about the purchase or renewal of the linked product/service.

External Sample

curl --location 'https://exampe.com/api/Billing/CreateInvoiceItem/123' \
--header 'Content-Type: application/json' \
--header 'Apikey: [YOUR_API_KEY]' \
--data '{
    "description": "test description 3",
    "quantity": 1,
    "tax_exempt": false,
    "amount": 250,
    "total": 250,
    "order_id": 0,
    "due_date": "2023-12-20 23:59:59",
    "attributes": {
        "sample3": "Example test 3"
    }
}'

Internal Sample

Helper::Load("Api");
try {
    $result = Api::Billing()->CreateInvoiceItem([
        'invoice_id'  => 123,
        'description' => 'test description 3',
        'quantity'    => 1,
        'tax_exempt'  => false,
        'amount'      => 250,
        'total'       => 250,
        'order_id'    => 0,
        'due_date'    => '2023-12-20 23:59:59',
        'attributes'  => [
            'sample3' => 'Example test 3',
        ],
    ]);
    print_r($result);
}
catch (Exception $e)
{
    echo 'Error: '.$e->getMessage();
}

Sample JSON Response

{
    "status": "successful",
    "data": {
        "id": 572,
        "owner_id": 123,
        "description": "test description 3",
        "quantity": 1,
        "tax_exempt": false,
        "amount": 250,
        "total": 250,
        "order_id": 0,
        "due_date": "2023-12-20 23:59:59",
        "attributes": {
            "sample3": "Example test 3"
        }
    }
}

Response Parameters

Parameter Name Type Description
status String Action Status "successful" or "error"
message String Error message if action status is "error"
data Object It contains the same values as the "items" parameters in the response parameters in the "GetInvoice" document.
DeleteInvoice UpdateInvoiceItem

Do you have any questions?

Feel free to contact us
Contact Us
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel
Top

New Year's Special Discount

"Startup Lifetime" and "Professional Lifetime" licenses are 30% off!

Coupon Code:
HAPPYYEARS30 Copied!
Discount Rate 30%
Expiration Date December 31, 2024