Jump to content

aquiss

Senior Member
  • Content count

    111
  • Joined

  • Last visited

Community Reputation

1 Neutral

About aquiss

  • Rank
    Level 2 Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. aquiss

    AddOrder API - promocode ignored

    It turned out to be my error. I was thinking it was the internal ID, when actually you just need to pass the promocode that has been set in admin. eg: If promocode in admin was 3MONTHSFREE, then in the AddOrder API, the code would be 'promocode' => "3MONTHSFREE",
  2. Can anyone else confirm that 'promocode' is being ignored in the AddOrder API? Regardless if a pass a variable or hard set to an exact known promotion, it's being ignored upon the order being built. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'url'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'AddOrder', 'username' => '', 'password' => '', 'clientid' => "$clientid", 'pid' => "$package_billing_id", 'domain' => "$username", 'billingcycle' => 'monthly', 'promocode' => "$package_offer_billing_promocode", 'paymentmethod' => "$set_payment", 'noinvoice' => 'true', 'noinvoiceemail' => 'true', 'noemail' => 'true', 'noinvoice' => 'true', 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch);
  3. aquiss

    Creating variables from JSON result

    So I have resolved this myself. I was almost there, but for anyone reading and needing some basic code to get them going (because WHMCS own docs seem to lack the final bit), the following will perform the action and then you can get the variables out. You will see in the finished code the likes of clientid and pid have " " (double quotes) around them, rather than ' (single quotes). This is so you can pass a variable into your array from elsewhere. 'clientid' => "$clientid", 'pid' => "$pid", Full basic code example <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'your url to api'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'AddOrder', 'username' => 'your api username', 'password' => 'your api password', 'clientid' => "1", 'pid' => "97", 'billingcycle' => 'monthly', 'paymentmethod' => 'stripe', 'noinvoice' => 'true', 'noinvoiceemail' => 'true', 'noemail' => 'true', 'noinvoice' => 'true', 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); // Decode response $jsonData = json_decode($response, true); ?> <?php $serviceids = $jsonData['serviceids']; ?>
  4. I'm trying to get the JSON array result for serviceids and turn it into a useable variable, but my limited coding ability I seem to be missing something. How do I do this? <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'snipped'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'AddOrder', 'username' => 'snipped', 'password' => 'snipped', 'clientid' => "1", 'pid' => "97", 'billingcycle' => 'monthly', 'paymentmethod' => 'stripe', 'noinvoice' => 'true', 'noinvoiceemail' => 'true', 'noemail' => 'true', 'noinvoice' => 'true', 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); // Decode response $jsonData = json_decode($response, true); $serviceid = $jsonData[0]["serviceids"]; ?>
  5. aquiss

    CreateQuote API Failure

    WHMCS Support have confirmed the docs are incorrect and are getting them updated. In the meantime, this is correct: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://yourwhmcs.com/whmcs/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'CreateQuote', // See https://developers.whmcs.com/api/authentication 'username' => 'USERNAME', 'password' => 'PASSWORD', 'subject' => 'Test Quote Subject', 'stage' => 'Draft', 'userid' => '1', 'validuntil' => '01/01/2016', 'lineitems' => base64_encode(serialize(array(array("desc"=>"Test Description 1","qty"=>1,"up"=>"10.00","discount"=>"10.00", "taxable"=>true),array("desc"=>"Test Description 2","qty"=>4,"up"=>"15.00","discount"=>"0.00","taxable"=>false)))), 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch);
  6. aquiss

    CreateQuote API Failure

    Thanks Kian, I'll raise a ticket with support as the docs need correcting.
  7. I'm trying to use the CreateQuote (Curl Method) as shown https://developers.whmcs.com/api-reference/createquote/  I'm using the following test code <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'url snipped'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'CreateQuote', 'username' => '', 'password' => '', 'subject' => 'Test Quote Subject', 'stage' => 'Draft', 'validuntil' => '30/01/2020', 'lineitems' => base64_encode(serialize(array(array("desc"=>"Test Description 1","qty"=>1,"up"=>"10.00","discount"=>"10.00", "taxable"=>true),array("desc"=>"Test Description 2","qty"=>4,"up"=>"15.00","discount"=>"0.00", "taxable"=>false))));, 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); ?> However, I just can't get it working at all. Just seems to return an error. Docs don't mention any other Required elements, however, I'm getting an error saying it must be an array. However, the example code is being used exactly as given from the docs page. Error appearing in logs is: Error: TypeError: Argument 20 passed to saveQuote() must be of the type array, null given, called in /var/www/vhosts/snippedurl/httpdocs/includes/api/createquote.php on line 0 and defined in /var/www/vhosts/snippedurl/httpdocs/includes/quotefunctions.php:0 Stack trace: #0 /var/www/vhosts/snippedurl/httpdocs/includes/api/createquote.php(0): saveQuote('', 'Test Quote Subj...', 'Draft', '2019-12-31', '30/01/2020', 'new', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, '') #1 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Api/V1/Api.php(0): unknown() #2 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Api/V1/Api.php(0): WHMCS\Api\V1\Api->executeApiCall() #3 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Api/ApplicationSupport/Route/Middleware/HandleProcessor.php(0): WHMCS\Api\V1\Api->call() #4 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Api/ApplicationSupport/Route/Middleware/HandleProcessor.php(0): WHMCS\Api\ApplicationSupport\Route\Middleware\HandleProcessor->processV1Request(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest)) #5 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/DelegatingMiddlewareTrait.php(0): WHMCS\Api\ApplicationSupport\Route\Middleware\HandleProcessor->_process(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest), Object(Middlewares\Utils\Delegate)) #6 /var/www/vhosts/snippedurl/httpdocs/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Api\ApplicationSupport\Route\Middleware\HandleProcessor->process(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest), Object(Middlewares\Utils\Delegate)) #7 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest)) #8 /var/www/vhosts/snippedurl/httpdocs/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest)) #9 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Api/ApplicationSupport/Route/Middleware/ActionResponseFormat.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest)) #10 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Api\ApplicationSupport\Route\Middleware\ActionResponseFormat->_process(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest), Object(Middlewares\Utils\Delegate)) #11 /var/www/vhosts/snippedurl/httpdocs/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Api\ApplicationSupport\Route\Middleware\ActionResponseFormat->process(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest), Object(Middlewares\Utils\Delegate)) #12 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest)) #13 /var/www/vhosts/snippedurl/httpdocs/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest)) #14 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/DelegatingMiddlewareTrait.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest)) #15 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Security/Middleware/Authorization.php(0): WHMCS\Security\Middleware\Authorization->delegateProcess(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest), Object(Middlewares\Utils\Delegate)) #16 /var/www/vhosts/snippedurl/httpdocs/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/AbstractProxyMiddleware.php(0): WHMCS\Security\Middleware\Authorization->process(Object(WHMCS\Api\ApplicationSupport\Http\ServerRequest), Object(Middlewares\Utils\Delegate)) snip ........ Any ideas, because all I can find online is someone having similar but admin side, but claimed to be fixed in 7.7.1?
  8. @Kian Does your system support signups via a 3rd party signup form? We don't use WHMCS own signup pages because they can't adapt to our business, but instead we use our own signup pages and then put everything into WHMCS via APIs. However, the one thing we would like to be able to do, is allow customers to signup to be affiliates via the client area, which gives them their unique ID, but then being able to grab this ID via our 3rd party forms, allowing us to allocate who referred who (manually if need be).
  9. Yes I understand this, but I never mentioned Stripe myself, this is something you added to the conversation. However, you have cleared up what I thought was going to happen.
  10. Hi John, The impression I've got, is that all payment methods, regardless of gateways (so stripe, bank transfer, direct debit etc) are all going to be located into one section for customers to manage everything. Is this not the case? I would even add that https://developers.whmcs.com/api-reference/addpaymethod/ as mentioned in my opening post, does refer to other gateways under "gateway_module_name" such as authorizecim, sagepaytokens etc, so my head is thinking well information about Gocardless (and other gateways will also be in the same section). If the multiple payment method is just a stripe gateway improvement, then nope, to me, it's not been clear.
  11. With the introduction of multiple payment methods, which I note from the new API https://developers.whmcs.com/api-reference/addpaymethod/ will also deal with banktransfer information too. However, will this also be the location of where the Direct Debit Information from the Gocardless module be located?
  12. aquiss

    Registration after Payment and order?

    What a useful bit of code, I can think of some uses for this myself (note to self, must save the URL)
  13. Are you able to provide screenshots for your affiliate settings? Setup -> General Settings -> Affiliates tab Also, what you have set on each package within the Other section? Setup -> Products/Services -> Products/Services -> Package -> Other tab
  14. Thanks @brian! Now how on earth have I missed this!
×

Important Information

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