koriento Posted December 20, 2018 Share Posted December 20, 2018 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. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Marcus Posted December 24, 2018 Share Posted December 24, 2018 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', 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.