Jump to content

Internal API AddOrder: No items added to cart so order cannot proceed


Lanexbg

Recommended Posts

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"}

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

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