Jump to content

What is correct Invoice hook to trigger on create where no email is being sent?


Go to solution Solved by WhmTools,

Recommended Posts

We have an in-app signup that is creating orders (with initial invoice w/o email) in WHMCS via API.

I had considered the InvoiceCreationPreEmail hook which indicates that it 'Executes as an invoice is being created in the admin area before the email is being sent'. When I posed the inquiry to WHMCS support, they indicated this would not work, because we are creating the invoice w/o sending the email.

They recommended InvoiceCreated hook, but in the documentation, which indicates '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.'

InvoiceCreation hook does not seem appropriate, unless we add coded to check whether status was published before taking action.

What would be best course of action?

Link to comment
Share on other sites

No. We need hook to trigger when an invoice is created whether or not email is sent. In our present logic, we disable the invoice email with the Order API request which includes invoice creation.

I had considered the InvoiceCreationPreEmail hook which indicates that it 'Executes as an invoice is being created in the admin area before the email is being sent'. When I posed the inquiry to WHMCS support, they indicated this would not work, because we are creating the invoice w/o sending the email.

WHMCS Support recommended InvoiceCreated hook, but in the documentation it indicates '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.' So it seems it would not work with that hook, because email is NOT being sent.

InvoiceCreation hook does not seem appropriate, unless we add code to check whether status was published before taking action.

What would be best course of action?

Link to comment
Share on other sites

  • Solution

check weather the below one will help

InvoiceCreation

Executes when an invoice is first created. The invoice has not been finalised and delivered to the client at this point. Changes can be made to line items at this point. The invoice totals will be recalculated post execution of this hook point.

Parameters

Variable Type Notes
source string Indicates where the invoice creation action originated, can be one of adminarea, api or autogen
user mixed User who initiated the invoice creation, either system or an admin ID value
invoiceid int The ID of the newly created invoice
status string The status of the newly created invoice

Response    

Link to comment
Share on other sites

Hello Mark,

InvoiceCreation is the hook that was originally prescribed. Given that anything requiring email (such as invoicecreated and invoicecreationpreemail) would not work, the invoicecreation hook is all that is left. We are continuing with that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated