Examples#
Practical step-by-step guides for common tasks with the Afosto GraphQL API.
Cart and checkout#
- Create a cart and go to checkout — Build a cart from products, attach a shipping address and method, then convert to an order with a checkout URL.
Orders#
- Create an order — Create an order manually with a contact, organisation, or project as customer, optionally set an expiration date, then add products with custom prices or discounts.
- List orders — Fetch a paginated list of orders, with optional filtering by email, order number, ID, progress, or creation date.
- Change the billing address on an order — Update or replace the billing address attached to an existing order.
- Cancel order items — Cancel items before shipment, approve the cancellation, optionally credit back fees and restock, then finish the process.
- Return order items — Process a customer return after delivery: receive the items back, approve the settlement, optionally credit fees and restock, then finish.
Payments and invoicing#
- Start an order, take a PIN terminal payment and invoice the items — The Afosto POS checkout flow: start an order, add items, route the payment to a PIN terminal, open the order and invoice the items.
- Invoice an order — Find the invoiceable items on an order, create the invoice, and retrieve the invoice details and PDF.
Fulfilment and shipping#
- Create a parcel and add track & trace — Group order items into a parcel for a delivery, attach a carrier tracking number, and expose it to the customer.
- Ship order items — Ship items through a connected carrier, an existing parcel, or your own track & trace, generate shipping labels, and mark the parcel as shipped.
- Set and read shipping dates and track & trace — Set the suggested ship date and expected delivery date on order items, read the actual shipping date once the delivery is processed, and retrieve the carrier tracking link.
Stock and inventory#
- Adjust stock — Read the stock of a SKU, change it with the operation that matches what happened (restock, correction, reservation, incoming supply), register or correct stock directly over the inventory REST endpoints, set reorder thresholds, and verify the result in the stock mutation log.