3. Checkout
Great! We have a Cart with the reference abc
which includes our T-Shirt as a custom_item
. We'll now take the Cart and convert it to an Order using the Checkout API.
Checkout a Cart
You can Checkout a Cart using an existing Customer ID or an object including the customer name and email. In the example below, we'll provide a name and an email, as we have no customers yet 😢.
You'll need to re-authenticate when the access_token
expires.
Along with the customers information, we must also provide the billing and shipping information. Using cURL we can send the following request:
Replace XXXX
below with your access_token.
When the request is complete, you'll receive a 201 CREATED
response similar below:
👆 Congratulations. This is your first Order.
Inspecting the Order
You can see in the Order object above we received a few values that make paying for an Order really easy.
Property | Description |
| This is the ID for the newly created order. You'll need this to get the order again in the future or when paying for an order. |
| This will be either |
| An order will be immediately unpaid, but once you move onto paying for an order, this can be: |
| This will be either |
| This object contains useful metadata for your order including a formatted order total for your cart, along with when the cart was created. |
| This object will contain the IDs for related objects, including the Order Items and the Customer, if you provided one during Checkout. |
Clean up your Cart
Once a Cart is converted to an Order, the Cart will exist for another 7 days, unless you touch it again. You can send a request to DELETE
the Cart, if you no longer require the items inside.
Replace XXXX
below with your access_token.
Last updated