Checkout and payment
Claim the guest cart, select shipping, create the order, take payment, and follow the order
All calls on this page need a customer token. Paths and shell variables are as in Before you start.
1. Claim the guest cart
Sign the customer in through the Auth API. Refer to Sign-in and Sign-up.
Then move the guest's parts and carts to the customer. Send the customer token as the Bearer token, and the guest token in the body:
curl -X PATCH "$API/cart/$CART_ID/claim" \
-H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN" -H "Content-Type: application/json" \
-d "{ \"anonymousSessionToken\": \"$GUEST_TOKEN\" }"Response 204. One call moves all parts and all open carts of that guest to the customer.
| Status | Meaning |
|---|---|
404 | The cart does not exist, or it is not a cart of this guest |
409 | The cart is already claimed, or it is not open. If your customer already owns the cart, continue. |
After the claim, discard the guest token. From this point, use the customer token for all calls.
2. Select an address and shipping
# Addresses of the customer's organisation
curl "$API/address" -H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN"
# Shipping methods of the store
curl "$API/operator/shipping-methods" -H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN"
# Rates for delivery to an address
curl -X POST "$API/shipping/rate" \
-H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN" -H "Content-Type: application/json" \
-d '{
"currency": "EUR",
"toAddressId": 123,
"parts": [
{ "partRevisionId": "…", "units": "MILLIMETERS", "quantity": 1, "processPricesId": "…", "materialId": 12 }
]
}'A shipping method has a shippingMode:
| Mode | What the customer selects | shipping object for the order |
|---|---|---|
SELF_COLLECTION | Collection from the manufacturer. No address. | { "shippingMode": "SELF_COLLECTION", "shippingMethodId": 3 } |
FIXED_PRICE | A rate from POST /shipping/rate | { "shippingMode": "FIXED_PRICE", "shippingMethodId": 7, "rateId": "…", "toAddressId": 123 } |
CUSTOMER_ACCOUNT | Delivery on the customer's own carrier account | { "shippingMode": "CUSTOMER_ACCOUNT", "shippingMethodId": 9, "toAddressId": 123, "accountNumber": "…" } |
To create an address, refer to Addresses. For all shipping fields, refer to Shipping.
3. Get the final price
Call POST /pre-order again. This time, include shipping and billingAddressId. The quote then includes shipping and the correct tax.
4. Create the order
POST /order uses the same body as POST /pre-order, plus cartId and intent.
curl -X POST "$API/order" \
-H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN" -H "Content-Type: application/json" \
-d '{ …the pre-order body…, "cartId": "…", "intent": "CHECKOUT" }'- The API calculates the price again. It does not trust a price from the client.
- The new order has
"state": "QUOTE"and"paymentStatus": "UNPAID". It becomes anORDERwhen the customer pays or accepts. - If you give a
cartId, the cart must be open. After the call, the cart status isCONVERTED. - Send
"intent": "CHECKOUT"when the customer continues to payment immediately. Without it, the customer gets a "your quote is ready" notification. Omit it for a "save as quote" button.
Response:
{
"order": { "id": 4711, "state": "QUOTE", "paymentStatus": "UNPAID", "quoteNumber": "Q-1042", "price": 54.2, "currency": "EUR", "threadId": 880 },
"requisitionMapping": { "7b0c1a52-0d1e-4b0c-8f5e-0c6a1c0f3e11": { "id": 9001, "orderId": 4711 } }
}5. Check that the order can be paid
curl "$API/order/$ORDER_ID/purchasability" -H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN"If canBePurchased is false, the manufacturer must review the quote first.
6. Choose the payment methods
There are three ways to pay. Which ones you show depends on the store settings and on the customer type (GET /customer, field customerType).
| Method | Show it when | Call |
|---|---|---|
| Online payment | paymentProvider is not NONE, and customerType is not INTERNAL | POST /order/{id}/payment |
| Pay by invoice | isPayByInvoiceEnabled is true, or customerType is ACCOUNT | PATCH /order/{id}/payment/invoice |
| Pay by purchase order | isPayByPurchaseOrderEnabled is true (and customerType is not INTERNAL), or customerType is ACCOUNT | PATCH /order/{id}/payment/purchase-order |
7. Take the payment
curl -X POST "$API/order/$ORDER_ID/payment" -H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN"The response contains the data for the payment provider of your store. For Stripe:
{
"id": "pi_…",
"provider": "STRIPE",
"clientSecret": "pi_…_secret_…",
"merchantAccount": "acct_…",
"finalPrice": 54.2,
"tax": 9.2,
"currency": "EUR",
"stripePaymentIntentStatus": "requires_payment_method"
}Complete the payment in the browser with the SDK of the provider. There is no "confirm" call to the Customer API. The provider tells Phasio about the result. Poll GET /order/{id} until paymentStatus is PROCESSING or PAID.
Refer to Online payment for the provider fields.
curl -X PATCH "$API/order/$ORDER_ID/payment/invoice" -H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN"No body. The response is the updated order. The quote becomes an order. If this method is not permitted, the API returns 400 with an empty body.
multipart/form-data with three optional fields: purchaseOrderNumber, message, and file (the purchase order document).
curl -X PATCH "$API/order/$ORDER_ID/payment/purchase-order" \
-H "X-Store-Name: $STORE" -H "Authorization: Bearer $CUSTOMER_TOKEN" \
-F "purchaseOrderNumber=PO-2026-118" -F "message=Please confirm the delivery date" -F "file=@po.pdf"8. Follow the order
There is no push channel. Poll GET /order/{id} with a customer token.
| Field | Meaning |
|---|---|
state | QUOTE or ORDER |
paymentStatus | UNPAID, PROCESSING, PAID, REFUNDED, EXTERNALLY_TRACKED |
isReviewRequired | The manufacturer must review the quote |
kanbanColumn.name | The production stage that the manufacturer shows |
shipping.expectedDispatchDate | Expected dispatch date |
shipments[].tracking | Carrier, tracking number, and tracking URL |
More calls
| Call | Returns | Reference |
|---|---|---|
GET /order | All quotes and orders of the customer's organisation | Orders |
GET /requisition?orderId={id} | The lines of an order | Orders |
GET /order/{id}/quote | The price breakdown | Orders |
GET /document/order/{id}/estimate, /confirmation, /invoice | PDF documents | Documents |
GET /activity/thread/{threadId}, POST /activity | The messages between the customer and the manufacturer | Messages and files |
Last updated on