Overview
This article will walk you through integrating Stripe with Klaviyo. After enabling Klaviyo's Stripe integration, you'll be able to personalize and target emails based on invoice and payment data from your customers.
You'll set up the Stripe integration in two steps. First, you'll connect Stripe by enabling the integration in Klaviyo. Then you set up webhooks in Stripe which will enable a real-time sync of specific Stripe data into Klaviyo.
Here's the data we sync from Stripe:
- When an invoice is issued, and the items included in each invoice
- Payment information for when a user fails payment, is refunded, or successfully pays
Enable the Stripe Integration in Klaviyo
From Klaviyo, select the Integrations tab on the left-hand sidebar. Navigate to the All Integrations tab and find Stripe on the list of available integrations. Click Add Integration.
Check the box next to Sync Stripe test data if you want Klaviyo to sync both your live data and your test data. Otherwise, we will always sync your live data.
Click Connect to Stripe.
This will bring you to Stripe's website to authorize access. Once you authenticate with Klaviyo, you will be brought back to Klaviyo's Stripe integration page.
Click Connect my Stripe account.
Your page will reload, and you'll see confirmation that your integration has been updated. Now we'll setup your Stripe webhooks, which will enable you to sync your Stripe data in real-time.
In the Instructions section, copy the URL. Make note of this URL because you'll paste it into Stripe in the next step.
Head back over to Stripe to complete the integration.
Setting up Stripe Webhooks
You'll now create webhooks for each type of data you'd like to sync to Klaviyo in real-time.
In your Stripe account, navigate to the Developers tab. Then select Webhooks.
Select Add endpoint.
Fill in these fields:
- Endpoint URL: paste the URL you just copied from Klaviyo.
- Version: select the latest API version.
- Events to send: Klaviyo requires charge and invoice data points.
In the Events to send dropdown, select all of the charge and invoice events. You can optionally omit all charge.dispute events. For brevity, the gif below demonstrates the selection of several charge and invoice events.
This is a complete list of the events you should create endpoints for:
- charge.captured
- charge.expired
- charge.failed
- charge.pending
- charge.refunded
- charge.succeeded
- charge.updated
- invoice.created
- invoice.deleted
- invoice.finalized
- invoice.marked_uncollectible
- invoice.payment_action_required
- invoice.payment_failed
- invoice.payment_succeeded
- invoice.sent
- invoice.upcoming
- invoice.updated
- invoice.voided
After you've selected all charge and invoice events, select Add endpoint.
You'll receive confirmation that your webhooks are enabled.
Your Stripe integration is now enabled.
Verify Stripe Webhooks
Now you'll verify your webhooks by entering your Stripe webhook secret key into Klaviyo. This will add an extra measure of security to your Stripe integration.
Head back to Stripe and navigate to Developers > Webhooks. Then click on the Klaviyo URL.
Click to reveal the signing secret. Then copy the signing secret and head back over to Klaviyo.
Within your Stripe integration settings, paste the signing secret.
Click Update Stripe settings.
Monitor the Stripe Sync & Verify Synced Data
To check on your enabled integration, navigate to the Analytics tab in your account and click into Metrics.
Find Stripe's Issued Invoice metric and click on the Activity Feed icon.
If your integration has begun syncing data, you will start to see invoices issued through Stripe populate here. Once the Stripe integration has a green border next to it in your Klaviyo account's Integrations tab, your integration is fully synced.
Klaviyo imports all of your Stripe data. To verify this, you can compare the number of successful payments on a particular day with what's in the Stripe interface and confirm they match. Navigate to your Klaviyo account's Analytics tab and click into Metrics, find the Successfully Paid metric, and click on it. This will take you to the metric chart page and will show the last 30 days of data by default.
Mouse over yesterday's data point, or look in the table of data below the chart, to see how many payments you had yesterday. Compare that number to what's stored in Stripe and you should see they match exactly.
The Stripe Metrics
Failed Payment
This metric records an event every time a payment being made through Stripe is marked as failed. With this metric, you can target customers who fail making a payment to let them know they have an overdue balance. You can filter and target Failed Payment events based on the following criteria:
- AttemptCount: The number of times this invoice attempted to charge the user
- Currency: The currency of the invoice failed to be paid, e.g., USD, GBP
- Invoice: The invoice this failed payment is attributed to
- Reason: The reason in Stripe this payment failed, e.g., Your card has expired, Your card was declined
Issued Invoice
This metric records an event every time an invoice is issued to your customers through Stripe. This metric is useful for segmenting on customers who have been issued an invoice but have either not paid or had a payment fail. It can also be used to trigger segments to notify customers of an upcoming payment.
Refunded Payment
This metric records an event when you refund a payment through Stripe. You can filter and target Refunded Payment events based on the following criteria:
- Amount: The value of the payment that was refunded
Successfully Paid
This metric records an event each time a customer successfully pays an invoice through Stripe. These events will include data about your customer, their invoice, and the products in their invoice. This is useful for sending automated invoices to customers after they pay, or using email flows to determine when a customer has been active on your website but hasn't made any payments for your products or services. You can send those users emails offering discounts to make a purchase on your website. You can filter and target Successfully Paid events based on the following criteria:
- Currency: The currency of the invoice paid, e.g., USD or GBP
- Invoice: The invoice this payment is tied to in Stripe
Customer Data
Klaviyo uniquely identifies each individual by their email address. If Stripe syncs over customer data that has an email address that is not yet in Klaviyo, Klaviyo will create a new profile consisting of the customer's email address and associated Stripe metrics. Credit card expiration dates are stored as a custom property in a customer's profile.
Stripe Integration Troubleshooting
I am not seeing all activity in Stripe sync to Klaviyo.
The most common reason why a Stripe event won't sync to Klaviyo is because there is no email address associated with the event. Klaviyo uses an email address to uniquely identify a person. Because of this, Klaviyo can’t create a profile for someone who is not associated with an email address. Likewise, Klaviyo can’t link an event to a profile if it is not associated with an email address.
Keep in mind that first name/last name inputs are not necessarily consistent or unique, so we don’t create profiles based on this information alone. Doing so would lead to duplicates and inaccurate tracking.
Use Stripe Data in Klaviyo
Any Stripe metric or metadata can be used to trigger a flow in Klaviyo.
Automated Invoices
Send out invoice receipts to your customers automatically after they make a payment. Trigger an Invoice flow triggered by Stripe's Successfully Paid metric.
You can create a flow email that displays dynamic payment details using template tags that reference Stripe payment attributes.
For more information on embedding dynamic data into an email template, see: Template Tags and Variable Syntax
Stripe Failed Payments Flow
Alert your customers of a failed payment with an automated flow. This flow is triggered by the Stripe Failed Payment metric.