The Storefront API
/api/v1/store, for mobile apps and headless front ends: the same carts, prices, stock and (next) checkout as the web
storefront, with no session or cookies. Routes: packages/core/src/Modules/Storefront/Routes/api.php; controllers in
Storefront\Http\Controllers\Api; JSON shapes in Storefront\Api\Present (money is {amount, currency, formatted}
in minor units).
Language and shopper
Http\Middleware\StoreApi sets the language from ?lang= or Accept-Language (Romanian otherwise) and, when a
Authorization: Bearer … token is sent, signs its shopper in for that request through
Customers\Contracts\CustomerTokens (Sanctum personal access tokens on the Customer model, ability store). A token
that does not work is a 401 (invalid_token), never a silent guest. Tokens end on sign-out, on a password change or
reset, when the account is banned or erased, and after 365 days unused.
| Endpoint | |
|---|---|
POST auth/login {email, password, device} |
{token, customer}; 10 a minute per address, 5 per e-mail |
POST auth/register {name, email, password, device} |
201 {token, customer} |
POST auth/logout |
ends this token |
GET me |
the signed-in shopper |
Catalogue
GET categories (the menu tree), GET categories/{slug}?sort=&brands[]=&page= (cards; sort is recomandate, vandute, noi or nume), GET search?q=&page=,
GET products/{slug} (texts, images, specifications, each variant's price for this shopper, the Omnibus
lowest_30_days when reduced, and availability). A company buyer's token gets their own prices and sees what is
reserved for companies.
Cart
A guest's cart travels in X-Cart-Token (every answer carries it back, in the body and the header). A signed-in
shopper's cart is their own; a guest token sent with their bearer token is merged into it, as at sign-in on the web.
GET cart, POST cart/lines {variant_id, quantity} (201), PATCH cart/lines/{variant} {quantity} (0 removes),
DELETE cart/lines/{variant}, POST cart/voucher {code}, DELETE cart/voucher. A refused change is a 422 with
error (unavailable, short with available, too_many) and the shopper-facing message.
A guest token reaches only a cart that belongs to nobody; an account's cart needs the shopper's bearer token.
POST cart/voucher allows 5 tries a minute and 30 an hour per address, and 5 a minute per cart (429 too_many).
Favourites
Signed in only (401 unauthenticated otherwise): GET wishlist (the saved variants, latest first, with today's
price for this shopper, lowest_30_days and available), POST wishlist {variant_id} (201 with the list; 404 for a
variant not on sale, 422 wishlist_full beyond 200), DELETE wishlist/{variant} (204). The same list as the
account page on the web (Customers\Contracts\Wishlists).
Checkout and orders
GET checkout/options (delivery and payment for this cart), GET checkout/lockers?network=&q=,
POST checkout/quote and POST checkout/place take the web checkout's own fields (Storefront\Support\CheckoutForm)
and answer the order; a card order also carries payment.redirect_url (or a hosted form's payment.html for a web
view). GET orders (signed in), GET orders/{token}, POST orders/{token}/pay (another try after a failed one).
Limits: 180 calls a minute per token or address.
Tests: tests/Feature/Storefront/StoreApiTest.php.