BuildShip Logo
BuildShip Community

Stripe Checkout with Metadata

This minimal Stripe checkout template helps you create checkout sessions with metadata, such as user IDs, internal tracking IDs, etc.

107

Report this template

Select the reason for reporting

Describe the issue in detail

Share template

Link to template

https://templates.buildship.com/template/-U9ec982BwDl/

This template contains 2 flows:

Inputs

event

Editor
This is a static example using sample inputs. Remix the template to run it with your own values.

Output

Read me

📖 Stripe Checkout with Metadata

This is a minimal Stripe checkout template you can use as a starting point for creating checkout sessions that include metadata, such as user IDs, internal tracking IDs for your Stripe products, and more.

Prerequisites

  1. A Stripe Account. You can create an account here.
    1. Stripe API key
    2. Stripe product to test with

That's all the requirements 😌

✍️ How to Use

There are two workflows in this template. First, the "Create Checkout With Metadata" workflow, where you'll begin by creating a checkout session with any metadata of your choice. Second, the "Stripe Webhook" workflow, which is triggered whenever a checkout session is completed. Here, you can extract the metadata from the Stripe event and use it in your payment handling logic.

⚙️ Setup:

Create Checkout With Metadata

Step 1. Add you stripe secret key.

Step 2: Test

To test the workflow you need to fill in the two inputs:

  1. lineItems
    1. Enter the line items that you want to create a checkout session for. This is an array of objects. You need to specify the fields price and quantity , i.e:
  2. metadata
    1. You can optionally enter any metadata you want to include in the checkout session. This is passed as an object, i.e:

You are now ready to test the workflow. If all the steps were completed correctly you'll get your checkout session link 🔗:

Step 3: Ship your workflow 🚢

Click the "Ship" button and you're all set. You can now proceed to the final step, where you'll configure the Stripe webhook workflow to listen for Stripe events and consume the checkout session event metadata.

Stripe Webhook

Step 1. Add you stripe secret key.

  1. Go the configuration tab for the trigger
  2. Select or add your Stripe secret key

Step 2: Ship 🚢

Click the "Ship" button. Before testing the workflow and starting to listen for Stripe events, you need to ship your workflow.

Step 3: Test

  1. To test that the webhook is working, you first need to complete a test checkout session. Go to the checkout session URL you obtained from the previous workflow and submit the checkout form (refer to the Stripe docs for how to use test cards).
  2. After that, your webhook workflow should have been triggered. You can verify this by checking the logs, and if you expand the logs for the "Get Event Metadata" node, you'll see the metadata we set in the previous workflow:

🔗 Resources

Any additional information like demo links or YouTube tutorials.