Lanexbg Posted February 10, 2017 Share Posted February 10, 2017 Hi there guys, I'm trying to use the API to add a free service (it's completely free of charge) to a customer when he register a domain (it must be active as soon as the domain is successfully registered, so it must be automatic). So I use the AfterRegistrarRegistration hook and everything is okay until the point I call AddOrder, like this: $command = 'AddOrder'; $postData = array( 'clientid' => $userid, 'pid[0]' => $pid, 'paymentmethod' => 'mailin', ); $orderIt = localAPI($command, $postData, $adminUsername); It gives me {"result":"error","message":"No items added to cart so order cannot proceed"}. I don't see a way to add items to the cart and there is no cart when the hook is triggered, so how should I add the service to the customer. I couldn't find a direct way to do it, so I went with adding an order, but at this moment that doesn't work. P.S. The $postData values, in case someone might think they are causing the error somehow: {"clientid":"3","pid[0]":"4","paymentmethod":"mailin"} 0 Quote Link to comment Share on other sites More sharing options...
Lanexbg Posted February 13, 2017 Author Share Posted February 13, 2017 The issue is solved. The problem was in the pid ('pid[0]' => $pid,), I changed it to 'pid' => $pid and the order was added. It was added as pending and I called AcceptOrder and now everything looks okay. 0 Quote Link to comment Share on other sites More sharing options...
z900collector Posted June 22, 2017 Share Posted June 22, 2017 I am trying to add an order for a domain renewal, How do you work out the values of $pid? 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.