Prerequisite You should have a Stripe account and administrative access to your Growi dashboard.

How to Set Up Stripe with Growi

In a few simple steps, you can set up Growi with your Stripe integration to track affiliates. We also have an open-source example here.

1. Authenticate Your Stripe Account with Growi

Navigate to the “Settings” tab, then the “Integrations & Socials” section, and finally click “Install Now” on the Stripe integration.

2. Add Our Tracking Script

Add the following script to your app:

<script
  async
  src="https://cdn.growi.io/growi.js"
  data-growi="{YOUR_PUBLIC_GROWI_ID}"
/>

You can get your “Public Growi ID” from the dashboard on the “Integrations & Socials” page.

3. Send Affiliate Code to Stripe

The tracking script will capture users navigating to your site with affiliate parameters and save them to window.growi.affiliate_code. You must pass the affiliate code to the Stripe metadata using the growi_affiliate_code key.

Example: Payment Link

const paymentLink = await stripe.paymentLinks.create({
  line_items: [
    {
      price: "price_nj8h23ud",
      quantity: 1,
    },
  ],
  metadata: {
    growi_affiliate_code: window.growi.affiliate_code,
  },
});

Example: Checkout Session

const paymentLink = await stripe.checkout.sessions.create({
  line_items: [
    {
      price: "price_nj8h23ud",
      quantity: 1,
    },
  ],
  metadata: {
    growi_affiliate_code: window.growi.affiliate_code,
  },
  mode: "subscription",
});

React Example For those using React, we have a repository demonstrating our Stripe integration: React Stripe Integration Example.

Troubleshooting

Here’s how to solve some common problems when setting up Stripe with Growi.