Skip to content

Latest commit

 

History

History
85 lines (53 loc) · 3.37 KB

README.md

File metadata and controls

85 lines (53 loc) · 3.37 KB

Checkout App

Saleor App for payment gateways configuration and layout customisation of Saleor Checkout

Setup

Development

Start tunnel, so that Checkout App is available from Internet for webhooks:

npx saleor app tunnel 3000

You can also use ngrook, but you would need to update env variables each time you open tunnel (on free plan) with new domain ngrook assigned you The tunnel needs to use https with valid SSL certificate

Create environment variables config file

cp .env .env.local

Edit .env.local file and fill in values for environment variables

  • SALEOR_APP_ID — ID assigned by Saleor after the app was installed
  • SALEOR_APP_TOKEN — App's token generated by Saleor after the app was installed

🚨 Be careful! Don't store SALEOR_APP_ID and SALEOR_APP_TOKEN in your repository - those values are secrets. Leaking those variables would expose access to your Saleor store.

💡 Note: For development environment variables are applied in this order:

  • .env
  • .env.development
  • .env.local

For example: if .env.local has a variable with the same name as in .env.development it will override variable from .env.development

Run the development server:

pnpm dev

Open http://localhost:3000 with your browser to see the result.

Production

To build for production, run the following command:

cd ../.. && pnpm run build:payments-app

Note: The command needs to be run from root of the monorepo. Otherwise Turborepo won't be able to build the app

Env Variables

Environment variables contain secrets that can lead to compromising your store data

When deploying to Vercel you can set them on the configuration page

When running app locally you can use the .env.local file. It should not be included in your git repository.

Backend variables

  • SALEOR_APP_ID — ID assigned by Saleor after the app was installed
  • SALEOR_APP_TOKEN — App's token generated by Saleor after the app was installed
  • SETTINGS_ENCRYPTION_SECRET — Random string used for encrypting apps configuration

To generate a random secret you can use openssl:

openssl rand -hex 256

Learn more about installing third-party apps in Saleor docs

Frontend variables

Each variable starting with NEXT_PUBLIC is exposed to frontend

  • NEXT_PUBLIC_SALEOR_API_URL — URL of your Saleor GraphQL API

Note: by default SALEOR_API_URL env variable from root of monorepo is used for the value. If you want to customise it, you can add a separate .env.local file, which won't be stored in git repository