Introduction
The Customer.io integration sends Dodo Payments events to Customer.io’s Track API, so payments and subscription changes can trigger campaigns and customer journeys. For example, a new customer can receive a welcome email, a subscription change can send an update, and a failed payment can send a notification.This integration requires your Customer.io Site ID and API key. The Track API uses HTTP Basic authentication, with the Site ID as the username and the API key as the password.
Getting Started
1
Open the Webhook Section
In the Dodo Payments dashboard, go to Developer → Webhooks and click Add endpoint.

2
Select Customer.io
In Integration, select CustomerIO.
3
Enter Credentials
In API key, paste your Customer.io API key. Dodo Payments sends the key in the
Authorization header as a bearer token.The Track API expects Basic authentication. If deliveries fail with a 401, open the endpoint’s Advanced tab and replace the Authorization header with Basic followed by the Base64 encoding of site_id:api_key.4
Select Events
In Subscribed events, select the events your transformation handles. The examples on this page use
payment.succeeded, subscription.active, and subscription.cancelled.5
Configure Transformation
Under Transformation code, edit the handler to format events for Customer.io’s Track API. Start from the examples.
6
Test & Create
Under Test this code, click Simulate to run the handler against a sample payload. Then click Create endpoint.
7
Done
Subscribed events now reach Customer.io, where they can trigger your email automations.
Transformation Code Examples
Each handler sends one request to the Track API v2entity endpoint and identifies the person by their Dodo Payments customer_id. To record an event, the request sets action to event and puts the event name in name. To update a person’s attributes, it sets action to identify. Dodo Payments amounts are in the smallest currency unit, so the examples divide by 100.
Track Payment Events
Record apayment_completed event when a payment succeeds:
track_payments.js
Track Subscription Lifecycle
Record asubscription_started event when a subscription becomes active, and a subscription_cancelled event when it’s cancelled:
track_subscriptions.js
Track Customer Attributes
Update the person’s profile attributes when a payment succeeds. Eachidentify request overwrites the attributes it sends, so last_payment_amount and last_payment_date always hold the latest payment.
track_attributes.js
Tips
- Use the same event names in the transformation and in your Customer.io campaign triggers, for example
payment_completed. Choose names that describe what happened. - Include the attributes your messages use for personalization.
- Identify each person by the same ID in every request. The examples use the Dodo Payments
customer_id. - For every request field, see the Customer.io Track API reference.
Troubleshooting
Events Not Triggering Campaigns
Events Not Triggering Campaigns
- Verify that the Site ID and API key are correct.
- If deliveries fail with a
401, set theAuthorizationheader to Basic authentication, as described in Getting Started. - Check that event names match your Customer.io campaign triggers.
- Check that customer identifiers are set.
- Review the Customer.io API rate limits.
Transformation Errors
Transformation Errors
- Check that the payload matches the Customer.io API format.
- Check that all required fields are present, and that
actionis an action the Track API supports, such aseventoridentify. - Check that event names and attributes are formatted correctly.