Klaviyo, Stripe and MySQL: Subscriber Spend Sync Template
Each night this Spojit template pulls customer spend from Stripe, writes lifetime totals to MySQL, and updates Klaviyo profiles so your segments reflect real value.
What It Builds
A Schedule trigger fires on a nightly cron and the workflow lists customers, charges, and invoices from Stripe, totals the lifetime spend per customer, then writes those totals to a table in MySQL with Connector nodes. A final Connector node on Klaviyo updates each matching profile with its spend so your high-value and lapsed segments stay accurate without manual exports. The result is a reporting table you can query and a refreshed set of profile properties that power Klaviyo segmentation.
The Prompt
Paste this into Miraxa, the intelligent layer across your automation, and it builds the workflow and connects the tools for you:
Build a workflow that runs every night at 2am Australia/Sydney time. List customers and their charges from Stripe, total each customer's lifetime spend, and insert or update those totals in a MySQL table called subscriber_spend keyed by email. Then for each customer, find the matching Klaviyo profile by email and update it with a lifetime_spend property so segments reflect lifetime value.
Connectors Used
- Schedule trigger - fires nightly on a 5-field cron with an IANA timezone such as
Australia/Sydney. - Stripe - reads spend with
list-customers,list-charges, andlist-invoices. - MySQL - writes totals with
insert-rowsorupdate-rowsinto your reporting table. - Klaviyo - finds profiles with
get-profileorlist-profilesand writes back withupdate-profile.
Customize It
Change the cron time and timezone to match your reporting window, rename the subscriber_spend table and the lifetime_spend property to match your schema, and adjust which Stripe data you total (charges only, or charges plus invoices). You can also add a threshold so only customers above a spend level are updated in Klaviyo, all by editing the same prompt before you run it.
Tips
- Use Direct mode on the Stripe, MySQL, and Klaviyo nodes for predictable single-tool calls with no AI cost; reserve Agent mode for steps that need judgment.
- Stripe list calls are paginated, so wrap them in a Loop node to walk every page rather than only the first batch.
- Key your MySQL upsert on email so re-runs refresh existing rows instead of duplicating them.
Common Pitfalls
- Match Klaviyo profiles by a stable identifier such as email; mismatched casing or missing profiles will skip updates silently.
- Stripe amounts are in the smallest currency unit (for example cents), so divide before writing a human-readable total.
- Set the cron timezone explicitly; a bare cron runs in UTC and can shift your nightly window.