I have a PrestaShop 1.6.0.9 and I'm trying to create a new order. I'm following the following steps:
Create a cart with the security key of the client I have previously created, the id of the product I want to buy and the quantity.
Then create a new order (sending a POST to
/api/order
), passing the client id, the security key, the product id, the prices (with and without taxes), etc... This is the entire XML that I send:
<?xml version="1.0" encoding="UTF-8"?><prestashop><order>
<id_address_delivery>5</id_address_delivery>
<id_address_invoice>5</id_address_invoice><id_currency>1</id_currency>
<id_lang>1</id_lang><id_customer>2</id_customer><id_carrier>1</id_carrier>
<current_state>2</current_state><valid>1</valid><module>cashondelivery</module>
<payment>Pago en metalico</payment><conversion_rate>1</conversion_rate>
<security_key>1e87b5d59d7c812a9d840a548e4b8a45</security_key><associations>
<order_rows><order_rows><product_id>7</product_id>
<product_attribute_id>34</product_attribute_id><product_quantity>1</product_quantity>
</order_rows></order_rows></associations><id_cart>42</id_cart>
<total_paid>24.85</total_paid><total_paid_real>24.85</total_paid_real>
<total_products>20.54</total_products><total_products_wt>24.85</total_products_wt>
</order></prestashop>
As you can see, I'm using the "cashondelivery" module. My problem is that when I post that XML to the API, the order get's created, but:
Somehow the order doesn't show up in the orders list, but I can get to that order if I go to "Clients -> shopping carts -> "id of cart I created before POST-ing the order XML" -> order created from this cart.
Once I'm in the order, I can't see the client details (because the id of the client doesn't get inserted). I'm pretty sure that the client with id 2 does exist, but I'm not sure why it isn't inserted with the POST I'm sending to the API.
Any idea why any of those two problems are happening?