Jump to content
koriento

Question about GenInvoices due date

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.

Share this post


Link to post
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',

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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