Stripe, MongoDB and Klaviyo: Payment-to-Profile Sync Template
When a Stripe charge succeeds, this Spojit template records the payment in MongoDB and updates the matching Klaviyo profile so purchase history can drive your segmentation.
What It Builds
A Webhook trigger receives the successful-charge event that Stripe sends to Spojit. A Connector node on the mongodb connector inserts the charge into a payments collection for your records, and a second Connector node on the klaviyo connector finds the customer's profile by email and updates it with the latest purchase. The result is a durable payment log plus an always-current Klaviyo profile that your campaigns and flows can segment on.
The Prompt
Paste this into Miraxa and it builds the workflow, connecting the tools for you:
Build a workflow that triggers on a Stripe webhook for a successful charge. Insert the charge into a MongoDB collection called payments with the charge id, amount, currency, customer email, and timestamp. Then look up the matching Klaviyo profile by that customer email and update it with the latest purchase amount and purchase date so the profile can be used for segmentation.
Connectors Used
- Stripe (Webhook trigger) - sends the successful-charge event into Spojit, verified by a signing connection.
- mongodb -
insert-documentswrites the charge into yourpaymentscollection. - klaviyo -
get-profileorlist-profilesfinds the profile by email, andupdate-profilewrites the new purchase data.
Customize It
Change the collection name (payments) and which fields you store in the prompt to match your reporting needs. You can also adjust the Klaviyo profile properties you set (for example add lifetime value or order count) or point the lookup at a different identifier such as a customer id rather than email. If you want a marketing event in Klaviyo as well, ask the workflow to also record the purchase as a Klaviyo event.
Tips
- Use Direct mode on each Connector node here: the steps are predictable single-tool calls, so you avoid AI credit cost and get deterministic field mapping.
- Set up the Stripe webhook against a signing connection so Spojit verifies each event by HMAC before it runs. Reference the parsed body with
{{ input }}when mapping fields. - If no Klaviyo profile matches the email, have the workflow create one with
create-profileso first-time payers are still captured for segmentation.
Related
- How to Sync Purchase Data to Klaviyo for Personalization walks the Klaviyo side step by step.
- How to Reconcile Shopify Orders with Stripe Charges covers working with Stripe charge data.
- How to Sync Customer Data Between Shopify and Klaviyo is a sibling profile-sync pattern.