Home
>
API Integration
>
Cancellations API Endpoint

Cancellations API Endpoint

When a subscription is canceled in your billing system, you need to notify Churn Buster so that a recovery campaign can be ended (if one is active).

You'll also want to call this API endpoint when a subscription is delayed, rescheduled, or paused, so that Churn Buster won't continue emailing your customer.

  1. Add a trigger in your in-house logic, or subscribe to a webhook from your payment processor or subscription management tool, when subscriptions are canceled, delayed, rescheduled, or paused.
  2. When that trigger occurs or the webhook is received, submit the following API request to Churn Buster.
  3. You can preview your sandbox API requests in the debugger here if using your test-mode API key, or here if using your live-mode API key.
curl -X "POST" "https://api.churnbuster.io/v1/cancellations" \
    -H "Content-Type: application/json" \
    -u "ACCOUNT_ID:API_KEY" \
    -d $'{
 "subscription": {
   "source": "in_house",
   "source_id": "sub_abc123"
 },
 "customer": {
   "source": "in_house",
   "source_id": "cus_abc123",
   "email": "sarah@example.com",
   "properties": {
     "first_name": "Sarah",      
     "last_name": "Doe"
   }
 }
}

A note about source  and source_id :
In most cases, you should use IDs from your payment processor. If you're using Stripe, source would be "stripe" and source_id would be "cus_sampleID".

If that's not possible, you can use IDs from your in-house billing system. source would be "in_house" and source_id  would be "yourInternalId".

IDs should be unique to customers, subscriptions, payment methods, and payments.