Introduction
The Close CRM integration creates records in Close from Dodo Payments events. A successful payment can create a contact, and a new subscription can create an opportunity, so your sales team sees revenue activity next to its leads.This integration requires a Close API key with permission to create contacts and opportunities. To create one in Close, go to Settings → Developer → API Keys and click New API Key.
Getting Started
1
Open the Webhook Section
In the Dodo Payments dashboard, go to Developer → Webhooks and click Add endpoint.

2
Select Close CRM
In Integration, select CloseCRM.
3
Enter API Key
In API key, paste your Close API key. Dodo Payments sends it in the
Authorization header of every delivery.4
Select Events
In Subscribed events, select the events your transformation handles. The examples on this page use
payment.succeeded and subscription.active.5
Configure Transformation
Under Transformation code, edit the handler to map payment data to Close objects. 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
Each subscribed event now creates a record in Close.
Transformation Code Examples
Each handler setswebhook.url to a Close API endpoint and replaces webhook.payload with the request body. Close sets custom fields through custom.cf_<field_id> keys, so replace the cf_ keys in the examples with the IDs of your own custom fields. Dodo Payments amounts are in the smallest currency unit, for example cents for USD.
Create Contact from Payment
When a payment succeeds, create a contact. Close takesemails and phones as lists of objects. If the request has no lead_id, Close creates a new lead named after the contact.
create_contact.js
Create Opportunity from Subscription
When a subscription becomes active, create an opportunity. Close takesvalue as an integer in cents and value_period as one_time, monthly, or annual, so the example maps the subscription’s payment_frequency_interval to a period. lead_id must be a Close lead ID, not a Dodo Payments customer ID. The example reads it from the subscription’s metadata, so store the lead ID there when you create the subscription. Without a lead_id, Close creates a new, untitled lead.
create_opportunity.js
Tips
- Check field names and types in the Close API documentation before you map fields.
- Store payment-specific data, such as the amount and payment method, in custom fields. Create the fields in Close first, then use their IDs.
- Map the subscription’s
recurring_pre_tax_amountto the opportunityvalue, and its billing interval tovalue_period. - Use IDs to link records: store the Dodo Payments
customer_idon the Close contact, and the Close lead ID in the Dodo Paymentsmetadata. - The contact example runs on every
payment.succeeded, including renewals and repeat purchases, so a returning customer creates another contact.
Troubleshooting
Records Not Created in Close CRM
Records Not Created in Close CRM
- Verify that the API key has write permissions.
- Check that the required fields are included.
- Check that each email address is valid.
- Review the Close API rate limits.
- If deliveries fail with a
401, Close may expect Basic authentication. Adjust theAuthorizationheader on the endpoint’s Advanced tab. - Open the endpoint’s delivery attempts in the Logs tab of Developer → Webhooks to see the response from Close.
Transformation Errors
Transformation Errors
- Check that the payload matches the Close API format.
- Check that all required fields are present.
- Check that field names match the Close schema exactly, and that custom fields use
custom.cf_IDs.