Stripe is now generally available as a new source in Sequin!
You can spin up a Stripe sync today and start building apps with your customer, product, invoice, and subscription tables in your database.
Why sync Stripe?
Since first releasing our Stripe sync in alpha, developers told us they integrated Stripe in one of two ways:
Just-in-time requests
Initially, almost all Stripe integrations start with frequent requests to the Stripe API to confirm subscription or invoice status. These requests increase with growth - and become more complex. Even with the API’s helpful expand
parameter, simple queries begin to require multiple nested API calls. If you scale this enough, eventually lock_timeout
will become the bane of your integration.
Cache
The next logical approach is to reduce load on the API and decrease latency by storing Stripe data locally. Perhaps by caching responses or creating a subscription_status
column on your account
table. But now you have to worry about updating your cache. A webhook handler will help get you most of the way there, but you shouldn’t rely on webhooks exclusively. Stripe’s events endpoint is nice but is subject to eventual consistency.
Billing tables back in your database
With Sequin, you get a real-time, two-way sync between Stripe and your database. Your source of truth for billing information is now in the database you already use.
Let’s compare the process for updating a subscription using the Stripe API versus with Sequin. Assume the application stores the Stripe customer_id
to associate its users with Stripe customers.
In the API, you’ll retrieve the subscription and then update it:
const stripe = require('stripe')('your_stripe_key');
const sub = await stripe.subscriptions.search({
query: 'customer: \'cus_123\'',
});
if (sub.data.length > 0) {
const updated_sub = await stripe.subscriptions.update(
sub.data[0].id,
{metadata: {order_id: '6735'}}
);
}
With Sequin, we see developers make this mutation in one SQL query:
update stripe.subscription
set metadata = {“order_id”: “6735”}
where customer_id = ‘cus_123’;
Build better apps, not just dashboards
Reading and writing to Stripe through your database makes your Stripe integration easier to manage, scale, and customize.
Early users are not just building a simpler integration with Stripe, they are using the power of their database to ship custom billing portals, tailored subscription plans, tools to manage refunds, coupons, and more.
Sync Stripe now
Stripe syncs are available to spin up today. Learn more about how our Stripe syncs work in our docs.