Examples#

Practical step-by-step guides for common tasks with the Afosto GraphQL API.

Cart and checkout#

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#

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.
Query Runnerhttps://afosto.app/graphql

No query loaded

Click play on any code block in the docs to load a query here.