Sam666 Posted December 20, 2022 Share Posted December 20, 2022 Hello, I am able to add order via API AddOrder action, but the billingcycle always not passed to the API, no matter set to quarterly/semiannually/annually, it's always set to the default monthly(the other fields like priceoverride/hostname/clientid are able to pass to API). Below is the POST URL, is there anything wrong on my request? Appreciate if anyone can help. https://www.example.com/clientarea/includes/api.php?action=AddOrder&clientid=1&paymentmethod=stripe&pid=41&billingcycle=annually&priceoverride=123&noinvoice=false&hostname=www.example.com&identifier=vmWf7bHEQY9y5Gwmrq9UWVnVojr8u1j9&secret=Ox123xEnP212T53k&responsetype=json" 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted December 20, 2022 Share Posted December 20, 2022 Make sure the product in question supports the billing cycles you want to pass. As a reference for the product below you are allowed to set annually, biennially and triennially. 0 Quote Link to comment Share on other sites More sharing options...
Sam666 Posted December 20, 2022 Author Share Posted December 20, 2022 Thanks @Kian, yes it's due to the product just allowed Monthly, the billing cycle params can be accepted now. BTW, I have another issue is the `noinvoice` param also not accepted by API. No matter set to "true" or "false", both no invoice being generated. Is there anything I have missed? https://www.example.com/clientarea/includes/api.php?action=AddOrder&clientid=1&paymentmethod=stripe&pid=41&billingcycle=annually&priceoverride=123&noinvoice=false&hostname=www.example.com&identifier=vmWf7bHEQY9y5Gwmrq9UWVnVojr8u1j9&secret=Ox123xEnP212T53k&responsetype=json" 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted December 20, 2022 Share Posted December 20, 2022 Uhm... wait a second. Why are you posting that URL? I am not up to date on recent changes of WHMCS but if we are talking about sending API commands, you should be using POST not GET. In other words I would expect you to send a POST request to http://example.com/includes/api.php and not the query string you provided. Also, if you are using the API on the same system, you don't even need to send any request. You can directly use localAPI function. 0 Quote Link to comment Share on other sites More sharing options...
Sam666 Posted December 21, 2022 Author Share Posted December 21, 2022 7 hours ago, Kian said: Uhm... wait a second. Why are you posting that URL? I am not up to date on recent changes of WHMCS but if we are talking about sending API commands, you should be using POST not GET. In other words I would expect you to send a POST request to http://example.com/includes/api.php and not the query string you provided. Also, if you are using the API on the same system, you don't even need to send any request. You can directly use localAPI function. I am using the POST action, attached screenshot is my API test on postman, no matter set the `noinvoice` param to `true` or `false`, both didn't generate invoice. It seems this param has been ignored, or I have passed a wrong param/value? AddOrder API doc: https://developers.whmcs.com/api-reference/addorder/ 0 Quote Link to comment Share on other sites More sharing options...
AladdinJ Posted December 21, 2022 Share Posted December 21, 2022 Hello @Sam666 you just need to not send even the key just uncheck this this will fix the problem 0 Quote Link to comment Share on other sites More sharing options...
Sam666 Posted December 21, 2022 Author Share Posted December 21, 2022 1 hour ago, AladdinJ said: Hello @Sam666 you just need to not send even the key just uncheck this this will fix the problem Thank you @AladdinJ, yes just remove the `noinvoice` param if need to generate the invoice, but not set the `noinvoice` to `false`. 🙂 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.