Invoices and Quotes

The following hooks are provided for Invoices and Quotes related events.

AcceptQuote

Executes when a client is accepting a quote.

Parameters

VariableTypeNotes
quote_idintThe id of the quote being accepted.
invoice_idintThe id of the invoice created for the quote (if applicable).

Response

No response supported

Example Code

<?php add_hook('AcceptQuote', 1, function($vars) {
			// Perform hook code here...
}); 

AddInvoiceLateFee

Executes when a late fee has been added to an invoice 

Parameters

VariableTypeNotes
invoice_idint

Response

No response supported

Example Code

add_hook('AddInvoiceLateFee', 1, function($vars) {
// Perform hook code here...
}); 

AddInvoicePayment

Invoked when a payment is applied to an invoice (including partial payments).

Parameters

VariableTypeNotes
invoice_idintThe invoice id payment was applied to
trans_idintThe Transaction ID of payment was applied to

Response

No response supported

Example Code

add_hook('AddInvoicePayment', 1, function($vars) {
// Perform hook code here...
}); 

AddTransaction

Executes when a transaction is created. Can be a payment or a refund.

Parameters

VariableTypeNotes
trans_idintTransaction ID
user_idintUser ID
currencyintCurrency ID (if not related to a client, otherwise client currency)
gatewayintPayment Method ID
datedatetime
descriptionstring
amountinfloat
feesfloat
amountoutfloat
ratefloatExchange rate
gateway_trans_idstringTransaction ID provided by gateway or admin user
invoice_idintInvoice ID to which the transaction was applied
refundidintRefund ID if a refund

Response

No response supported

Example Code

add_hook('AddTransaction', 1, function($vars) {
// Perform hook code here...
});

CancelAndRefundOrder

Runs when an order is requested to be cancelled and refunded, prior to the change of status actually occurring.

Parameters

VariableTypeNotes
order_idintThe order ID
user_idintClient ID which related to Order
itemsObjectOrders Items

Response

No response supported

Example Code

add_hook('CancelAndRefundOrder', 1, function($vars) {
// Perform hook code here...
});

InvoiceCancelled

Executes when an invoice is being cancelled

Parameters

VariableTypeNotes
invoice_idint

Response

No response supported

Example Code

add_hook('InvoiceCancelled', 1, function($vars) {
// Perform hook code here...
}); 

InvoiceChangeGateway

Executes when changing the gateway on an invoice.

Parameters

VariableTypeNotes
invoice_idintThe id of the invoice being updated.
old_gateway_idintThe old payment method id.
new_gateway_idintThe New payment method id which is selected.

Response

No response supported

Example Code

add_hook('InvoiceChangeGateway', 1, function($vars) {
// Perform hook code here...
});	

InvoiceCreated

Executed when an invoice has left “Draft” status and is available to its respective client. Execution of this hook occurs after sending the Invoice Created email.

Parameters

VariableTypeNotes
sourcestringIndicates where the invoice creation action originated, can be one of adminarea, api or autogen
user_idintThe user who initiated the invoice creation.
invoice_idintThe invoice ID.
statusstringThe status of the released invoice.

Response

No response supported

Example Code

add_hook('InvoiceCreated', 1, function($vars) {
// Perform hook code here...
});

InvoicePaid

Executes when an invoice is Paid following the email receipt having been sent and any automation tasks associated with the payment action having been run.

Parameters

VariableTypeNotes
invoice_idint

Response

No response supported

Example Code

add_hook('InvoicePaid', 1, function($vars) {
// Perform hook code here...
}); 

InvoicePaidPreEmail

Executes when an invoice is Paid prior to any email or automation tasks associated with the payment action having been run.

Parameters

VariableTypeNotes
invoice_idint

Response

No response supported

Example Code

add_hook('InvoicePaidPreEmail', 1, function($vars) {
// Perform hook code here...
}); 

InvoicePaymentReminder

Executes when an automated invoice payment reminder is sent.

Parameters

VariableTypeNotes
invoice_idint
reminder_noint

Reminders No as

0=Payment Reminder

1= First Overdue Reminder

2=Second Overdue Reminder

3=Third Overdue Reminder

Response

No response supported

Example Code

<?php
add_hook('InvoicePaymentReminder',1,function($vars){
// Perform hook code here...
});
add_hook('InvoicePaymentFirstoverdueReminder',1,function($vars){
// Perform hook code here...
});
add_hook('InvoicePaymentSecondoverdueReminder',1,function($vars){
// Perform hook code here...
});
add_hook('InvoicePaymentThirdoverdueReminder',1,function($vars){
// Perform hook code here...
});

InvoiceRefunded

Executes when an invoice status is changed to Refunded.

Parameters

VariableTypeNotes
invoice_idintInvoice ID

Response

No response supported

Example Code

add_hook('InvoiceRefunded', 1, function($vars) {
// Perform hook code here...
});

InvoiceSplit

Executes as an invoice is being split

Parameters

VariableTypeNotes
old_invoice_idintThe id of the original invoice
invoice_idintThe id of the new invoice

Response

No response supported

Example Code

add_hook('InvoiceSplit', 1, function($vars) {
// Perform hook code here...
});

InvoiceUnpaid

Executes when an invoice is being marked as Unpaid

Parameters

VariableTypeNotes
invoice_idint

Response

No response supported

Example Code

add_hook('InvoiceUnpaid', 1, function($vars) {
// Perform hook code here...
});

LogTransaction

Runs any time a payment gateway callback is received and logged.

Parameters

VariableTypeNotes
gatewaystringThe payment gateway name
responsestringA string formatted version of all post data received
invoice_idintThe Invoice ID 

Response

No response supported

Example Code

add_hook('LogTransaction', 1, function($vars) {
// Perform hook code here...
});

ManualRefund

Executes when an invoice is refunded via the Manual Refund option.

Parameters

VariableTypeNotes
invoice_idintInvoice ID of the Invoice which is going to refund
trans_idintTransaction ID of the original payment
amountfloatThe amount to be refunded
typestringRefund Type

Response

No response supported

Example Code

add_hook('ManualRefund', 1, function($vars) {
// Perform hook code here...
});

QuoteCreated

Executes when a new quote is created.

Parameters

VariableTypeNotes
quote_idint
quote_statusstring
responceArray

Response

No response supported

Example Code

add_hook('QuoteCreated', 1, function($vars) {
// Perform hook code here...
});

QuoteStatusChange

Executes when a quote status is updated

Parameters

VariableTypeNotes
quote_id
int
quote_status
string
responceArray

Response

No response supported

Example Code

add_hook('QuoteStatusChange', 1, function($vars) {
// Perform hook code here...
});

UpdateInvoiceTotal

Executes when an invoice is updated with changes to or additions of line items. Can be used to manipulate the invoice.

Parameters

VariableTypeNotes
invoice_idintInvoice ID

Response

No response supported

Example Code

add_hook('UpdateInvoiceTotal', 1, function($vars) {
// Perform hook code here...
});

ViewInvoiceDetailsPage

Executes as the invoice is being viewed as a client

Parameters

VariableTypeNotes
invoice_idint

Response

No response supported

Example Code

add_hook('ViewInvoiceDetailsPage', 1, function($vars) {
// Perform hook code here...
});