Send Stripe events to Tinybird¶
Stripe is a platform for payments and financial services, and it provides a way to send events to Tinybird using webhooks.
Some common use cases for sending Stripe events to Tinybird include:
- Monitor Stripe events.
- Run analytical workflows based on Stripe events.
- Create custom dashboards based on Stripe events.
- Create alerts and notifications based on Stripe events.
- Join Stripe events with other Data Sources to enrich your user data.
Read on to learn how to send events from Stripe to Tinybird.
Before you start¶
Before you connect Stripe to Tinybird, ensure:
- You have a Stripe account.
- You have a Tinybird Workspace.
Connect Stripe to Tinybird¶
Stripe provides a variety of webhook event types that you can use to send events to Tinybird.
This guide covers the base case for sending Stripe events to Tinybird.
In Stripe, go to Webhooks
Select Add endpoint.
In Tinybird, create a Data Source, called
stripe
with the following schema:
SCHEMA > `id` String `json:$.id`, `object` LowCardinality(String) `json:$.object`, `api_version` LowCardinality(String) `json:$.api_version` DEFAULT '', `date` DateTime `json:$.created`, `type` LowCardinality(String) `json:$.type`, `livemode` Bool `json:$.livemode`, `data` JSON `json:$.data` DEFAULT '{}', `request` JSON `json:$.request` DEFAULT '{}', `account` String `json:$.account` DEFAULT '' ENGINE "MergeTree" ENGINE_PARTITION_KEY "toYYYYMM(date)" ENGINE_SORTING_KEY "type, date"
The data
and request
columns use the JSON Data Type to store the semi-structured data you receive from Stripe webhooks in a single column. You can later retrieve various events and their metadata as needed in your Pipes.
In Tinybird, copy a token with privileges to append to the Data Source you created. You can use the admin token or create one with the required scope.
Back in Stripe, paste the Events API URL in your Webhook Endpoint URL. Use the query parameter
name
to match the name of the Data Source you created in Tinybird.
https://api.tinybird.co/v0/events?name=stripe&format=json&token=<your user token>
Make sure to use the format=json
query parameter.
Replace the Tinybird API hostname or region with the API region that matches your Workspace.
Select Select events and choose the events you want to send to Tinybird.
Save and You're done.
Check the status of the integration by selecting the webhook in Stripe or from the Log tab in the Tinybird stripe
Data Source.