Jump to content

Question about GenInvoices due date


koriento

Recommended Posts

Hello,

 

I want to be able to generate renewal invoices for services anytime I want. So I am using GenInvoices API to send a generate invoice request every time I need to renew service. But I am facing two issues.

 

1. The GenInvoices will not generate any invoices unless it's within the number of days set in the Invoice Generation setting in the automation tab. Does it have to be that way?

2. The GenInvoices will generate an renew invoices to all services within the due period, although I am specifying a service ID that I want to generate the invoice for.

curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'GenInvoices',
            'serviceids' => '204',
            // See https://developers.whmcs.com/api/authentication
            'username' => '9pTW8lfy9RYGZWiby2fAJktSBjb96Tvn',
            'password' => 'cGN3dGyA1rpv38np9NBClJ2N60y7MNEJ',
            'responsetype' => 'json',
        )
    )
);

 

Any help is very well appreciated.
Thanks in advance.

Link to comment
Share on other sites

Thanks for posting! I'm happy to advise on your questions.

1. This is expected behavior and cannot be modified. This is the basis of how WHMCS generates invoices.

2. Based on your sample code, it does not appear you are sending an array to the API. Try modifying that to be an array (even though there is only 1):

	'action' => 'GenInvoices',
            'serviceids' => [204],
            // See https://developers.whmcs.com/api/authentication
            'username' => '9pTW8lfy9RYGZWiby2fAJktSBjb96Tvn',
            'password' => 'cGN3dGyA1rpv38np9NBClJ2N60y7MNEJ',
            'responsetype' => 'json',

 

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