This app integrates Saleor with Klarna payment gateway.
Required Saleor version: 3.15
[!NOTE] This is an example implementation. Only community support is available.
Node.js 20
pnpm 8.14.2
You need to have a Klarna playground account to run this app. You can create one here.
.env.example
to .env
and fill in the required values.pnpm install
[!IMPORTANT] The app needs to be tunneled in local development.
To run the app on port 3000, use the following command:
pnpm dev
Each time you modify a .graphql
file, you have to run:
pnpm generate
to regenerate the GraphQL types.
This app comes with a simple storefront example. To run it, follow these steps:
.env.example
to .env
and fill in the required values.pnpm install
pnpm dev
Each time you modify a .graphql
file, you have to run:
pnpm generate
The app implements the Hosted Payment Page flow through a custom Klarna API client. The client is located in generated/klarna.ts
.
checkoutCreate
mutation from the front-end.transactionInitialize
mutation from the front-end. In the app, the transaction-initialize-session.ts
handler creates a session in Klarna. Depending on the chosen TransactionFlowStrategyEnum
, it will respond with either AUTHORIZATION_ACTION_REQUIRED
or CHARGE_ACTION_REQUIRED
. transaction-initialize-session
returns the data
needed to render the Klarna component.transactionProcess
mutation from the front-end. In the app, the transaction-process-session.ts
handler creates an order in Klarna.You will need to provide the following configuration:
Now, save the configuration and assign it to the channel you want to use it with.