Skip to content

Cart & Checkout mapping

The cart and checkout flow is a sequence — the same on both transports. The difference is naming: REST uses one path per step; GraphQL wraps each step as a mutation (most prefixed create…) and reads as a query.

Auth for this flow: a guest cart uses the cart token as the Bearer; a logged-in customer uses their customer token. See Auth & Context.

Cart

CapabilityRESTGraphQL
Create guest cart tokenPOST /api/shop/cart-tokenscreateCartToken
Read cartPOST /api/shop/cartcreateReadCart
Add itemPOST /api/shop/cart/add-to-cartcreateAddProductInCart
Update item quantityPUT /api/shop/cart/update-cart-itemcreateUpdateCartItem
Remove itemPOST /api/shop/cart/remove-cart-itemcreateRemoveCartItem
Apply couponPOST /api/shop/cart/apply-couponcreateApplyCoupon
Remove couponPOST /api/shop/cart/remove-couponcreateRemoveCoupon
Merge guest cart on loginPOST /api/shop/cart/merge-cartcreateMergeCart
Upload customizable-option filePOST /api/shop/cart/upload-customizable-file— REST only (binary upload)

Checkout

CapabilityRESTGraphQL
Read saved addressesGET /api/shop/checkout/get-addressescollectionGetCheckoutAddresses
Set billing / shipping addressPOST /api/shop/checkout/set-billing-address (or set-shipping-address)createCheckoutAddress
Get shipping methods (rates)GET /api/shop/checkout/get-shipping-methodscollectionShippingRates
Set shipping methodPOST /api/shop/checkout/set-shipping-methodcreateCheckoutShippingMethod
Get payment methodsGET /api/shop/checkout/get-payment-methodscollectionPaymentMethods
Set payment methodPOST /api/shop/checkout/set-payment-methodcreateCheckoutPaymentMethod
Place orderPOST /api/shop/checkout/place-ordercreateCheckoutOrder

Two things every checkout client must know

  • Shipping rates are empty until an address is saved. Call set-address first; only then do get-shipping-methods / get-payment-methods return options.
  • createCheckoutAddress input is flat, not nested — billingFirstName, billingAddress, billingCountry, billingPostcode, useForShipping, and the shipping* equivalents. A nested { billing {}, shipping {} } is rejected.

Offsite payment redirect

For gateway methods (Stripe, PayU, PhonePe, Razorpay, PayPal), set payment method returns a non-null paymentGatewayUrl — redirect the shopper there, and the order is created when they return to the success URL. On-site methods (cashondelivery, moneytransfer) return null and go straight to place-order. See the Checkout workflow.

Released under the MIT License.