# Shop API: overview

<!-- prettier-ignore-start -->

Sell products from your own app. Look up an offer, add items to a cart and show the exact price. When the buyer places an order, send them to an approved payment page.

Choose one Store, Site, Channel, Market, currency, price list and stock location for each profile. Allow only the credentials that can buy from that profile. Your products can sell without a CMS page. Shop holds the stock while the order waits for payment.

Use a test payment account before taking real orders. Use Shop’s trusted workflows to check payment, ship or hand over goods, and record returns and refunds.

- **Price and availability:** Check current availability and price on the [Capell Marketplace listing](https://capell.app/marketplace/extensions/shop-api).
- **Licence:** Check the licence terms on the [Capell Marketplace listing](https://capell.app/marketplace/extensions/shop-api).
- **Requires:** `PHP ^8.4`, `capell-app/core ^1.0.78`, `capell-app/shop ^1.0.10`, `laravel/sanctum ^4.0`, `lorisleiva/laravel-actions ^2.8`, `spatie/laravel-package-tools ^1.14.1`.
- **Install:** `composer require capell-app/shop-api:@beta`.

## Quick Start

1. Install the package: `composer require capell-app/shop-api:@beta`.
2. Run `php artisan route:list` and verify the package routes are registered.

## For Developers

A trusted integration uses the same Shop quote, reservation, order and payment attempt rules as Storefront. Its credential owns opaque cart handles and order references are available within their originating cart.

## Configure

- **Configuration files:** `config/capell-shop-api.php`.

## Limits And Pitfalls

- Install the required Capell packages at the versions in `composer.json`: `capell-app/core ^1.0.78`, `capell-app/shop ^1.0.10`.
- Run migrations before opening package resources or public routes.
- Review middleware, throttling, signatures, and public-output safety in `routes/api.php` before exposing routes.

## Screens And Workflow

- A host app's product card and basket built from Shop API responses (frontend).

## Install Impact

- Required packages: `capell-app/core`, `capell-app/shop`.
- Admin navigation: no admin page or resource contribution is declared.
- Admin/editor extensions: none declared.
- Permissions: no package permission declarations or Shield gates detected; host access rules still apply.
- Public routes: loads `routes/api.php`; registers `ShopApiRouteContribution`.
- Database changes: package migrations are declared.
- Config: `config/capell-shop-api.php`.
- Settings: no package settings declared.
- Queues or schedules: none declared.
- Cache tags: none declared.
- Commands: none declared.

## Troubleshooting

| Symptom | Likely cause | Check | Fix |
| --- | --- | --- | --- |
| Package surface is missing after install | Provider or manifest is not loaded | Confirm `capell.json`, package `composer.json`, and provider registration | Reinstall the package, refresh Composer autoload, and clear host caches |
| Admin screen or command fails on missing table | Package migrations have not run | Check the tables listed in `Data Model` | Run host migrations and rerun the focused package test |
| Route returns unexpected output | Route cache, middleware, or signed URL setup does not match the package route file | Check the route files listed in `Technical Shape` | Clear route cache and verify middleware before exposing public routes |

## Next Steps

- [Package docs index](README.md)
- Configuration files: [`config/capell-shop-api.php`](../config/capell-shop-api.php).
- [Developer troubleshooting](../README.md#troubleshooting)
- [Developer reference](reference.md)
- [Capell content language plan](../../../docs/CONTENT_LANGUAGE_PLAN.md)
- [Capell documentation design system](../../../docs/DESIGN_SYSTEM.md)
- [Capell and package ERD notes](../../../docs/erd/capell-and-package-erds.md)
- Related packages: [Shop](../../shop/README.md).

<!-- prettier-ignore-end -->