In the following parameters "/" slash character is used to determine the array data under an array data.
|source||string||Used to specify the source where the incident took place.
automation : Occurred by automation.
api : Occurred through API.
admin : Occurred by administrator.
client : Occurred by client.
|id||int||Invoice ID number|
|user_id||int||Client ID number|
|user_data||array||Client information saved while the invoice is created. (Not Current)|
|user_data / name||string||Client Name|
|user_data / surname||string||Client SurName|
|user_data / full_name||string||Client FullName|
|user_data / company_name||string||Client Company Name|
|user_data / company_tax_number||string||Client's Corporate Tax Number|
|user_data / company_tax_office||string||Client's Corporate Tax Office|
|user_data / email||string||Client E-Mail Address|
|user_data / gsm_cc||int||Client's GSM Country Code Ex: 01|
|user_data / gsm||int||Client's GSM Number without Country Code|
|user_data / landline_cc||int||Client's Fixed Line Country Code Ex: 01|
|user_data / landline_phone||int||Client's Fixed Line Number without Country Code|
|user_data / identity||int||Client's Citizenship Identity Country Code|
|user_data / kind||string||Client's Account Type; individual, corporate|
|user_data / taxation||int | null||Client's Tax Exemption Status;
If the value '1' comes, it means it is exempt from tax.
|user_data / currency||int||Currency Defined in Client's Account|
|user_data / address||array||Client address information saved while the invoice is created (Not Current)|
|user_data / address / country_name||string||Client Address > Country Name|
|user_data / address / country_code||string||Client Address > Country Code (Alpha-2)|
|user_data / address / city||string||Client Address > City Name|
|user_data / address / counti||string||Client Address >Counti Name|
|user_data / address / address||string||Client Address|
|user_data / address / zipcode||string||Client Address Postal Code|
|cdate||string||Invoice Generation Date (Format: Y-M-D H:i:s)|
|duedate||string||Invoice Due Date (Format Y-M-D H:i:s)|
|datepaid||string||Invoice Payment Date (Format: Y-M-D H:i:s)|
|refunddate||string||Invoice Refund Date (Format: Y-H:i:s)|
|status||string||Determines invoice status;
paid : Paid
unpaid : Not Paid
waiting: Awaiting Confirmation
cancelled : Canceled
refund : Refunded
|currency||int||ID number that defines currency of to invoice.
|data/exchange_rate||float||Invoice Exchange Rate|
|local||int||It is 1 if invoice belongs to the local address, 0 if not.|
|legal||int||Specifies tax exemption status of invoice;
1: tax included, 0: tax-free
|taxed||int||Specifies the formalization status of invoice;
1: formalized, 0: not formalized
|taxed_file||string||Used to define a pdf file for an official invoice.
File should be in "resources/uploads/invoices/" directory
|taxation_type||string||Specifies the tax type of invoice;
inclusive: Tax Included
exclusive: Tax Excluded
|taxrate||float||Determines the tax rate of invoice|
|subtotal||float||Specifies the subtotal of the invoice|
|tax||float||Specifies the total tax amount of invoice|
|total||float||Specifies all-inclusive total amount of invoice|
|discounts||array||The information regarding coupons and promotions used in invoice is included|
|discounts/items/coupon/*/id||int||Specifies the ID number of the coupon
|discounts/items/coupon/*/name||string||Specifies the coupon name|
|discounts/items/coupon/*/rate||int||Determines what percentage value of the coupon has|
|discounts/items/coupon/*/dvalue||string||If discounted by rate: % as value, if discounted by amount: value currency code are defined|
|discounts/items/coupon/*/amount||string||Discount amount applied by coupon is specified as formatted|
|discounts/items/coupon/*/amountd||float||Discount amount applied by coupon is specified|
|discounts/items/promotion/*/id||int||Specifies ID number of promotion
|discounts/items/promotion/*/name||string||Sets the promotion name|
|discounts/items/promotion/*/rate||int||Specifies %value rate of promotion|
|discounts/items/promotion/*/dvalue||string||If discounted by rate: % as value, if discounted by amount, formatted amount value and currency code are defined|
|discounts/items/promotion/*/amount||string||The discount amount applied to the promotion is determined in format|
|discounts/items/promotion/*/amountd||float||Discount amount applied by promotion is specified|
|used_coupons||string||The ID number of the coupons used is determined by separating them with comma.|
|used_promotions||string||The ID number of the promotions used is determined by separating them with comma.|
|sendbta||int||Specifies the address delivery status of formalized invoice
1: active, 0: passive
|sendbta_amount||float||Specifies the address delivery amount of formalized invoice|
|pmethod||string||Specifies the payment method module|
|pmethod_commission||float||Specifies the commission amount belonging of payment method|
|pmethod_commission_rate||float||Determines the commission rate of the payment method|
|pmethod_status||string||Specifies the status of the payment;
SUCCESS: Payment Successful
ERROR: Payment Failed
PAPPROVAL: Pending Approval
|pmethod_msg||string||Determines the message returned from the payment method|
|notes||string||Determines notes about the invoice. (Only the manager /staff can see)|
$id = $params["id"];
$status = $params["status"];
$currency = $params["currency"];
$items = Invoices::get_items();
# Example: update invoice data Invoices::set($id,['duedate' => '2020-03-05 00:00:00']);
# Example: update invoice item data Invoices::set_item($item["id"],['description' => 'Example']);
# Example: insert invoice item dat:
$item_id = Invoices::add_item([
'owner_id' => $id,
'description' => 'Example',
'amount' => 1.0,
'currency' => $currency,
/** Write the code here... */
Called when the status of an invoice is changed as paid.
Called if the status of an invoice is changed to unpaid.
Called when the status of an invoice is changed to formalized.
Called when the status of an invoice is changed to canceled.
Called when the status of an invoice is changed to refunded.
Called after an invoice is created.
Called after administrator modifies the invoice.
Called before an invoice is deleted from the system.
Called when an invoice is deleted from the system.
Called when a payment reminder is made for an invoice.
Called when administrator or client enters invoice detail.