3 · Create customers & orders

Every order belongs to a customer. Create the customer, then create the order with the products they're buying.

Endpoints: Customers · Orders


Steps

  1. Create the customer: POST /customers. Send at least first_name, last_name and email.
  2. Optional: preview the order: POST /orders/calculate. It returns the same totals and payment schedule as a real order, but saves nothing.
  3. Create the order: POST /orders. Send order_type, currency, customer_id, and the products in order_products_attributes.
  4. Optional: to save changes to an order without submitting them, use POST /orders/{id}/save_as_draft.
flowchart LR
  Cust["Customer
  POST /customers"] --> Order
  Prev["Preview (optional)
  POST /orders/calculate"] -.-> Order
  Order["Order (draft)
  POST /orders"] --> Pay["4 · Collect payment"]

A new order is a draft. Nothing is charged until you collect payment in the next stage.


Order types

Set order_type to match what the customer is buying. See the request examples on Create order for each type.

order_typeHow it's paid
single_paymentOnce.
instalmentIn a fixed number of payments, with an optional deposit.
subscriptionOn a schedule, until cancelled.
meteredOn demand, based on usage.

Good to know

  • To cancel an order, use POST /orders/{id}/cancel. This also cancels its open scheduled payments. Cancelling a complete or already cancelled order changes nothing.

Next

Continue to 4 · Collect payment.