Connecting With Stripe
Connect your Stripe account with Churnkey to enable powerful off-boarding flows out of the box.

Linking Your Stripe Account

You can manage your Stripe connection under your account settings page found here:
You will have the option to connect with your Stripe account in both live and test modes.

Test Mode

Churnkey offers the (optional) ability to test your integration with your Stripe test account. The Churnkey flow will look the same, but you will be using it with customers from your Stripe test account instead of the live account.
Once you have connected your Stripe testing account, you will be able to test the Churnkey flow with customers from your Stripe test account by passing a test customer id and setting the mode option to test. The rest of the implementation is identical to using Churnkey in live mode (see Installing Churnkey), including the HMAC signature and its keys.
window.churnkey.init('show', {
authHash: 'HMAC_HASH',
appId: 'YOUR_APP_ID',
mode: 'test', // DIFFERENT
window.churnkey.init('show', {
authHash: 'HMAC_HASH',
appId: 'YOUR_APP_ID',
mode: 'live', // DIFFERENT

Accepting offers in test mode

When you go through the Churnkey flow in test mode, you will be able to verify that the customer accounts in Stripe are updated when selecting to pause or cancel the subscription. Importantly, accepting a discount offer will not work in test mode. This is because Churnkey applies discounts based on the coupons you select in the offer builder (see Configuring Your Offboarding Flow). Since those coupons (and the exact couponId) only exists on your Stripe live account and not the test account, it cannot be applied to test customers. Rest assured, if test cancelations are working fine, the Stripe integration is performing as it should be, and discounts will function as expected in live mode.

Stripe Actions

Churnkey is able to connect to your Stripe account and perform the following actions on your behalf
  1. 1.
    Pause a subscription
  2. 2.
    Apply a discount
  3. 3.
    Cancel a subscription
We'll look at each one of these in a little bit more detail.

Pause Subscription

Churnkey uses Stripe's built-in pause feature which will update the subscription's pause_collection[behavior] to mark_uncollectible. The resumes_at field will automatically be set by ChurnKey depending on the length of the pause selected.
You can specify the maximum pause length allowed by customers while configuring your offboarding flow.
If you would like to implement a custom function for handling pause events, you can do so using the handlePause callback (see Custom Callbacks).

Apply a Discount

In the Churnkey offer builder (see Configuring Your Offboarding Flow), you can offer specific discounts to customers. These discounts are populated based on the coupons that you have created in your Stripe account.
When a customer accepts a discount, that coupon is applied directly to the Stripe customer account.
If you would like to implement a customer function for applying discounts, you can do so using the handleDiscount callback (see Custom Callbacks).

Cancel Subscription

Churnkey can handle canceling your customer's subscription for you. By default, a customer's subscription will be set to cancel at the end of the current period, but this behavior can be modified to cancel a user's subscription immediately.
Under the hood, Churnkey follows Stripe's best practices on canceling.
If you would like to implement a customer function for canceling subscriptions, you can do so using the handleCancel callback (see Custom Callbacks).