### Install Dependencies and Run App
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/quickstart.mdx
Navigate to your app directory, install dependencies using pnpm, and start the development server. Ensure you have Node.js and pnpm installed.
```bash
cd my-saleor-app
pnpm install
pnpm dev
```
--------------------------------
### Install @saleor/app-sdk
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/app-sdk/overview.mdx
Install the SDK using your preferred package manager. pnpm is recommended.
```shell
# Preferred - with pnpm
pnpm add @saleor/app-sdk
```
```shell
# With npm and yarn
npm i @saleor/app-sdk
yarn add @saleor/app-sdk
```
--------------------------------
### Clone and Install Storefront
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/windows.mdx
Downloads and installs dependencies for the storefront.
```shell
git clone https://github.com/saleor/storefront.git
cd storefront
```
```shell
pnpm install
```
--------------------------------
### Install Storefront Dependencies
Source: https://github.com/saleor/saleor-docs/blob/main/docs/quickstart/storefront.mdx
Clone the repository and install the necessary dependencies using pnpm.
```bash
git clone https://github.com/saleor/storefront.git saleor-storefront
cd saleor-storefront
pnpm i
```
--------------------------------
### Visualize App Installation Sequence
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
A sequence diagram illustrating the communication flow between Saleor, the database, and the app during the installation process.
```mermaid
sequenceDiagram
participant Saleor
participant DB
participant App
Saleor ->>+ App: GET /path/to/manifest.json
App -->>- Saleor: App manifest
Saleor ->> Saleor: Validate manifest
Saleor ->>+ DB: Create App
DB -->>- Saleor: App object
opt tokenTargetUrl is set in manifest
Saleor ->> Saleor: Generate new auth token for app
Saleor ->>+ App: POST /token/target/url/
{"auth_token": "new-app-token"}
App -->>- Saleor: HTTP 200 OK
end
```
--------------------------------
### Install a third-party App via CLI
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Download a manifest and install an app using the install_app command.
```shell
python manage.py install_app https://www.url.to.manifest
```
--------------------------------
### Install Dependencies
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/running-saleor-apps-locally.mdx
Installs all project dependencies using pnpm. This command should be run after cloning the saleor/apps repository.
```bash
pnpm install
```
--------------------------------
### Install Saleor Dependencies
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/windows.mdx
Installs project dependencies using Poetry.
```shell
poetry install
```
--------------------------------
### Configure Environment Variables
Source: https://github.com/saleor/saleor-docs/blob/main/docs/quickstart/storefront.mdx
Initialize the .env file from the provided example.
```bash
cp .env.example .env
```
--------------------------------
### Run Development Server
Source: https://github.com/saleor/saleor-docs/blob/main/docs/quickstart/storefront.mdx
Start the local development server.
```bash
pnpm run dev
```
--------------------------------
### GraphQL Variables for Promotion Creation
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/discounts/promotions.mdx
Example variables for the `promotionCreate` mutation, including name, type, description, and start date.
```json
{
"input": {
"name": "Example sale",
"type": "CATALOGUE",
"description": {
"blocks": [
{
"type": "paragraph",
"data": {
"text": "Test example sale."
}
}
]
},
"startDate": "2023-06-06T00:00:00.00+00:00"
}
}
```
--------------------------------
### Configure Public URL for Local Saleor Connection
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/local-app-development.mdx
If your Saleor setup uses IPv6 and causes installation failures, set the `PUBLIC_URL` environment variable to `http://127.0.0.1:8000/` (or your Saleor's port) to ensure your app can be installed.
```sh
PUBLIC_URL=http://127.0.0.1:8000/
```
--------------------------------
### Start MailHog Service with Docker Compose
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/app-store/apps/smtp/configuration.mdx
Use this command to start the MailHog service for local email testing. Ensure Docker is installed and `docker compose` is available.
```bash
docker compose up
```
--------------------------------
### Installing Third-Party Apps via Command Line
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Install a third-party app by providing the URL to its manifest file using the `install_app` command.
```APIDOC
## POST /manage/apps/install
### Description
Installs a third-party App based on its manifest URL.
### Method
`POST` (simulated via command line)
### Endpoint
`python manage.py install_app`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
**Arguments:**
- ``: URL of the manifest file, required.
- `--activate`: immediately activate the new App.
### Request Example
```shell
python manage.py install_app https://www.url.to.manifest
```
### Response
App installation is confirmed by sending the API token to the specified token target URL. For workflow details, refer to the [install app workflow](/developer/extending/apps/installing-apps.mdx#install-an-app) documentation.
```
--------------------------------
### Install Project Dependencies with pnpm
Source: https://github.com/saleor/saleor-docs/blob/main/README.md
Install all necessary project dependencies using pnpm after enabling it.
```bash
pnpm install
```
--------------------------------
### Installing an App via GraphQL API
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Use the `appInstall` GraphQL mutation to install an app by providing its manifest URL and desired permissions.
```APIDOC
## POST /graphql
### Description
Installs an App using its manifest URL via the GraphQL API.
### Method
`POST`
### Endpoint
`/graphql`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
**`appInstall` Mutation Input:**
- **`appName`** (String!) - The name of the App, required.
- **`manifestUrl`** (String!) - The URL of the manifest file, required.
- **`permissions`** ([String!]) - A list of permissions the App should be granted.
- **`activateAfterInstallation`** (Boolean) - Immediately activate the new App. Defaults to `true`.
### Request Example
```json
{
"query": "mutation {\n appInstall(\n input: {\n appName: \"External Order App\"\n manifestUrl: \"http://localhost:3001/manifest\"\n permissions: [MANAGE_ORDERS]\n }\n ) {\n appInstallation {\n id\n status\n appName\n manifestUrl\n }\n appErrors {\n field\n message\n code\n permissions\n }\n }\n}"
}
```
### Response
#### Success Response (200)
Returns an `appInstallation` object with installation details and a list of `appErrors` if any occurred.
#### Response Example
```json
{
"data": {
"appInstall": {
"appInstallation": {
"id": "QXBwT25nb2luZ0luc3RhbGxhdGlvbjoz",
"status": "PENDING",
"appName": "Order App",
"manifestUrl": "http://localhost:3001/manifest"
},
"appErrors": []
}
}
}
```
**Workflow:**
```mermaid
sequenceDiagram
Client ->>+ Saleor: mutation appInstall
Saleor ->> Saleor: Validate received data
Saleor ->>+ Background Worker: Schedule installation
Background Worker -->>- Saleor: Scheduled
Saleor -->>- Client: return appInstallation
```
```
--------------------------------
### Generate App Manifest with Webhook Configuration
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/app-sdk/saleor-webhook.mdx
Example of creating a manifest handler using `@saleor/app-sdk` to include webhook configurations in the app's manifest. This ensures Saleor is aware of the webhooks when the app is installed.
```typescript
// pages/api/manifest
import { createManifestHandler } from "@saleor/app-sdk/handlers/next";
import { orderCreatedWebhook } from "./order-created.ts";
export default createManifestHandler({
manifestFactory({ appBaseUrl }) {
return {
/**
* Add one or more webhook manifests.
*/
webhooks: [orderCreatedWebhook.getWebhookManifest(appBaseUrl)],
// ...rest of your App's manifest
};
},
});
```
--------------------------------
### Install pnpm
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/app-template.mdx
Install pnpm globally using npm. This is a prerequisite for using the Saleor App Template.
```bash
npm install -g pnpm
```
--------------------------------
### Install App from Manifest URL
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/running-saleor/managing-apps.mdx
Install an app by providing its manifest URL. This command can also activate the app upon installation. Ensure your Celery worker is running for background tasks.
```shell
./manage.py install_app
--manifest-url http://localhost:3000/manifest
--activate
```
--------------------------------
### Install MacawUI
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/macaw-ui.mdx
Install the MacawUI package using npm. This is the first step to integrate the UI components into your project.
```bash
npm i @saleor/macaw-ui
```
--------------------------------
### Clone and Install Dashboard
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/windows.mdx
Downloads and installs dependencies for the Saleor dashboard.
```shell
git clone https://github.com/saleor/saleor-dashboard.git
cd saleor-dashboard
```
```shell
npm install
```
--------------------------------
### Install External App in Saleor Dashboard
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/local-app-development.mdx
To install your app, navigate to the 'Apps' section in the Saleor Dashboard, click 'Install external app', and paste your app's manifest URL. Ensure the URL uses `host.docker.internal` for container access.
```text
http://host.docker.internal:3000/api/manifest
```
--------------------------------
### Start Saleor API Server
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/windows.mdx
Runs the development API server.
```shell
poetry run uvicorn saleor.asgi:application --reload
```
--------------------------------
### Start Individual App Dev Server
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/running-saleor-apps-locally.mdx
Starts the development server for a specific application within the monorepo. Replace 'X' with the actual app name.
```bash
pnpm dev --filter=X
```
--------------------------------
### Define AppInstallInput Type
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-reference/apps/inputs/app-install-input.mdx
Use this input type when installing a new app to specify its name, manifest URL, whether it should be activated after installation, and the permissions it requires.
```graphql
input AppInstallInput {
appName: String!
manifestUrl: String!
activateAfterInstallation: Boolean
permissions: [PermissionEnum!]
}
```
--------------------------------
### Start All Dev Servers
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/running-saleor-apps-locally.mdx
Starts all development servers for the applications in the monorepo. This command utilizes pnpm's built-in capabilities for managing multiple packages.
```bash
pnpm dev
```
--------------------------------
### Mutation appRetryInstall
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-reference/miscellaneous/scalars/boolean.mdx
Retry the installation process for a Saleor App.
```APIDOC
## Mutation appRetryInstall
### Description
Retries the installation of an application in the Saleor system.
### Method
POST
### Endpoint
/api-reference/apps/mutations/app-retry-install.mdx
```
--------------------------------
### POST appRetryInstall
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Retries a failed app installation process.
```APIDOC
## POST appRetryInstall
### Description
Retries the installation process for a given App that has a failed status.
### Method
MUTATION
### Parameters
#### Request Body
- **id** (ID) - Required - The ID of the AppInstallation
- **activateAfterInstallation** (Boolean) - Optional - Immediately activate the new App (defaults to true)
### Request Example
mutation {
appRetryInstall(id: "QXBwT25nb2luZ0luc3RhbGxhdGlvbjoy") {
appErrors {
field
message
code
}
appInstallation {
id
status
}
}
}
```
--------------------------------
### Provide document overview
Source: https://github.com/saleor/saleor-docs/blob/main/GUIDELINES.md
Start documents with a summary paragraph to set expectations.
```md
## Product API Overview
This API lets you programmatically access and manage product data. This guide covers authentication, available endpoints, and common use cases.
```
--------------------------------
### Query apps
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-reference/miscellaneous/scalars/string.mdx
Retrieves a list of apps installed in the Saleor instance.
```APIDOC
## QUERY apps
### Description
Retrieves a list of apps installed in the Saleor instance.
### Method
QUERY
### Endpoint
/api-reference/apps/queries/apps.mdx
```
--------------------------------
### Retrieve all Apps
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Use the apps query to fetch a list of installed applications.
```graphql
{
apps(first: 5) {
edges {
node {
id
permissions {
code
}
name
isActive
webhooks {
name
}
}
}
}
}
```
```json
{
"data": {
"apps": {
"edges": [
{
"node": {
"id": "QXBwOjE=",
"permissions": [
{
"code": "MANAGE_ORDERS"
}
],
"name": "Order App",
"isActive": true,
"webhooks": []
}
}
]
}
}
}
```
--------------------------------
### Query appsInstallations
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-reference/apps/queries/apps-installations.mdx
Retrieves a list of all app installations. Requires MANAGE_APPS permission.
```graphql
appsInstallations: [AppInstallation!]!
```
--------------------------------
### GET /shop
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/taxes.mdx
Retrieves a list of available tax apps installed in the shop.
```APIDOC
## GET shop
### Description
Queries the shop details to retrieve a list of available tax apps that can be used for dynamic tax calculations.
### Method
GET (GraphQL Query)
### Response
#### Success Response (200)
- **availableTaxApps** (List) - A list of available tax apps with their IDs, names, and identifiers.
#### Response Example
{
"data": {
"shop": {
"availableTaxApps": [
{
"id": "...",
"name": "AvaTax",
"identifier": "saleor.tax"
}
]
}
}
}
```
--------------------------------
### GET appsInstallations
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Fetches a list of all ongoing and failed app installations. Requires MANAGE_APPS permission.
```APIDOC
## GET appsInstallations
### Description
Fetches a list of all ongoing and failed app installations. This query is only available to staff users with the MANAGE_APPS permission.
### Method
QUERY
### Response
#### Success Response (200)
- **id** (ID) - The ID of the installation
- **status** (String) - The current status (e.g., FAILED, PENDING)
- **appName** (String) - The name of the app
#### Response Example
{
"data": {
"appsInstallations": [
{
"id": "QXBwT25nb2luZ0luc3RhbGxhdGlvbjoy",
"status": "FAILED",
"appName": "Shipping App"
}
]
}
}
```
--------------------------------
### Start Saleor Development Server with pnpm
Source: https://github.com/saleor/saleor-docs/blob/main/README.md
Run the development server for Saleor using pnpm.
```bash
pnpm start
```
--------------------------------
### GraphQL Result for Promotion Creation
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/discounts/promotions.mdx
Example result of the `promotionCreate` mutation, showing the created promotion's ID, name, type, description, start date, and end date.
```json
{
"data": {
"promotionCreate": {
"promotion": {
"id": "UHJvbW90aW9uOjEyMzA0YmM4LTA2ZTMtNDg1Mi05ODU1LWM4ZDkyMDgzNTYwZA==",
"name": "Example sale",
"type": "CATALOGUE",
"description": {
"blocks": [
{
"type": "paragraph",
"data": {
"text": "Test example sale."
}
}
]
},
"startDate": "2023-06-06T00:00:00+00:00",
"endDate": null
}
}
}
}
```
--------------------------------
### Configure Saleor Plugin Entry Point
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/plugins/overview.mdx
Define the plugin's entry point in `setup.py` under `saleor.plugins` to allow Saleor to discover and load your plugin.
```python
from setuptools import setup
setup(
...,
entry_points={
"saleor.plugins": [
"my_plugin = my_plugin.plugin:MyPlugin"
]
}
)
```
--------------------------------
### Retry Failed App Installation
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Retries the installation process for a specific app installation ID.
```graphql
mutation {
appRetryInstall(id: "QXBwT25nb2luZ0luc3RhbGxhdGlvbjoy") {
appErrors {
field
message
code
}
appInstallation {
id
status
}
}
}
```
--------------------------------
### Create a Product
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/products/api.mdx
Use the productCreate mutation to initialize a product with core details like name, description, and category.
```graphql
mutation ProductCreate($input: ProductCreateInput!) {
productCreate(input: $input) {
product {
id
name
description
}
errors {
field
message
}
}
}
```
```json
{
"input": {
"name": "T-Shirt",
"description": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"A comfortable cotton t-shirt\"}}]}",
"productType": "UHJvZHVjdFR5cGU6MjA=",
"category": "Q2F0ZWdvcnk6Mzk=",
"attributes": [
{
"id": "QXR0cmlidXRlOjM2",
"values": [
"cotton"
]
}
]
}
}
```
--------------------------------
### Creating Local Apps via Command Line
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Use the `create_app` command to set up local apps with specified permissions and configurations. This is useful during development.
```APIDOC
## POST /manage/apps/create
### Description
Creates a local App with explicitly provided permissions.
### Method
`POST` (simulated via command line)
### Endpoint
`python manage.py create_app`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
**Arguments:**
- ``: the name of the App, required.
- `--permission `: assign permission `PERM` to the App. This argument can be repeated to specify multiple permissions.
- `--identifier`: canonical App ID.
- `--activate`: immediately activate the new App.
- `--target-url `: a URL to send the API auth token to once installation is complete. [Optional]
### Request Example
```shell
python manage.py create_app "Order App" \
--permission MANAGE_USERS \
--permission MANAGE_ORDERS \
--target-url https://your-order-app/your-register-endpoint/
```
### Response
If the target URL is provided, Saleor will POST the API auth token, in the same JSON format, to the provided URL.
```mermaid
sequenceDiagram
Saleor ->> App: POST /token/target/url/
{"auth_token": "new-app-token"}
App -->> Saleor: HTTP 200 OK
```
If the target URL is not specified, the command will output the API auth token in the following format:
```json
{
"auth_token": "new-app-token"
}
```
```
--------------------------------
### Install json-schema-to-typescript
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/generating-types-for-sync-webhooks.mdx
Install the required package via npm.
```shell
npm install json-schema-to-typescript
```
--------------------------------
### Populate Database with Sample Data
Source: https://github.com/saleor/saleor-docs/blob/main/docs/quickstart/running-locally.mdx
Optionally populate the database with sample data for testing or demonstration purposes. This command adds default entries to your Saleor database.
```bash
docker compose run --rm api python3 manage.py populatedb
```
--------------------------------
### Create PostgreSQL Database
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/windows.mdx
Initializes the database for the Saleor project.
```shell
C:"Program Files"\PostgreSQL\15\bin\createdb.exe --username=postgres --owner=saleor saleor
```
--------------------------------
### GraphQL Query Example
Source: https://github.com/saleor/saleor-docs/blob/main/README.md
Example of a GraphQL query for fetching data.
```graphql
query {
id
name
}
```
--------------------------------
### Build Project
Source: https://github.com/saleor/saleor-docs/blob/main/README.md
Use this command to build the project for production.
```sh
pnpm build
```
--------------------------------
### JSON Response Example
Source: https://github.com/saleor/saleor-docs/blob/main/README.md
Example of a JSON response, potentially indicating an error.
```json
{
"errorCode": 400
}
```
--------------------------------
### Event Payload Example: account_confirmation
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/app-store/legacy-plugins/user-emails.mdx
Example payload structure for the account_confirmation event.
```APIDOC
## Event: account_confirmation
### Request Example
```json
{
"user": {
"id": "VXNlcjo2OA==",
"email": "test@example.com1",
"first_name": "",
"last_name": "",
"is_staff": false,
"is_active": false,
"private_metadata": {},
"metadata": {},
"language_code": "en"
},
"recipient_email": "test@example.com1",
"token": "ajcv09-f3f7880d4a5e33657fe12f9cc372a23f",
"confirm_url": "https://dev.saleor.cloud/account-confirm?email=test%40example.com1&token=ajcv09-f3f7880d4a5e33657fe12f9cc372a23f",
"domain": "example.com",
"site_name": "Saleor e-commerce"
}
```
```
--------------------------------
### Example Organization Structure
Source: https://github.com/saleor/saleor-docs/blob/main/docs/cloud/overview.mdx
Illustrates how organizations and projects can be structured within Saleor Cloud for managing multiple stores and environments.
```text
Organization: ACME Inc
├── Project: ACME US Store
│ ├── Sandbox Dev
│ ├── Sandbox Staging
│ └── Production
├── Project: ACME EU Store
│ ├── Sandbox
│ └── Production
Organization: Freelance Playground
└── Project: Side Hustle Store
└── Sandbox
```
--------------------------------
### ORDER_FILTER_SHIPPING_METHODS Request Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/webhooks/synchronous-events/shipping.mdx
Example request payload for filtering shipping methods for an order.
```APIDOC
## ORDER_FILTER_SHIPPING_METHODS Request Example
### Description
Example request payload for filtering shipping methods for an order.
### Request Body
- **order** (object) - Required - The order object.
- **type** (string) - Required - Type of the object, should be "Order".
- **id** (string) - Required - The unique identifier for the order.
- **channel** (object) - Required - The channel associated with the order.
- **type** (string) - Required - Type of the object, should be "Channel".
- **id** (string) - Required - The unique identifier for the channel.
- **slug** (string) - Required - The slug of the channel.
- **currency_code** (string) - Required - The currency code of the channel.
- **shipping_method** (object | null) - Optional - The selected shipping method.
- **payments** (object | null) - Optional - The payments associated with the order.
- **shipping_address** (object) - Required - The shipping address for the order.
- **type** (string) - Required - Type of the object, should be "Address".
- **id** (string) - Required - The unique identifier for the address.
- **first_name** (string) - Required - The first name of the recipient.
- **last_name** (string) - Required - The last name of the recipient.
- **company_name** (string) - Optional - The company name.
- **street_address_1** (string) - Required - The first line of the street address.
- **street_address_2** (string) - Optional - The second line of the street address.
- **city** (string) - Required - The city.
- **city_area** (string) - Optional - The city area.
- **postal_code** (string) - Required - The postal code.
- **country** (string) - Required - The country code (e.g., "PL").
- **country_area** (string) - Optional - The country area.
- **phone** (string) - Optional - The phone number.
- **billing_address** (object) - Required - The billing address for the order.
- **type** (string) - Required - Type of the object, should be "Address".
- **id** (string) - Required - The unique identifier for the address.
- **first_name** (string) - Required - The first name of the recipient.
- **last_name** (string) - Required - The last name of the recipient.
- **company_name** (string) - Optional - The company name.
- **street_address_1** (string) - Required - The first line of the street address.
- **street_address_2** (string) - Optional - The second line of the street address.
- **city** (string) - Required - The city.
- **city_area** (string) - Optional - The city area.
- **postal_code** (string) - Required - The postal code.
- **country** (string) - Required - The country code (e.g., "PL").
- **country_area** (string) - Optional - The country area.
- **phone** (string) - Optional - The phone number.
- **discounts** (object | null) - Optional - Discounts applied to the order.
- **original** (string) - Optional - Identifier for the original order.
- **lines** (array) - Required - The list of items in the order.
- **fulfillments** (array) - Required - The list of fulfillments for the order.
- **collection_point** (object | null) - Optional - The collection point for the order.
- **meta** (object) - Required - Metadata about the order.
- **issued_at** (string) - Required - Timestamp when the order was issued.
- **version** (string) - Required - The version of the Saleor API.
- **issuing_principal** (object) - Required - Information about the principal issuing the order.
- **id** (string | null) - Optional - The ID of the issuing principal.
- **type** (string | null) - Optional - The type of the issuing principal.
- **private_metadata** (object) - Required - Private metadata for the order.
- **metadata** (object) - Required - Public metadata for the order.
- **created** (string) - Required - Timestamp when the order was created.
- **status** (string) - Required - The status of the order.
- **user_email** (string) - Optional - The email address of the user.
- **origin** (string) - Required - The origin of the order.
- **shipping_method_name** (string | null) - Optional - The name of the shipping method.
- **collection_point_name** (string | null) - Optional - The name of the collection point.
- **shipping_price_net_amount** (string) - Required - The net amount of the shipping price.
- **shipping_price_gross_amount** (string) - Required - The gross amount of the shipping price.
- **shipping_tax_rate** (string) - Required - The tax rate for shipping.
- **token** (string) - Required - The token associated with the order.
- **total_net_amount** (string) - Required - The total net amount of the order.
- **undiscounted_total_net_amount** (string) - Required - The undiscounted total net amount.
- **total_gross_amount** (string) - Required - The total gross amount of the order.
- **undiscounted_total_gross_amount** (string) - Required - The undiscounted total gross amount.
- **weight** (string) - Required - The total weight of the order.
- **shipping_methods** (array) - Required - A list of available shipping methods to filter.
- **id** (string) - Required - The unique identifier for the shipping method.
- **price** (string) - Required - The price of the shipping method.
- **currency** (string) - Required - The currency of the shipping method's price.
- **name** (string) - Required - The name of the shipping method.
- **maximum_order_weight** (string) - Optional - The maximum order weight the shipping method supports.
- **minimum_order_weight** (string) - Optional - The minimum order weight the shipping method supports.
- **maximum_delivery_days** (integer) - Optional - The maximum number of delivery days.
- **minimum_delivery_days** (integer) - Optional - The minimum number of delivery days.
### Request Example
```json
{
"order": {
"type": "Order",
"id": "T3JkZXI6Mjkz",
"channel": {
"type": "Channel",
"id": "Q2hhbm5lbDo1Njk=",
"slug": "main",
"currency_code": "USD"
},
"shipping_method": null,
"payments": null,
"shipping_address": {
"type": "Address",
"id": "QWRkcmVzczoxMzQz",
"first_name": "John",
"last_name": "Doe",
"company_name": "Mirumee Software",
"street_address_1": "T\u0119czowa 7",
"street_address_2": "",
"city": "WROC\u0141AW",
"city_area": "",
"postal_code": "53-601",
"country": "PL",
"country_area": "",
"phone": "+48713988102"
},
"billing_address": {
"type": "Address",
"id": "QWRkcmVzczoxMzQz",
"first_name": "John",
"last_name": "Doe",
"company_name": "Mirumee Software",
"street_address_1": "T\u0119czowa 7",
"street_address_2": "",
"city": "WROC\u0141AW",
"city_area": "",
"postal_code": "53-601",
"country": "PL",
"country_area": "",
"phone": "+48713988102"
},
"discounts": null,
"original": "T3JkZXI6Tm9uZQ==",
"lines": [],
"fulfillments": [],
"collection_point": null,
"meta": {
"issued_at": "2022-02-20T21:17:38.766493+00:00",
"version": "dev",
"issuing_principal": {
"id": null,
"type": null
}
},
"private_metadata": {},
"metadata": {},
"created": "2022-02-20T21:17:38.760Z",
"status": "unfulfilled",
"user_email": "test@example.com",
"origin": "checkout",
"shipping_method_name": null,
"collection_point_name": null,
"shipping_price_net_amount": "0.00",
"shipping_price_gross_amount": "0.00",
"shipping_tax_rate": "0.0",
"token": "b449194f-cf9c-4269-9d73-fdfa4534a140",
"total_net_amount": "0.00",
"undiscounted_total_net_amount": "0.00",
"total_gross_amount": "0.00",
"undiscounted_total_gross_amount": "0.00",
"weight": "0.0:kg"
},
"shipping_methods": [
{
"id": "U2hpcHBpbmdNZXRob2Q6MTIz",
"price": "10.59",
"currency": "USD",
"name": "shipping",
"maximum_order_weight": "10.0:kg",
"minimum_order_weight": "1.0:g",
"maximum_delivery_days": 10,
"minimum_delivery_days": 2
}
]
}
```
```
--------------------------------
### Run Saleor ASGI Application
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/telemetry.mdx
Start the Saleor ASGI application using uvicorn. Telemetry is initialized as part of the application startup.
```bash
uvicorn saleor.asgi:application
```
--------------------------------
### CHECKOUT_FILTER_SHIPPING_METHODS Request Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/webhooks/synchronous-events/shipping.mdx
Example request payload for filtering shipping methods for a checkout.
```APIDOC
## CHECKOUT_FILTER_SHIPPING_METHODS Request Example
### Description
Example request payload for filtering shipping methods for a checkout.
### Request Body
- **checkout** (object) - Required - The checkout object.
- **type** (string) - Required - Type of the object, should be "Checkout".
- **id** (string) - Required - The unique identifier for the checkout.
- **channel** (object) - Required - The channel associated with the checkout.
- **type** (string) - Required - Type of the object, should be "Channel".
- **id** (string) - Required - The unique identifier for the channel.
- **slug** (string) - Required - The slug of the channel.
- **currency_code** (string) - Required - The currency code of the channel.
- **user** (object | null) - Optional - The user associated with the checkout.
- **billing_address** (object | null) - Optional - The billing address for the checkout.
- **shipping_address** (object | null) - Optional - The shipping address for the checkout.
- **shipping_method** (object | null) - Optional - The selected shipping method.
- **warehouse_address** (object | null) - Optional - The warehouse address.
- **lines** (array) - Required - The list of items in the checkout.
- **collection_point** (object | null) - Optional - The collection point for the order.
- **meta** (object) - Required - Metadata about the checkout.
- **issued_at** (string) - Required - Timestamp when the checkout was issued.
- **version** (string) - Required - The version of the Saleor API.
- **issuing_principal** (object) - Required - Information about the principal issuing the checkout.
- **id** (string | null) - Optional - The ID of the issuing principal.
- **type** (string | null) - Optional - The type of the issuing principal.
- **private_metadata** (object) - Required - Private metadata for the checkout.
- **metadata** (object) - Required - Public metadata for the checkout.
- **created** (string) - Required - Timestamp when the checkout was created.
- **last_change** (string) - Required - Timestamp of the last change to the checkout.
- **email** (string) - Optional - The email address of the user.
- **currency** (string) - Required - The currency of the checkout.
- **discount_amount** (string) - Required - The total discount amount.
- **discount_name** (string | null) - Optional - The name of the discount.
- **shipping_methods** (array) - Required - A list of available shipping methods to filter.
- **id** (string) - Required - The unique identifier for the shipping method.
- **price** (string) - Required - The price of the shipping method.
- **currency** (string) - Required - The currency of the shipping method's price.
- **name** (string) - Required - The name of the shipping method.
- **maximum_order_weight** (string) - Optional - The maximum order weight the shipping method supports.
- **minimum_order_weight** (string) - Optional - The minimum order weight the shipping method supports.
- **maximum_delivery_days** (integer) - Optional - The maximum number of delivery days.
- **minimum_delivery_days** (integer) - Optional - The minimum number of delivery days.
### Request Example
```json
{
"checkout": {
"type": "Checkout",
"id": "Q2hlY2tvdXQ6dXVpZA==",
"channel": {
"type": "Channel",
"id": "Q2hhbm5lbDox",
"slug": "default-channel",
"currency_code": "USD"
},
"user": null,
"billing_address": null,
"shipping_address": null,
"shipping_method": null,
"warehouse_address": null,
"lines": [],
"collection_point": null,
"meta": {
"issued_at": "2022-02-20T21:18:55.216178+00:00",
"version": "dev",
"issuing_principal": {
"id": null,
"type": null
}
},
"private_metadata": {},
"metadata": {},
"created": "2022-02-20T21:18:55.209Z",
"last_change": "2022-02-20T21:18:55.209Z",
"email": "user@email.com",
"currency": "USD",
"discount_amount": "0.00",
"discount_name": null
},
"shipping_methods": [
{
"id": "U2hpcHBpbmdNZXRob2Q6MTIz",
"price": "10.59",
"currency": "USD",
"name": "shipping",
"maximum_order_weight": "10.0:kg",
"minimum_order_weight": "1.0:g",
"maximum_delivery_days": 10,
"minimum_delivery_days": 2
}
]
}
```
```
--------------------------------
### Build Saleor Core from Source
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/docker-images.mdx
Commands to build the Saleor Core Docker image locally.
```shell
cd saleor
docker build -t .
```
--------------------------------
### Shipping Method Filtering Response Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/webhooks/synchronous-events/shipping.mdx
Example response from the application after filtering shipping methods.
```APIDOC
## Shipping Method Filtering Response Example
### Description
Example response from the application after filtering shipping methods.
### Response
#### Success Response (200)
- **excluded_methods** (array) - A list of shipping methods that were excluded.
- **id** (string) - Required - The unique identifier for the excluded shipping method.
- **reason** (string) - Required - The reason why the shipping method was excluded.
### Response Example
```json
{
"excluded_methods": [
{
"id": "U2hpcHBpbmdNZXRob2Q6MQ==",
"reason": "Same Day Delivery is no longer available."
},
{
"id": "U2hpcHBpbmdNZXRob2Q6MTQ=",
"reason": "Bulky items are not allowed for standard shipping."
}
]
}
```
```
--------------------------------
### Example response for available payment gateways
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/app-store/legacy-plugins/stripe.mdx
A sample JSON response showing the configuration details for Stripe and Dummy gateways.
```json
{
"data": {
"checkout": {
"availablePaymentGateways": [
{
"id": "mirumee.payments.stripe",
"name": "Stripe",
"config": [
{
"field": "api_key",
"value": "pk_test_SkWEusCNFdSgxGGmd23z7JC1FHh3uNufNuX"
},
{
"field": "store_customer_card",
"value": "false"
}
]
},
{
"id": "mirumee.payments.dummy",
"name": "Dummy",
"config": [
{
"field": "store_customer_card",
"value": "false"
}
]
}
]
}
}
}
```
--------------------------------
### POST appCreate
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Creates a new local application in Saleor.
```APIDOC
## POST appCreate
### Description
Creates a new App and returns an authorization token for the app to access the Saleor API.
### Method
MUTATION
### Parameters
#### Request Body
- **name** (String) - Required - The name of the App
- **isActive** (Boolean) - Optional - Whether to activate the App (defaults to true)
- **permissions** (List) - Optional - A list of permissions the App should be granted
### Request Example
mutation {
appCreate(
input: { name: "Order processing service", permissions: [MANAGE_ORDERS] }
) {
authToken
app {
id
name
}
}
}
```
--------------------------------
### Setup ThemeProvider
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/developing-apps/macaw-ui.mdx
Wrap your application with `ThemeProvider` to provide the theme context to all MacawUI components. This is essential for theming.
```tsx
import { ThemeProvider } from "@saleor/macaw-ui";
const App = () => (
);
```
--------------------------------
### Build Saleor Dashboard from Source
Source: https://github.com/saleor/saleor-docs/blob/main/docs/setup/docker-images.mdx
Commands to build the Saleor Dashboard Docker image locally.
```shell
cd saleor-dashboard
docker build -t .
```
--------------------------------
### Create a local App via CLI
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Use the create_app command to register a new local app with specific permissions and an optional target URL for token delivery.
```shell
python manage.py create_app "Order App" \
--permission MANAGE_USERS \
--permission MANAGE_ORDERS \
--target-url https://your-order-app/your-register-endpoint/
```
--------------------------------
### Query Ongoing App Installations
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/apps/installing-apps.mdx
Fetches a list of ongoing and failed app installations. Requires the MANAGE_APPS permission.
```graphql
{
appsInstallations {
id
status
appName
}
}
```
```json
{
"data": {
"appsInstallations": [
{
"id": "QXBwT25nb2luZ0luc3RhbGxhdGlvbjoy",
"status": "FAILED",
"appName": "Shipping App"
},
{
"id": "QXBwT25nb2luZ0luc3RhbGxhdGlvbjoz",
"status": "PENDING",
"appName": "Order App"
}
]
}
}
```
--------------------------------
### appInstall Mutation
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-reference/apps/mutations/app-install.mdx
Use this mutation to initiate the installation of an app using the provided manifest input.
```graphql
appInstall(
input: AppInstallInput!
): AppInstall
```
--------------------------------
### appRetryInstall
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-reference/apps/mutations/app-retry-install.mdx
Retry failed installation of new app. Requires MANAGE_APPS permission. Triggers APP_INSTALLED webhook event.
```APIDOC
## POST /appRetryInstall
### Description
Retry failed installation of new app.
### Method
POST
### Endpoint
/appRetryInstall
### Parameters
#### Query Parameters
- **activateAfterInstallation** (Boolean) - Optional - Determine if app will be set active or not.
- **id** (ID!) - Required - ID of failed installation.
### Request Example
```json
{
"activateAfterInstallation": true,
"id": "app-id-123"
}
```
### Response
#### Success Response (200)
- **errors** (AppError!) - List of errors.
- **appInstallation** (AppInstallation) - Details of the app installation.
#### Response Example
```json
{
"errors": [],
"appInstallation": {
"id": "app-installation-id-456",
"status": "INSTALLING"
}
}
```
```
--------------------------------
### Webhook Dry Run Response Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/webhooks/overview.mdx
This is an example of a successful response from the webhookDryRun mutation, showing the generated payload.
```json
{
"data": {
"webhookDryRun": {
"payload": "{\"__typename\": \"ProductUpdated\", \"product\": {\"id\": \"UHJvZHVjdDoxNTI=\", \"name\": \"Apple Juice\", \"description\": \"{\\\"time\\\": 1653425438149, \\\"blocks\\\": [{\\\"id\\\": \\\"rGR983yNVl\\\", \\\"data\\\": {\\\"text\\\": \\\"Fell straight from the tree, on to Newton\\\\u2019s head, then into the bottle. The autumn taste of English apples. Brought to you by gravity.\\\"}, \\\"type\\\": \\\"paragraph\\\"}], \\\"version\\\": \\\"2.22.2\\\"}}"}}",
"errors": [],
"__typename": "WebhookDryRun"
}
}
}
```
--------------------------------
### GraphQL Query Response Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-usage/metadata.mdx
This is an example of a successful JSON response from a GraphQL query that filters products by metadata.
```json
{
"data": {
"products": {
"edges": [
{
"node": {
"id": "UHJvZHVjdDoxNDA=",
"name": "Super Shirt"
}
}
]
}
}
}
```
--------------------------------
### Order Payload Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/webhooks/subscription-webhook-payloads.mdx
This is an example of an order payload that might be sent with a webhook. It includes order and line item details.
```json
{
"id": "T3JkZXI6YzhmY2FjMTgtMWQ5Yy00NWRkLTgxMGYtMGIzMTJiYTNjZDYz",
"lines": [
{
"id": "T3JkZXJMaW5lOjkzYTFjZGMxLTQxMzAtNDE4ZC05YTAxLTQyY2I5N2E3ZjIxMw=="
}
]
}
```
--------------------------------
### Metadata Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/api-reference/miscellaneous/scalars/metadata.mdx
Illustrates the structure of metadata as a map of string key-value pairs. Use this format when providing or expecting metadata.
```json
{
"key1": "value1",
"key2": "value2"
}
```
--------------------------------
### Synchronous Webhook Payload Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/webhooks/subscription-webhook-payloads.mdx
An example of a payload for a synchronous webhook that uses a subscription query, specifically for a payment capture event.
```APIDOC
## Synchronous Webhook Payload Example
### Description
An example of a payload for a synchronous webhook that uses a subscription query, specifically for a payment capture event.
### Response Example
```json
{
"payment": {
"id": "UGF5bWVudDoyNDE=",
"created": "2022-08-03T08:52:04.202449+00:00"
}
}
```
```
--------------------------------
### Asynchronous Webhook Payload Example
Source: https://github.com/saleor/saleor-docs/blob/main/docs/developer/extending/webhooks/subscription-webhook-payloads.mdx
This is an example of a payload that might be received by an asynchronous webhook configured with a subscription query for product updates.
```APIDOC
## Asynchronous Webhook Payload Example
### Description
This is an example of a payload that might be received by an asynchronous webhook configured with a subscription query for product updates.
### Response Example
```json
{
"product": {
"id": "UHJvZHVjdDo3Ng==",
"name": "Coconut Juice"
}
}
```
```