Jump to content

[Api] Prevent Invoice Delivery


sharktek

Recommended Posts

Hello,

 

Using the API, I am creating a service then generating an invoice for that service using:

createFromServices( integer $client_id, array $service_ids, string $currency, string $due_date, boolean $allow_pro_rata = true, boolean $services_renew = false )

 

We generate this invoice because the initial service created is marked as "pending" and we don't want the service activated until successful payment.

Our issue, however, is that when we generate this invoice (createFromServices) there is no option to disable delivery of the invoice via email.

We are only able to do this by disabling delivery of unpaid invoices as a system-wide setting.

 

Do you have any suggestions as to how we can generate this invoice from service without delivering it via email?

Link to comment
Share on other sites

The invoice isn't delivered after it's created, rather it is queued for delivery and later delivered when the cron runs. While you can't stop the invoice from being queued for delivery, you can instead remove it from the queue. After the invoice is created, you can fetch each of the delivery methods that were created from Invoices::getDelivery, and then delete each one via Invoices::deleteDelivery.

Link to comment
Share on other sites

  • 2 weeks later...

Is there any way to disable sending invoices based on a service id all together, but not system wide.

 

Not from Invoices::createFromServices. Delivery options are based on invoices, so there isn't a method by which to remove an option by service ID besides what I already mentioned above. The other way to go about it is to create the invoice from Invoices::add, but you would need to manually create your own line items.

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.

Loading...
×
×
  • Create New...