The Spree team has been working hard the last few months to make our API really robust. In November we announced the complete refactoring of the API to include a brand new Backbone.js based administration interface and a new documentation site. We are now adding the ability to checkout an order using the API. Using the “CheckoutsController” feature the API will allow an existing order to be updated and advanced until it is in the complete state following these steps:
Creating a New, Empty Order
You can create a new, empty order by making the following request:
Advancing an Order’s State
To advance an order to the next state, make the following request:PUT /api/checkouts/ORDER_NUMBER
If successful, this will advance the order’s state and return the order specified in the request. Otherwise, this will return any errors on the order. Note that while the API documentation for checkouts was written with the default Spree checkout flow in mind, this will work with custom order states you may have implemented. You can also select a shipping method and payment method while advancing your order. For details on how to do this, review the Checkout API documentation.
Try Out the Checkout API Feature
The Checkout API feature is available now and is on the 1-3-stable branch. Feel free to give it a try and please report any feedback or issues. Detailed information about the Checkout API is covered in our documentation.