Building products is hard, before you even touch the business side and start taking payments.
There comes a point in every product's cycle when you need to start processing payments. Simple, right? Except what usually happens is you end up with a half-finished implementation that just about gets you by while you try to focus on shipping the product features people are paying for.
Here’s where Sailhouse makes things ridiculously easy. Let’s dive into using Sailhouse to seamlessly and effortlessly handle Stripe events in a way that scales as your product does.
The Stripe integration
Sailhouse is a platform built on pragmatic decisions, and with that useful features. As part of our beta offering, we're building out a fully-fledged Stripe integration to make it even easier for you to get your product and payments off the ground.
Building a webhook to receive Stripe events itself is pretty straightforward, but the proper distribution — while maintaining verification — is a job for an events platform. Here’s where Sailhouse comes in.
Enabling the integration
Log in to your Sailhouse account and head over to your dashboard.
- Create a topic to receive your events, for example,
stripe-events
- Enable the Stripe integration by navigating to Apps >
your-app
> Integrations, and select your newstripe-events
topic - Copy the endpoint provided, navigate to Stripe, and create a new Webhook, selecting all available events
- Take the secret from Stripe, and save it in the Sailhouse integration settings to activate the endpoint
Now, every single event on Stripe is sent to and handled on Sailhouse.
Wait a minute, that's noisy, surely?
Ah-ha! You fell into our pricing trap. (Just kidding, the beta is currently free to use under our fair use policy 😉.)
But if you’d like to reduce the amount of events received — or drill down into what’s most important, Sailhouse has got you covered with Subscription Filters.
Instead of building custom logic to handle Stripe events, verify webhooks, and distribute that information in your code, you can add a subscription filter on your Stripe events — as with any other event on Sailhouse.
For example, you can create an invoice-paid
subscription, which filters on Stripe event type
for invoice.paid
. You can also set up Slack notifications for any invoice.payment_failed
events thanks to the Sailhouse Slack integration!
Handling Stripe events
You can handle your Stripe events in Sailhouse just like any other event. Here are some examples.
You could configure a push subscription:
subscriptions:
- slug: invoice-paid
topic: stripe-events
type: push
endpoint: https://acme-inc.com/api/invoice-paid
filter:
path: type
value: invoice.paid
Or handle the event in your code.
const { events } = await client.getEvents("stripe-events", "customer-created");
for (const event of events) {
// Do useful thing
await event.ack();
}
Let us know what you’re building!
This is just the start of a whole suite of awesome integrations, and we can't wait to see what you make with them.
Come show off what you're building in the official Sailhouse Discord, or tag us on Twitter.
Happy Sailing!
Top comments (0)