Create order with PrestaShop's API

*爱你&永不变心* 提交于 2019-12-06 16:37:36

I'm posting the answer for anybody who gets here from Google. Even if PS docs say ids aren't required, you must pass every id field in both the cart and the order.

That means, you must provide a client id, an address id, delivery address id, etc... when you're creating the cart and when you're creating the order.

If you fail at doing so, yourorder might get inserted, or it might not. And, if it does get inserted, it's not guaranteed that it will show up in the "Orders" listing.

Son Le

There are some "hidden" mandatory things you need to follow in order to create a valid order:

  1. The secure_key must match between customer's secure_key and order's secure_key
  2. The address (of delivery) must be associated with a valid country.

So, the best way is that you follow the full flow of creating an order, naturally:

  1. Create customer, get customer's secure_key and customer_id from returned xml

  2. Create cart, using customer_id from above step

  3. Create order with customer_id, customer's secure_key and cart_id from above steps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!