Skip to content

Latest commit

 

History

History

example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

example

The code in this folder is for example purposes only. To run the example on your own, you will need to set up your own Stripe account, and make edits to the example to match your own Stripe information.

client

You will need to the client code using your own Stripe information.

Create your own Stripe pricing table here:

https://dashboard.stripe.com/test/pricing-tables/create

Then, copy the embed script into client/index.html.

To run the local client:

cd client
npm install
npm start

directus

This is an SQLite-backed Directus instance.

Edit directus/.env and configure the "Email" section if you want to send emails.

You'll need the following from Stripe:

  • Your secret key in API keys
  • A webhook secret in Webhooks
    • If deploying remotely, add a hosted endpoint
    • Or run locally with the Stripe CLI:
stripe listen --forward-to http://localhost:8055/flows/trigger/971a67ca-50c7-42f5-88d6-77b24e021b45 --events checkout.session.completed

To run the example Directus instance:

cd directus
npm install
npm start

Log in with [email protected] / password.

You'll need to make the following edits:

  • In Settings > Stripe:

    • Set your Stripe Secret Key (sk_...)
    • Set your Stripe Webhooks > Secret (whsec_...)
  • In Recipes:

    • Set your Stripe Product ID (prod_...)

At this point, you should be able to make purchases on Stripe from the example client, and see the effects on the Directus instance.