Alokai
Guide

Setup of the Alokai module

The third part of the setup is installing Stripe integration for commercetools in your Alokai middleware.

yarn add @vsf-enterprise/stripe-commercetools
npm install @vsf-enterprise/stripe-commercetools --save

Since version 2.0.0, the storefront-middleware app uses ESM (ECMAScript Modules). Make sure your integration files use ESM-compatible import/export syntax.

Setup

  1. Add Stripe configuration to your middleware.config.ts
middleware.config.ts
// storefront-middleware/middleware.config.ts
import { config as stripeConfig } from "./integrations/stripe";

export const config = {
  integrations: {
    stripe: stripeConfig,
    // ..
  },
};
  1. Add Stripe configuration file
// storefront-middleware/integrations/stripe/config.ts
export const config = {
  location: "@vsf-enterprise/stripe-commercetools/server",
  configuration: {
    ctApi: {
      apiHost: "https://api.europe-west1.gcp.commercetools.com",
      authHost: "https://auth.europe-west1.gcp.commercetools.com",
      projectKey: "my-project",
      clientId: "***",
      clientSecret: "***",
      scopes: [
        "manage_orders:my-project",
        "manage_payments:my-project",
        "view_orders:my-project",
      ],
    },
    stripe: {
      profile: "stripeProfile1",
    },
  },
};
  • configuration:
    • ctApi - An object containing credentials of your commercetools API client. Please refer to our documentation for commercetools integration for more information. Two notable differences are that:
      • the scopes array must contain manage_orders, manage_payments, and view_orders and your API client must have access to these scopes,
      • apiHost should only contain the base URL, without the path to the GraphQL endpoint. For example, https://<SHOP_DOMAIN>.com/ instead of https://<SHOP_DOMAIN>.com/vsf-ct-dev/graphql.
    • stripe:
      • profile - As prepared by us, Stripe commercetools extension supports multitenancy. This field's value allows to differentiate Stripe merchant accounts.

On this page