2020-02-10 16:14

Send Stripe Events to Sprouted With Zapier

Sending user events to Sprouted from your own site or app is easy and powerful using its API. But did you know you can even hook up Stripe to Sprouted?

Step 1

In order to associate Stripe events to user data in Sprouted you need to tell Sprouted about the customer's Stripe ID. You can pass this ID to Sprouted when you create or update a customer.

Customer update example:

curl --request PUT \
  --url https://app.sprouted.app/api/v1/customers/c-1001 \
  --header 'authorization: Bearer sk_live_key' \
  --header 'content-type: application/json' \
  --data '{
    "customer": {
        "id": "cus_PvVkgGi30r3446A"
    }
}'

Stripe's customer ID cus_PvVkgGi30r3446A is now associated with customer c-1001.

Step 2

Create a new Zap based on Stripe:

New Zap

All you need is a Zapier account and access to your Stripe API key.

Step 3

Choose the event you're interested in:

Failed Payment

In this example we chose the Invoice.Payment Failed event.

Step 4

Choose Zapier's built-in Webhooks app, and select the "Custom Request" action event:

Webhooks

Step 5

Fill in the Sprouted Customer Events API endpoint. Note how Stripe's customer ID is used to reference the customer. Zapier enables you to easily insert such variables using its variables picker user interface.

Post Request

The JSON body is documented in Sprouted's API docs.

Don't forget to set the authorization and content-type headers!

Step 6

Now when a payment failure occurs, you're immediately informed inside Sprouted:

Customer Event

You can email the user to offer assistance straight from the event details.

Happy hacking!

Permalink — Comments or kudos? Find us on Twitter.

Turn user actions into user insights with Sprouted!