Developer Center

UpdateInvoice

Update an invoice with the parameters you specified.

Method / Endpoint

PUT/ {{API_URL}} Billing/UpdateInvoice/ {{ID}}

Request Parameters

Parameter Name Type Requirement Description
{{ID}} Integer Yes Invoice ID Number
notification Boolean No Notification Sending Status
user Object No Customer Information of the Invoice
user.id Integer No Customer ID Number
user.lang String No Customer's language according to ISO 639-1 format. for example: "en", "de", "fr" etc.
user.type String No The customer's account type. "individual", "corporate"
user.name String No Customer's Name
user.surname String No Customer's Last Name
user.full_name String No Customer's Full Name
user.email String No Customer's Email Address
user.phone Integer No The customer's phone number. (Country area code included) For example: if the number is: +1 (123) 456-7890 it should be like this: 11234567890
user.company_name String No Customer's Company Name
user.company_tax_number String No Customer's Company Tax Number
user.company_tax_office String No Customer's Company Tax Office
user.custom_fields Object No Custom fields belonging to the customer on the invoice
user.custom_fields.field_id Integer No Custom field ID Number
user.custom_fields.name String No Custom Field Name
user.custom_fields.value String No Custom Field Content
user.address.country_code String No Customer's Country Code. (ISO 3166-1 Alpha-2) Ex: US, FR, DE
user.address.country_name String No Customer's Country Name. Ex: United States, Germany, France
user.city String No Customer's City
user.state String No Customer's State
user.detail String No Customer's Address Details
user.zipcode String No Customer's Zip Code
notes String No Invoice Note (For staff to see)
status String No Invoice Status. Values it can take: "unpaid", "pending", "paid", "refunded", "cancelled". Default: "unpaid"
formalize Boolean No Invoice Formalization Status.
formalize_file String No The formalization file must contain a URL.
You can also specify a directory path if using the internal API.

(The transmitted file will be automatically copied to the system).
created_at String No Invoice Creation Date. Format: YYYY-MM-DD HH:ii:ss
Default: The date of the request is considered valid.
due_date String No Invoice Payment Due Date. Format: YYYY-MM-DD HH:ii:ss
payment_date String No Invoice Paid Date. Format: YYYY-MM-DD HH:ii:ss
Required if the invoice status is "paid" or "pending".
refund_date String No Invoice Refund Date. Format: YYYY-MM-DD HH:ii:ss
Required if the invoice status is "refunded".
currency String No The currency of the invoice. Format: ISO 4217. For example: USD, EUR, GBP
payment_method String No Payment Method Name
payment_method_data Object No Payment Method Data
payment_method_commission Double No Payment Method Commission Amount
payment_method_commission_rate Double No Payment Method Commission Rate
send_bill_to_address Double No Cost of Sending Invoices to the Address
exchange Double No Current Exchange Rate
discounts Object No Discounts
discounts.type String Yes Discount Type. "promotion", "coupon", "dealership"
discounts.sequence Integer Yes It must be the same as the "sequence" information you set in the invoice item.
discounts.rate Double No Discount Percentage. Default: 0
discounts.amount Double Yes Applied Discount Amount
discounts.description String Yes Discount Name: Coupon code, Promotion name, etc.
discounts.dkey String No If the discount type is "dealership", information on which product or product group the dealership discount is obtained from.

External Sample

curl --location --request PUT 'https://example.com/api/Billing/UpdateInvoice/123' \
--header 'Content-Type: application/json' \
--header 'Apikey: [YOUR_API_KEY]' \
--data '{
    "status": "paid",
    "payment_date": "2024-01-14 21:16:10",
    "formalize": true,
    "formalize_file": "https://example.com/1703590375.pdf",
    "payment_method": "BankTransfer",
    "payment_method_data": {
        "bank_name": "TEST BANK",
        "sender_name": "John Doe",
        "rce": "REF1234"
    }
}'

Internal Sample

Helper::Load("Api");
try {
    $result = Api::Billing()->UpdateInvoice([
        'id'                  => 123,
        'status'              => 'paid',
        'payment_date'        => '2024-01-14 21:16:10',
        'formalize'           => true,
        'formalize_file'      => 'https://example.com/1703590375.pdf',
        'payment_method'      => 'BankTransfer',
        'payment_method_data' => [
            'bank_name'   => 'TEST BANK',
            'sender_name' => 'John Doe',
            'rce'         => 'REF1234',
        ],
    ]);
    print_r($result);
}
catch (Exception $e)
{
    echo 'Error: '.$e->getMessage();
}

Sample JSON Response

{
    "status": "successful",
    "data": {
        "id": 468,
        "number": "#468",
        "user": {
            "id": 22,
            "lang": "en",
            "type": "corporate",
            "identity": "11111111111",
            "company_name": "ABC LLC",
            "company_tax_number": "12345",
            "company_tax_office": "XTEST",
            "name": "Mark",
            "surname": "Roberson",
            "full_name": "Mark Roberson",
            "email": "[email protected]",
            "phone": "19142426349",
            "address": {
                "country_code": "US",
                "country_name": "United States",
                "city": "New York",
                "state": "Mount Kisco",
                "detail": "1159 Lake Forest Drive",
                "zipcode": "10549"
            }
        },
        "taxation_type": "exclusive",
        "notes": "I created this invoice with API",
        "created_at": "2023-12-13 16:25:00",
        "due_date": "2023-12-20 23:59:59",
        "payment_date": "2024-01-14 21:16:10",
        "refund_date": "0000-00-00 00:00:00",
        "status": "paid",
        "formalize": true,
        "formalize_file": "https://example.com/resources/uploads/invoices/875f43260f3f480c23ade59a4bb3f593.pdf",
        "local": false,
        "taxfree": false,
        "exchange_rate": 1,
        "currency": "USD",
        "tax_rate": 0,
        "subtotal": 493.23000000000001818989403545856475830078125,
        "tax": 0,
        "total": 463.58400000000000318323145620524883270263671875,
        "payment_method": "Banka Transfer",
        "payment_method_data": {
            "bank_name": "TEST BANK",
            "sender_name": "John Doe",
            "rce": "REF1234"
        },
        "payment_method_commission": 0,
        "payment_method_commission_rate": 0,
        "send_bill_to_address": 0,
        "share": {
            "token": "bGI1UlRBVXpPL3lmZThpTmM1Zy9pdXhoZldFa3E1cUdNQmRSVWJCV0ROMD0=",
            "link": "https://example.com/en/invoice?token=bGI1UlRBVXpPL3lmZThpTmM1Zy9pdXhoZldFa3E1cUdNQmRSVWJCV0ROMD0="
        },
        "discounts": [
            {
                "type": "coupon",
                "item_id": 571,
                "rate": 20,
                "description": "AE1Q2CDF3",
                "amount": 28.6460000000000007958078640513122081756591796875
            },
            {
                "type": "promotion",
                "item_id": 570,
                "rate": 5,
                "description": "Test Promotion 1",
                "amount": 1
            }
        ],
        "items": [
            {
                "id": 570,
                "rank": 1,
                "owner_id": 468,
                "description": "test description 1",
                "quantity": 1,
                "tax_exempt": false,
                "amount": 100,
                "total": 100,
                "order_id": 0,
                "due_date": "2023-12-20 23:59:59",
                "attributes": {
                    "sample1": "Example test 1",
                    "amount_including_discount": 100
                }
            },
            {
                "id": 571,
                "rank": 2,
                "owner_id": 468,
                "description": "Sample Web Hosting (#123) (example.com) (2023-11-20 - 2023-12-20)",
                "quantity": 1,
                "tax_exempt": false,
                "amount": 143.229999999999989768184605054557323455810546875,
                "total": 143.229999999999989768184605054557323455810546875,
                "order_id": 123,
                "due_date": "2023-12-20 23:59:59",
                "attributes": {
                    "event": "ExtendOrderPeriod",
                    "amount_including_discount": 143.229999999999989768184605054557323455810546875
                }
            },
            {
                "id": 572,
                "rank": 3,
                "owner_id": 468,
                "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 Transmits the same data as "getInvoice".
CreateInvoice DeleteInvoice

Do you have any questions?

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