Make your first Storefront API request
Make your first Storefront API request
Read products and create a cart using the Storefront API. This quickstart assumes your project already has a store and a published, priced variant. If it does not, start with Create and publish a product.
Before you begin
Use the project-specific Storefront endpoint from Connect to a project. Include the Storefront token if your project requires it. You need a store ID, an appropriate price channel, currency, and country. Do not use an Admin credential for these requests.
1. Read the catalog
Use a returned variant with a usable price and availableForPurchase: true.
Use discountedPrice.value when present, otherwise the original value, for the current catalog price.
If the list is empty or a price is missing, follow Catalog visibility.
Do not fix an empty catalog by substituting an unrelated store or currency.
2. Create a cart
Keep the returned cart ID in the shopper’s session after checking the business errors.
Use cart.total for the amount, not a calculation from the product card.
Creating a cart does not place an order or reserve a guaranteed unit of stock.
Verify and continue
Confirm lineItemsQuantity is one and the currency matches the catalog request.
Open checkoutUrl when using hosted checkout, or continue with Build a cart and checkout.
For a complete reference application, follow Build with the Next.js storefront.