Our Stripe integration lets you:

  • Create and update contacts
  • Send events to trigger cocoonmail

Our Stripe integration is built on top of our Incoming webhooks feature. This system lets you send webhooks from supported platforms directly to Cocoonmail so you can easily sync users and customers as well as send automated emails.

Please read our guide about incoming webhooks

With Stripe, you can sync user data to Cocoonmail for customer and invoice-related events.

We use the email addresses of Stripe customers to match contacts in your Cocoonmail audience. If the email address is not found in Cocoonmail, we will create a new contact.

Supported events

We accept the following events:

  • customer.created
  • customer.updated
  • invoice.paid
  • invoice.payment_failed Stripe webhook docs

If you send other events, they will be ignored.

If you would like to see more events supported, please let us know by sending an email to help@cocoonmail.com. Please keep in mind only events that contain an email address are able to be processed.

Create a webhook endpoint in Cocoonmail

Follow the instructions here to create a new webhook endpoint, which will allow you to send webhook events directly to Cocoonmail.

Create a webhook in Stripe

Next, you need to set up webhooks in Stripe.

Go to Developers and then Webhooks.

Click + Add endpoint. Paste in the endpoint URL from Cocoonmail, then select the event(s) you want to send (see our supported events above).

Click Add endpoint to finish.

The last step is to copy the signing secret into Cocoonmail. On the webhook page in Stripe, click Reveal to show the secret in the page. Copy the secret and paste it into the Stripe secret field in Cocoonmail.

Testing Stripe webhooks

You can test a customer.* webhook by creating a new customer in the Customers page in Stripe.

You can also use the Stripe CLI tool to mimic events, by using the trigger command.

You can see all sent webhooks by going to Developers -> Webhooks and then clicking on an endpoint.

You will see new contacts appear in your Cocoonmail Audience page, and triggered events in the Events page.

Examples

Here are some examples of how you can send data from Stripe to Cocoonmail to sync contacts and trigger useful emails to your customers.

Syncing customers to Cocoonmail

Create or update contacts in your Cocoonmail audience when a customer is created or updated in Stripe.

  1. Create a new Stripe webhook endpoint in Cocoonmail (instructions).
  2. In Stripe, create a new webhook (instructions above) for the customer.created and customer.updated events and paste in your endpoint’s URL.

Send an email to all new Stripe customers

Send an email from Cocoonmail when a new customer is created in Stripe.

  1. Create a new loop in Cocoonmail using our Stripe - New Customer template.
  2. For the loop trigger, select Event received and enter newStripeCustomer (or something similar).
  3. Set up your Stripe webhook endpoint in Cocoonmail (instructions).
  4. In Stripe, create a new webhook (instructions above) for the customer.created event and paste in your endpoint’s URL.
  5. In Cocoonmail, make sure customer.created is checked, and select the event name you chose in Step 2 from the Trigger an event field.

Successful payment email

Send an email from Cocoonmail when an invoice is paid in Stripe.

  1. Create a new loop in Cocoonmail using our Stripe - Payment Successful template.
  2. For the loop trigger, select Event received and enter successfulPayment (or something similar).
  3. Set up your Stripe webhook endpoint in Cocoonmail (instructions).
  4. In Stripe, create a new webhook (instructions above) for the invoice.paid event and paste in your endpoint’s URL.
  5. In Cocoonmail, make sure invoice.paid is checked, and select the event name you chose in Step 2 from the Trigger an event field.

Failed payment email

Send an email from Cocoonmail when an invoice payment fails in Stripe.

  1. Create a new loop in Cocoonmail using our Stripe - Payment Failed template.
  2. For the loop trigger, select Event received and enter failedPayment (or something similar).
  3. Set up your Stripe webhook endpoint in Cocoonmail (instructions).
  4. In Stripe, create a new webhook (instructions above) for the invoice.payment_failed event and paste in your endpoint’s URL.
  5. In Cocoonmail, make sure invoice.payment_failed is checked, and select the event name you chose in Step 2 from the Trigger an event field.