Magento – Placing and order via API and payment processing

apice-1.9.0.1orderspaymentsoap

I'd like to create and place an order in Magento using API. I see that exists the method cart.create but I cannot understand what is the correct flow for using it.

The point I cannot figure out how to handle is the payment.

The following use case can work?

  1. Create a cart using Magento API
  2. Add products to cart using Magento API
  3. Set customer, addresses, etc again using Magento API
  4. Perform some kind of payment outside Magento
  5. If payment is successful, call cart.create

Thanks

Best Answer

The full workflow should be like this:

  1. Create a shopping cart ('cart.create')

  2. Set the customer/guest to the shopping cart ('cart_customer.set')

  3. Set customer addresses, for example guest's addresses ('cart_customer.addresses')

  4. add/update/remove products to the shopping cart ('cart_product.add', 'cart_product.update', cart_product.remove')

  5. get the list of shipping methods ('cart_shipping.list')

  6. set shipping method ('cart_shipping.method')

  7. get list of payment methods ('cart_payment.list')

  8. set payment method ('cart_payment.method')

  9. add/remove coupons if necessary ('cart_coupon.add', 'cart_coupon.remove')

  10. get total prices ('cart.totals')

  11. get information about the shopping cart ('cart.info')

  12. get list of licenses ('cart.licenseAgreement')

  13. create oder ('cart.order')

There is also a detailed code example for SOAP APIv1 on http://www.magentocommerce.com/api/soap/checkout/cart/cart.html