GUIDES

Test mode and sandbox

Build and check your integration in test mode, play a customer's life with the sandbox scenarios, and run the 7-point checklist.

Test mode

A test key (nc_test_…) only reads and writes test data. In test mode NoChurn uses your billing tool’s test data (Stripe test mode, a sandbox site or test credentials) and never emails a real inbox: emails are written, never delivered to your customers. Test and live keep separate customers, flows, webhook endpoints and attributes, so nothing you try leaks into live.

New accounts start in test mode. Flows are published to test first (POST /v1/flows/{id}/publish with { "to": "test" }), and a person switches to live in the dashboard.

Sandbox scenarios

Test mode only (a live key answers 403 test_mode_only). Each scenario writes a sandbox.* event in the account’s journal.

Endpoint What it plays
POST /v1/sandbox/customers A test customer with an active subscription (billed by API, no Stripe call) renewing in 5 days, and a test card
POST /v1/sandbox/failed_payment { customer, invoice_url? }: a failed payment. The recovery flow (published in test) starts and writes its day-0 email
POST /v1/sandbox/card_removed { customer }: the card is removed before the renewal; the customer is flagged
POST /v1/sandbox/cancel_flow_run { customer, reason?, accept_offer?, subscription? }: plays the cancel flow, and cancels in one click when no offer is accepted
curl -X POST https://api.nochurn.sh/v1/sandbox/customers -H "Authorization: Bearer $NOCHURN_API_KEY"
curl -X POST https://api.nochurn.sh/v1/sandbox/failed_payment -H "Authorization: Bearer $NOCHURN_API_KEY" \
  -H "Content-Type: application/json" -d '{"customer":"cst_…"}'

To test your webhook handler, POST /v1/webhook_endpoints/{id}/test sends a signed test event to it right now.

The integration checklist

GET /v1/integration/verify checks 7 points in test mode. Each one is pass, fail (with its fix) or unknown.

Key Passes when
billing_connected A billing tool is connected in test mode, or your app sent a customer and a subscription (sandbox ones do not count)
webhook_verified Your webhook endpoint answered a delivery with 2xx
identify_received A customer has the base attributes signup_source and onboarding_done
cancel_flow_opened Your app opened the cancel flow (sandbox runs do not count)
click_to_cancel A cancellation was carried out in test mode
failed_payment_email A failed payment produced the day-0 recovery email with a card update link
no_secret_in_code No secret key in the files sent with POST /v1/integration/verify { snippets } (scanned, never stored)

When all pass, a person goes live in the dashboard: live keys, live publication of the flows and the live billing connection.

Test cards and test data

Use your billing provider’s own test cards and sandbox accounts. NoChurn stores no card number in any mode: only the brand, last 4 digits, expiry, funding, country and wallet.