Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.revtain.com/llms.txt

Use this file to discover all available pages before exploring further.

When a customer clicks cancel in your app, send them to a Revtain-hosted retention page instead of cancelling straight away. The page presents the offers you have configured — pause the subscription, apply a discount, or downgrade to a cheaper plan — and reports the customer’s decision back to you by webhook. The page is branded to your business. The customer sees your name and colours, not Revtain’s.
Cancel flow is enabled per account. Contact Revtain to turn it on and to configure your retention offers — which options appear, the discount percentage, and the pause length.

How It Works

1

Customer clicks cancel in your app

Intercept the cancellation in your own UI. Do not cancel the subscription yet.
2

Generate a cancel flow link

Call POST /api/cancel-flow/generate from your backend with the customer’s details. You receive a unique, time-limited URL.
3

Redirect the customer to the URL

The customer sees your branded retention page with the offers you have configured.
4

Receive the outcome

When the customer makes a choice, Revtain sends a churn.flow.{outcome} webhook. Apply the decision in your billing system.
Call this from your backend — it requires your API key.
curl -X POST https://api.revtain.com/api/cancel-flow/generate \
  -H "X-API-KEY: rev_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "cus_abc123",
    "customerEmail": "customer@example.com",
    "subscriptionId": "sub_789",
    "amount": 2900,
    "currency": "USD",
    "returnUrl": "https://app.yourdomain.com/account"
  }'
Only customerId is required. amount — the recurring charge in the smallest currency unit — lets the page frame the offer accurately. returnUrl is where the customer lands after finishing. The response:
{
  "url": "https://api.revtain.com/api/cancel-flow/abc123xyz...",
  "token": "abc123xyz...",
  "expiresAt": "2026-05-23T14:30:00.000Z"
}
The link is valid for 48 hours and can be used once. Generate a fresh link each time a customer starts a cancellation.

Handle the Outcome

When the customer completes the flow, Revtain sends a churn.flow.{outcome} webhook. The outcome is one of:
OutcomeMeaningWhat to do
retainedThe customer accepted a discount or chose to stayApply the discount if one was offered; keep the subscription active
pausedThe customer paused the subscriptionPause billing for the configured period
downgradedThe customer moved to a cheaper planSwitch the customer to the lower plan
cancelledThe customer still chose to cancelCancel the subscription
{
  "event": "churn.flow.paused",
  "customerId": "cus_abc123",
  "customerEmail": "customer@example.com",
  "subscriptionId": "sub_789",
  "outcome": "paused",
  "timestamp": "2026-05-21T16:40:00.000Z"
}
Revtain records the customer’s decision and notifies you — it does not change the subscription in your billing system. Applying the outcome (pause, downgrade, cancel) is the job of your webhook handler.

Verify the Webhook

The churn.flow webhook is signed like every other Revtain webhook. Verify the X-Revtain-Signature header before acting on it — see Webhooks for the verification steps.