[{"data":1,"prerenderedAt":1431},["ShallowReactive",2],{"navigation":3,"/integrations/actions/apply-coupon":310,"/integrations/actions/apply-coupon-surround":1345,"/types/actions/apply-coupon/request.type":1354,"Uzbcrwb7K0":1371,"mvUbUXcxHo":1381,"8Djdyq3G62":1391,"/types/actions/apply-coupon/features.type":1411,"qydw4KL87Y":1421},[4,13,161,197,211,236,290,300],{"title":5,"_path":6,"children":7,"_id":12,"description":11},"Getting Started","/getting-started",[8],{"title":9,"_path":6,"_id":10,"description":11},"Overview","content:1.getting-started:1.index.md","Everything you need to know about integrating Churnkey with your product and billing stack.","content:1.getting-started:_dir.yml",{"title":14,"_path":15,"children":16,"_id":160},"Cancel Flows","/cancel-flows",[17,22,27,32,37,42,47,52,57,62,67,72,116,130],{"title":18,"_path":19,"_id":20,"description":21},"Quick Start Guide","/cancel-flows/quick-start-guide","content:2.cancel-flows:1.quick-start-guide.md","A 3-step guide on how to implement Cancel Flows in your website",{"title":23,"_path":24,"_id":25,"description":26},"Cancel Flow Structure","/cancel-flows/flow-configuration","content:2.cancel-flows:2.flow configuration.md","Learn about the available components that make up a Cancel Flow, from initial offers to cancellation confirmation, and how each step contributes to the overall flow.",{"title":28,"_path":29,"_id":30,"description":31},"Configuration Options","/cancel-flows/further-configuration","content:2.cancel-flows:3.further-configuration.md","Additional details for all of the following options are included below.",{"title":33,"_path":34,"_id":35,"description":36},"Custom Styling","/cancel-flows/custom-styling","content:2.cancel-flows:4.custom-styling.md","Brand your Churnkey Cancel Flow with your own CSS",{"title":38,"_path":39,"_id":40,"description":41},"Managed Email Flow","/cancel-flows/email-verified-cancel-flow","content:2.cancel-flows:6.email-verified-cancel-flow.md","Our managed email based setup takes care of customer verification for you with an email verification code.",{"title":43,"_path":44,"_id":45,"description":46},"A/B Testing","/cancel-flows/a-b-testing","content:2.cancel-flows:7.a-b-testing.md","Run controlled experiments to optimize your Cancel Flows and maximize customer retention.",{"title":48,"_path":49,"_id":50,"description":51},"Testing","/cancel-flows/cancel-flow-testing","content:2.cancel-flows:8.cancel-flow-testing.md","Ensure that your Cancel Flow is working as intended before going live.",{"title":53,"_path":54,"_id":55,"description":56},"Pause Wall","/cancel-flows/pause-wall","content:2.cancel-flows:9.pause-wall.md","Block access to your application during subscription pauses",{"title":58,"_path":59,"_id":60,"description":61},"Click-to-Cancel Compliance","/cancel-flows/click-to-cancel","content:2.cancel-flows:10.click-to-cancel.md","Implement automatic compliance with global subscription cancellation requirements",{"title":63,"_path":64,"_id":65,"description":66},"Structured Follow-Up Questions","/cancel-flows/structured-follow-up-questions","content:2.cancel-flows:11.structured-follow-up-questions.md","Collect deeper cancellation insights and deliver targeted retention offers with a second layer of predefined follow-up options in your cancel flow survey.",{"title":68,"_path":69,"_id":70,"description":71},"Adaptive Offers","/cancel-flows/adaptive-offers","content:2.cancel-flows:adaptive-offers.md","AI-powered discount optimization that automatically finds the perfect offer for each customer",{"title":73,"_path":74,"children":75},"Analytics","/cancel-flows/analytics",[76,81,86,91,96,101,106,111],{"title":77,"_path":78,"_id":79,"description":80},"Boosted Revenue","/cancel-flows/analytics/average-boosted-revenue","content:2.cancel-flows:analytics:1.average-boosted-revenue.md","Measure the long-term value of retained subscribers",{"title":82,"_path":83,"_id":84,"description":85},"Save Rate","/cancel-flows/analytics/save-rate","content:2.cancel-flows:analytics:2.save-rate.md","The percentage of customers that your Cancel Flows saved from cancellation",{"title":87,"_path":88,"_id":89,"description":90},"Reactivation Rate","/cancel-flows/analytics/reactivation-rate","content:2.cancel-flows:analytics:3.reactivation-rate.md","The percentage of customers who pay at least one invoice after being saved",{"title":92,"_path":93,"_id":94,"description":95},"Sessions","/cancel-flows/analytics/session-outcomes","content:2.cancel-flows:analytics:4.session-outcomes.md","Track each interaction that a customer has with your Cancel Flows",{"title":97,"_path":98,"_id":99,"description":100},"Cancellation Trends","/cancel-flows/analytics/cancellation-trends","content:2.cancel-flows:analytics:5.cancellation-trends.md","Analyze and interpret the selection rates and trends for cancellation reasons in your Cancel Flows.",{"title":102,"_path":103,"_id":104,"description":105},"Feedback AI","/cancel-flows/analytics/feedback-ai","content:2.cancel-flows:analytics:6.feedback-ai.md","Transform customer feedback into actionable insights with AI-powered categorization and analysis",{"title":107,"_path":108,"_id":109,"description":110},"Response Flow","/cancel-flows/analytics/response-flow","content:2.cancel-flows:analytics:7.response-flow.md","Visualize how customers move from primary cancellation reasons to specific follow-up selections with the Sankey diagram",{"title":112,"_path":113,"_id":114,"description":115},"Response Explorer","/cancel-flows/analytics/response-explorer","content:2.cancel-flows:analytics:8.response-explorer.md","Drill into individual follow-up responses with the Treemap visualization, search, trend analysis, and MRR impact sorting",{"title":117,"_path":118,"children":119},"Multi Language Support","/cancel-flows/multi-language-support",[120,125],{"title":121,"_path":122,"_id":123,"description":124},"Manual Translations","/cancel-flows/multi-language-support/multi-language-support","content:2.cancel-flows:multi-language-support:5.multi-language-support.md","Support multiple languages.",{"title":126,"_path":127,"_id":128,"description":129},"Automatic Translations","/cancel-flows/multi-language-support/automatic-translation","content:2.cancel-flows:multi-language-support:automatic-translation.md","Enable AI-powered multilingual support for your Cancel Flows with a single toggle.",{"title":131,"_path":132,"children":133,"_id":159},"Offers","/cancel-flows/offers",[134,139,144,149,154],{"title":135,"_path":136,"_id":137,"description":138},"Discount","/cancel-flows/offers/discounts","content:2.cancel-flows:offers:discounts.md","Offer targeted subscription discounts to reduce churn and increase customer retention",{"title":140,"_path":141,"_id":142,"description":143},"Hidden Plans","/cancel-flows/offers/hidden-plans","content:2.cancel-flows:offers:hidden-plans.md","Use the Switch Subscription Plan offer to present exclusive, non-public plans to customers during cancellation",{"title":145,"_path":146,"_id":147,"description":148},"Pause Subscription","/cancel-flows/offers/pause-subscription","content:2.cancel-flows:offers:pause-subscription.md","Temporarily suspend subscription payments without canceling the service",{"title":150,"_path":151,"_id":152,"description":153},"Switch Subscription Plan","/cancel-flows/offers/switch-subscription","content:2.cancel-flows:offers:switch-subscription.md","Allow customers to change to a different subscription plan during the cancellation flow to retain them with a more suitable option",{"title":155,"_path":156,"_id":157,"description":158},"Trial Extension","/cancel-flows/offers/trial-extension","content:2.cancel-flows:offers:trial-extension.md","Extend customer trial periods to reduce churn and increase conversion rates during the critical trial-to-paid transition","content:2.cancel-flows:offers:_dir.yml","content:2.cancel-flows:_dir.yml",{"title":162,"_path":163,"children":164,"_id":196},"Payment Recovery","/failed-payment-recovery",[165,169,174,179,184,188],{"title":5,"_path":166,"_id":167,"description":168},"/failed-payment-recovery/payment-recovery","content:3.failed-payment-recovery:1.payment-recovery.md","Recover failed payment revenue, automatically.",{"title":170,"_path":171,"_id":172,"description":173},"Customize your Campaigns","/failed-payment-recovery/campaign-customization","content:3.failed-payment-recovery:2.campaign-customization.md","Customize your Payment Recovery Campaigns to match the unique needs of your individual customers.",{"title":175,"_path":176,"_id":177,"description":178},"Failed Payment Wall","/failed-payment-recovery/failed-payment-wall","content:3.failed-payment-recovery:3.failed-payment-wall.md","Block access to your application when payments fail",{"title":180,"_path":181,"_id":182,"description":183},"Billing Contact API","/failed-payment-recovery/billing-contact-api","content:3.failed-payment-recovery:4.billing-contact-api.md","Send Payment Recovery emails to multiple billing contacts",{"title":43,"_path":185,"_id":186,"description":187},"/failed-payment-recovery/ab-testing","content:3.failed-payment-recovery:5.ab-testing.md","Optimize your payment recovery campaigns through controlled experiments that maximize revenue recovery.",{"title":73,"_path":189,"children":190},"/failed-payment-recovery/analytics",[191],{"title":192,"_path":193,"_id":194,"description":195},"Overall Performance","/failed-payment-recovery/analytics/overview","content:3.failed-payment-recovery:analytics:1.overview.md","Key performance metrics for your Payment Recovery campaigns","content:3.failed-payment-recovery:_dir.yml",{"title":198,"_path":199,"children":200,"_id":210},"Reactivations","/reactivations",[201,205],{"title":5,"_path":202,"_id":203,"description":204},"/reactivations/reactivations","content:4.reactivations:1.reactivations.md","Churnkey helps you to recover unsubscribed customers with easy, customizable Reactivation Email Campaigns.",{"title":206,"_path":207,"_id":208,"description":209},"Customization","/reactivations/campaign-customization-guide","content:4.reactivations:2.campaign-customization-guide.md","Customize your Reactivation Campaigns to match the individual needs of your customers.","content:4.reactivations:_dir.yml",{"title":212,"_path":213,"children":214,"_id":235},"Data Integrations","/data-integrations",[215,220,225,230],{"title":216,"_path":217,"_id":218,"description":219},"Data API","/data-integrations/data-api","content:6.data-integrations:1.data-api.md","Access your data through our API.",{"title":221,"_path":222,"_id":223,"description":224},"Slack notifications","/data-integrations/slack","content:6.data-integrations:2.slack.md","Connect Churnkey with your organization's Slack and to send session notifications to a specific channel.",{"title":226,"_path":227,"_id":228,"description":229},"Webhooks","/data-integrations/webhooks","content:6.data-integrations:2.webhooks.md","Churnkey can send webhooks to automatically notify your application whenever a customer completes a session.",{"title":231,"_path":232,"_id":233,"description":234},"Event Tracking","/data-integrations/event-tracking","content:6.data-integrations:3.event-tracking.md","Track your customers' key-value metrics on a per customer basis.","content:6.data-integrations:_dir.yml",{"title":237,"_path":238,"children":239,"_id":289},"Billing Providers","/billing-providers",[240,245,250,255,260,265,270,275],{"title":241,"_path":242,"_id":243,"description":244},"Payment Providers","/billing-providers/payment-provider-overview","content:7.billing-providers:1.payment-provider-overview.md","Feature support for Stripe, Chargebee, Paddle, and Braintree",{"title":246,"_path":247,"_id":248,"description":249},"Stripe","/billing-providers/stripe","content:7.billing-providers:3.stripe.md","Integrate Churnkey with your Stripe account",{"title":251,"_path":252,"_id":253,"description":254},"Chargebee","/billing-providers/chargebee","content:7.billing-providers:4.chargebee.md","Integrate Churnkey with your Chargebee account",{"title":256,"_path":257,"_id":258,"description":259},"Paddle Classic","/billing-providers/paddle-classic","content:7.billing-providers:5.paddle-classic.md","Integrate Churnkey with your Paddle Classic account",{"title":261,"_path":262,"_id":263,"description":264},"Paddle Billing","/billing-providers/paddle-billing","content:7.billing-providers:6.paddle-billing.md","Integrate Churnkey with your Paddle Billing account",{"title":266,"_path":267,"_id":268,"description":269},"Braintree","/billing-providers/braintree","content:7.billing-providers:7.braintree.md","Integrate Churnkey with your Braintree account",{"title":271,"_path":272,"_id":273,"description":274},"Maxio","/billing-providers/maxio","content:7.billing-providers:8.maxio.md","Integrate Churnkey with your Maxio (formerly Chargify) account",{"title":276,"_path":277,"children":278},"Direct Connect","/billing-providers/direct-connect",[279,284],{"title":280,"_path":281,"_id":282,"description":283},"Churnkey Direct","/billing-providers/direct-connect/direct","content:7.billing-providers:9.direct-connect:1.direct.md","Integrate Churnkey with any billing system using Direct mode",{"title":285,"_path":286,"_id":287,"description":288},"Direct Mode Examples","/billing-providers/direct-connect/direct-examples","content:7.billing-providers:9.direct-connect:2.direct-examples.md","Real-world examples for common subscription scenarios","content:7.billing-providers:_dir.yml",{"title":291,"_path":292,"children":293,"_id":299},"Account","/account",[294],{"title":295,"_path":296,"_id":297,"description":298},"Multi-Workspace Support","/account/multi-workspace-support","content:8.account:1.multi-workspace-support.md","Use one email address to access multiple Churnkey workspaces and switch between them instantly.","content:8.account:_dir.yml",{"title":301,"_path":302,"children":303,"_id":309},"Support","/support",[304],{"title":305,"_path":306,"_id":307,"description":308},"Frequently Asked Questions","/support/faqs","content:9.support:1.faqs.md","We want setting up Churnkey to be a breeze.","content:9.support:_dir.yml",{"_path":311,"_dir":312,"_draft":313,"_partial":313,"_locale":314,"title":315,"description":316,"body":317,"_type":1338,"_id":1339,"_source":1340,"_file":1341,"_stem":1342,"_extension":1343,"sitemap":1344},"/integrations/actions/apply-coupon","actions",false,"","Apply Coupon","Apply a coupon to a subscription.",{"type":318,"children":319,"toc":1330},"root",[320,335,354,361,444,450,462,872,878,888,897,918,923,933,969,1171,1180,1192,1200,1324],{"type":321,"tag":322,"props":323,"children":324},"element","p",{},[325,328,333],{"type":326,"value":327},"text","Required for ",{"type":321,"tag":329,"props":330,"children":332},"badge",{"label":331},"Apply Discount Offer",[],{"type":326,"value":334}," to work.",{"type":321,"tag":322,"props":336,"children":337},{},[338,340,346,348],{"type":326,"value":339},"To implement the ",{"type":321,"tag":341,"props":342,"children":344},"code",{"className":343},[],[345],{"type":326,"value":315},{"type":326,"value":347}," action, you need to implement an endpoint and define ",{"type":321,"tag":341,"props":349,"children":351},{"className":350},[],[352],{"type":326,"value":353},"features",{"type":321,"tag":355,"props":356,"children":358},"h2",{"id":357},"prerequisites",[359],{"type":326,"value":360},"Prerequisites",{"type":321,"tag":362,"props":363,"children":365},"grid",{"cols":364},2,[366,396,419],{"type":321,"tag":367,"props":368,"children":371},"card-baseline",{"title":369,"to":370},"Subscriptions - Controller","/integrations/controllers/subscriptions",[372,385],{"type":321,"tag":322,"props":373,"children":374},{},[375,377,383],{"type":326,"value":376},"You must implement a ",{"type":321,"tag":341,"props":378,"children":380},{"className":379},[],[381],{"type":326,"value":382},"Subscriptions",{"type":326,"value":384}," controller first.",{"type":321,"tag":386,"props":387,"children":390},"flex",{"className":388},[389],"mt-4",[391],{"type":321,"tag":329,"props":392,"children":395},{"label":393,"color":394},"Required","green",[],{"type":321,"tag":367,"props":397,"children":400},{"title":398,"to":399},"Coupons - Controller","/integrations/controllers/coupons",[401,412],{"type":321,"tag":322,"props":402,"children":403},{},[404,405,411],{"type":326,"value":376},{"type":321,"tag":341,"props":406,"children":408},{"className":407},[],[409],{"type":326,"value":410},"Coupons",{"type":326,"value":384},{"type":321,"tag":386,"props":413,"children":415},{"className":414},[389],[416],{"type":321,"tag":329,"props":417,"children":418},{"label":393,"color":394},[],{"type":321,"tag":367,"props":420,"children":423},{"title":421,"to":422},"Cancel - Action","/integrations/actions/cancel",[424,437],{"type":321,"tag":322,"props":425,"children":426},{},[427,429,435],{"type":326,"value":428},"Coupon application is a part of the Cancel Flow. You must implement the ",{"type":321,"tag":341,"props":430,"children":432},{"className":431},[],[433],{"type":326,"value":434},"Cancel",{"type":326,"value":436}," action first.",{"type":321,"tag":386,"props":438,"children":440},{"className":439},[389],[441],{"type":321,"tag":329,"props":442,"children":443},{"label":393,"color":394},[],{"type":321,"tag":355,"props":445,"children":447},{"id":446},"sdk",[448],{"type":326,"value":449},"SDK",{"type":321,"tag":322,"props":451,"children":452},{},[453,455,460],{"type":326,"value":454},"If you are using the SDK, you can implement the ",{"type":321,"tag":341,"props":456,"children":458},{"className":457},[],[459],{"type":326,"value":315},{"type":326,"value":461}," action by following the code example below. You don't need to get into the details of the API endpoints, the SDK will take care of that for you.",{"type":321,"tag":463,"props":464,"children":465},"code-group",{},[466],{"type":321,"tag":467,"props":468,"children":473},"pre",{"className":469,"code":470,"filename":471,"language":472,"meta":314,"style":314},"language-typescript shiki shiki-themes github-light-default github-light-default github-dark-default","import { Integrator } from '@churnkey/sdk'\nimport { Subscriptions } from '../controllers/Subscriptions'\nimport { Coupons } from '../controllers/Coupons'\n\nexport const ApplyCoupon = Integrator.ApplyCoupon.config({\n    Subscriptions: Subscriptions,\n    Coupons: Coupons,\n    features: {\n        enabled: true\n    },\n    async handle(ctx, options) {\n        const subscription = await this.subscriptions.retrieve({\n            customerId: options.customerId,\n            id: options.subscriptionId\n        })\n\n        const coupon = await this.coupons.retrieve({\n            id: options.coupon\n        })\n\n        await ctx.db.applyCoupon({ subscription, coupon })\n    }\n})\n","Typescript","typescript",[474],{"type":321,"tag":341,"props":475,"children":476},{"__ignoreMap":314},[477,506,527,549,559,600,609,618,627,641,650,690,732,741,750,759,767,805,814,822,830,854,863],{"type":321,"tag":478,"props":479,"children":482},"span",{"class":480,"line":481},"line",1,[483,489,495,500],{"type":321,"tag":478,"props":484,"children":486},{"style":485},"--shiki-light:#CF222E;--shiki-default:#CF222E;--shiki-dark:#FF7B72",[487],{"type":326,"value":488},"import",{"type":321,"tag":478,"props":490,"children":492},{"style":491},"--shiki-light:#1F2328;--shiki-default:#1F2328;--shiki-dark:#E6EDF3",[493],{"type":326,"value":494}," { Integrator } ",{"type":321,"tag":478,"props":496,"children":497},{"style":485},[498],{"type":326,"value":499},"from",{"type":321,"tag":478,"props":501,"children":503},{"style":502},"--shiki-light:#0A3069;--shiki-default:#0A3069;--shiki-dark:#A5D6FF",[504],{"type":326,"value":505}," '@churnkey/sdk'\n",{"type":321,"tag":478,"props":507,"children":508},{"class":480,"line":364},[509,513,518,522],{"type":321,"tag":478,"props":510,"children":511},{"style":485},[512],{"type":326,"value":488},{"type":321,"tag":478,"props":514,"children":515},{"style":491},[516],{"type":326,"value":517}," { Subscriptions } ",{"type":321,"tag":478,"props":519,"children":520},{"style":485},[521],{"type":326,"value":499},{"type":321,"tag":478,"props":523,"children":524},{"style":502},[525],{"type":326,"value":526}," '../controllers/Subscriptions'\n",{"type":321,"tag":478,"props":528,"children":530},{"class":480,"line":529},3,[531,535,540,544],{"type":321,"tag":478,"props":532,"children":533},{"style":485},[534],{"type":326,"value":488},{"type":321,"tag":478,"props":536,"children":537},{"style":491},[538],{"type":326,"value":539}," { Coupons } ",{"type":321,"tag":478,"props":541,"children":542},{"style":485},[543],{"type":326,"value":499},{"type":321,"tag":478,"props":545,"children":546},{"style":502},[547],{"type":326,"value":548}," '../controllers/Coupons'\n",{"type":321,"tag":478,"props":550,"children":552},{"class":480,"line":551},4,[553],{"type":321,"tag":478,"props":554,"children":556},{"emptyLinePlaceholder":555},true,[557],{"type":326,"value":558},"\n",{"type":321,"tag":478,"props":560,"children":562},{"class":480,"line":561},5,[563,568,573,579,584,589,595],{"type":321,"tag":478,"props":564,"children":565},{"style":485},[566],{"type":326,"value":567},"export",{"type":321,"tag":478,"props":569,"children":570},{"style":485},[571],{"type":326,"value":572}," const",{"type":321,"tag":478,"props":574,"children":576},{"style":575},"--shiki-light:#0550AE;--shiki-default:#0550AE;--shiki-dark:#79C0FF",[577],{"type":326,"value":578}," ApplyCoupon",{"type":321,"tag":478,"props":580,"children":581},{"style":485},[582],{"type":326,"value":583}," =",{"type":321,"tag":478,"props":585,"children":586},{"style":491},[587],{"type":326,"value":588}," Integrator.ApplyCoupon.",{"type":321,"tag":478,"props":590,"children":592},{"style":591},"--shiki-light:#8250DF;--shiki-default:#8250DF;--shiki-dark:#D2A8FF",[593],{"type":326,"value":594},"config",{"type":321,"tag":478,"props":596,"children":597},{"style":491},[598],{"type":326,"value":599},"({\n",{"type":321,"tag":478,"props":601,"children":603},{"class":480,"line":602},6,[604],{"type":321,"tag":478,"props":605,"children":606},{"style":491},[607],{"type":326,"value":608},"    Subscriptions: Subscriptions,\n",{"type":321,"tag":478,"props":610,"children":612},{"class":480,"line":611},7,[613],{"type":321,"tag":478,"props":614,"children":615},{"style":491},[616],{"type":326,"value":617},"    Coupons: Coupons,\n",{"type":321,"tag":478,"props":619,"children":621},{"class":480,"line":620},8,[622],{"type":321,"tag":478,"props":623,"children":624},{"style":491},[625],{"type":326,"value":626},"    features: {\n",{"type":321,"tag":478,"props":628,"children":630},{"class":480,"line":629},9,[631,636],{"type":321,"tag":478,"props":632,"children":633},{"style":491},[634],{"type":326,"value":635},"        enabled: ",{"type":321,"tag":478,"props":637,"children":638},{"style":575},[639],{"type":326,"value":640},"true\n",{"type":321,"tag":478,"props":642,"children":644},{"class":480,"line":643},10,[645],{"type":321,"tag":478,"props":646,"children":647},{"style":491},[648],{"type":326,"value":649},"    },\n",{"type":321,"tag":478,"props":651,"children":653},{"class":480,"line":652},11,[654,659,664,669,675,680,685],{"type":321,"tag":478,"props":655,"children":656},{"style":485},[657],{"type":326,"value":658},"    async",{"type":321,"tag":478,"props":660,"children":661},{"style":591},[662],{"type":326,"value":663}," handle",{"type":321,"tag":478,"props":665,"children":666},{"style":491},[667],{"type":326,"value":668},"(",{"type":321,"tag":478,"props":670,"children":672},{"style":671},"--shiki-light:#953800;--shiki-default:#953800;--shiki-dark:#FFA657",[673],{"type":326,"value":674},"ctx",{"type":321,"tag":478,"props":676,"children":677},{"style":491},[678],{"type":326,"value":679},", ",{"type":321,"tag":478,"props":681,"children":682},{"style":671},[683],{"type":326,"value":684},"options",{"type":321,"tag":478,"props":686,"children":687},{"style":491},[688],{"type":326,"value":689},") {\n",{"type":321,"tag":478,"props":691,"children":693},{"class":480,"line":692},12,[694,699,704,708,713,718,723,728],{"type":321,"tag":478,"props":695,"children":696},{"style":485},[697],{"type":326,"value":698},"        const",{"type":321,"tag":478,"props":700,"children":701},{"style":575},[702],{"type":326,"value":703}," subscription",{"type":321,"tag":478,"props":705,"children":706},{"style":485},[707],{"type":326,"value":583},{"type":321,"tag":478,"props":709,"children":710},{"style":485},[711],{"type":326,"value":712}," await",{"type":321,"tag":478,"props":714,"children":715},{"style":575},[716],{"type":326,"value":717}," this",{"type":321,"tag":478,"props":719,"children":720},{"style":491},[721],{"type":326,"value":722},".subscriptions.",{"type":321,"tag":478,"props":724,"children":725},{"style":591},[726],{"type":326,"value":727},"retrieve",{"type":321,"tag":478,"props":729,"children":730},{"style":491},[731],{"type":326,"value":599},{"type":321,"tag":478,"props":733,"children":735},{"class":480,"line":734},13,[736],{"type":321,"tag":478,"props":737,"children":738},{"style":491},[739],{"type":326,"value":740},"            customerId: options.customerId,\n",{"type":321,"tag":478,"props":742,"children":744},{"class":480,"line":743},14,[745],{"type":321,"tag":478,"props":746,"children":747},{"style":491},[748],{"type":326,"value":749},"            id: options.subscriptionId\n",{"type":321,"tag":478,"props":751,"children":753},{"class":480,"line":752},15,[754],{"type":321,"tag":478,"props":755,"children":756},{"style":491},[757],{"type":326,"value":758},"        })\n",{"type":321,"tag":478,"props":760,"children":762},{"class":480,"line":761},16,[763],{"type":321,"tag":478,"props":764,"children":765},{"emptyLinePlaceholder":555},[766],{"type":326,"value":558},{"type":321,"tag":478,"props":768,"children":770},{"class":480,"line":769},17,[771,775,780,784,788,792,797,801],{"type":321,"tag":478,"props":772,"children":773},{"style":485},[774],{"type":326,"value":698},{"type":321,"tag":478,"props":776,"children":777},{"style":575},[778],{"type":326,"value":779}," coupon",{"type":321,"tag":478,"props":781,"children":782},{"style":485},[783],{"type":326,"value":583},{"type":321,"tag":478,"props":785,"children":786},{"style":485},[787],{"type":326,"value":712},{"type":321,"tag":478,"props":789,"children":790},{"style":575},[791],{"type":326,"value":717},{"type":321,"tag":478,"props":793,"children":794},{"style":491},[795],{"type":326,"value":796},".coupons.",{"type":321,"tag":478,"props":798,"children":799},{"style":591},[800],{"type":326,"value":727},{"type":321,"tag":478,"props":802,"children":803},{"style":491},[804],{"type":326,"value":599},{"type":321,"tag":478,"props":806,"children":808},{"class":480,"line":807},18,[809],{"type":321,"tag":478,"props":810,"children":811},{"style":491},[812],{"type":326,"value":813},"            id: options.coupon\n",{"type":321,"tag":478,"props":815,"children":817},{"class":480,"line":816},19,[818],{"type":321,"tag":478,"props":819,"children":820},{"style":491},[821],{"type":326,"value":758},{"type":321,"tag":478,"props":823,"children":825},{"class":480,"line":824},20,[826],{"type":321,"tag":478,"props":827,"children":828},{"emptyLinePlaceholder":555},[829],{"type":326,"value":558},{"type":321,"tag":478,"props":831,"children":833},{"class":480,"line":832},21,[834,839,844,849],{"type":321,"tag":478,"props":835,"children":836},{"style":485},[837],{"type":326,"value":838},"        await",{"type":321,"tag":478,"props":840,"children":841},{"style":491},[842],{"type":326,"value":843}," ctx.db.",{"type":321,"tag":478,"props":845,"children":846},{"style":591},[847],{"type":326,"value":848},"applyCoupon",{"type":321,"tag":478,"props":850,"children":851},{"style":491},[852],{"type":326,"value":853},"({ subscription, coupon })\n",{"type":321,"tag":478,"props":855,"children":857},{"class":480,"line":856},22,[858],{"type":321,"tag":478,"props":859,"children":860},{"style":491},[861],{"type":326,"value":862},"    }\n",{"type":321,"tag":478,"props":864,"children":866},{"class":480,"line":865},23,[867],{"type":321,"tag":478,"props":868,"children":869},{"style":491},[870],{"type":326,"value":871},"})\n",{"type":321,"tag":355,"props":873,"children":875},{"id":874},"endpoints",[876],{"type":326,"value":877},"Endpoints",{"type":321,"tag":879,"props":880,"children":882},"h3",{"id":881},"handle",[883,885],{"type":326,"value":884},"Handle ",{"type":321,"tag":329,"props":886,"children":887},{"label":393,"color":394},[],{"type":321,"tag":322,"props":889,"children":890},{},[891],{"type":321,"tag":341,"props":892,"children":894},{"className":893},[],[895],{"type":326,"value":896},"POST /churnkey/actions/subscription/apply-coupon",{"type":321,"tag":322,"props":898,"children":899},{},[900,902,908,910,916],{"type":326,"value":901},"This endpoint applies coupon to a subscription. You should find the subscription by ",{"type":321,"tag":341,"props":903,"children":905},{"className":904},[],[906],{"type":326,"value":907},"customerId",{"type":326,"value":909}," and ",{"type":321,"tag":341,"props":911,"children":913},{"className":912},[],[914],{"type":326,"value":915},"subscriptionId",{"type":326,"value":917}," and apply coupon to it.",{"type":321,"tag":322,"props":919,"children":920},{},[921],{"type":326,"value":922},"Options for this action, provided in the request body.",{"type":321,"tag":924,"props":925,"children":927},"collapsible",{"name":926},"request body",[928],{"type":321,"tag":929,"props":930,"children":932},"field-schema",{"schema":931},"/types/actions/apply-coupon/request.type.json",[],{"type":321,"tag":924,"props":934,"children":936},{"name":935},"response",[937],{"type":321,"tag":938,"props":939,"children":940},"tabs",{},[941,951],{"type":321,"tag":942,"props":943,"children":945},"div",{"label":944},"200",[946],{"type":321,"tag":322,"props":947,"children":948},{},[949],{"type":326,"value":950},"Must return empty response.",{"type":321,"tag":942,"props":952,"children":954},{"label":953},"Error",[955],{"type":321,"tag":322,"props":956,"children":957},{},[958,960,967],{"type":326,"value":959},"See ",{"type":321,"tag":961,"props":962,"children":964},"a",{"href":963},"/integrations/general#error-responses",[965],{"type":326,"value":966},"Error Responses",{"type":326,"value":968},".",{"type":321,"tag":924,"props":970,"children":972},{"name":971},"code example",[973],{"type":321,"tag":463,"props":974,"children":975},{},[976],{"type":321,"tag":467,"props":977,"children":980},{"className":469,"code":978,"filename":979,"language":472,"meta":314,"style":314},"  app.post('/churnkey/actions/subscription/apply-coupon', async (req, res) => {\n      const subscription = await db.findSubscription(req.body.customerId, req.body.subscriptionId)\n      const coupon = await db.findCoupon(req.body.id)\n\n      await db.applyCoupon({subscription, coupon})\n      res.send()\n  })\n","Typescript Express",[981],{"type":321,"tag":341,"props":982,"children":983},{"__ignoreMap":314},[984,1049,1084,1117,1124,1145,1163],{"type":321,"tag":478,"props":985,"children":986},{"class":480,"line":481},[987,992,997,1001,1006,1010,1015,1020,1025,1029,1034,1039,1044],{"type":321,"tag":478,"props":988,"children":989},{"style":491},[990],{"type":326,"value":991},"  app.",{"type":321,"tag":478,"props":993,"children":994},{"style":591},[995],{"type":326,"value":996},"post",{"type":321,"tag":478,"props":998,"children":999},{"style":491},[1000],{"type":326,"value":668},{"type":321,"tag":478,"props":1002,"children":1003},{"style":502},[1004],{"type":326,"value":1005},"'/churnkey/actions/subscription/apply-coupon'",{"type":321,"tag":478,"props":1007,"children":1008},{"style":491},[1009],{"type":326,"value":679},{"type":321,"tag":478,"props":1011,"children":1012},{"style":485},[1013],{"type":326,"value":1014},"async",{"type":321,"tag":478,"props":1016,"children":1017},{"style":491},[1018],{"type":326,"value":1019}," (",{"type":321,"tag":478,"props":1021,"children":1022},{"style":671},[1023],{"type":326,"value":1024},"req",{"type":321,"tag":478,"props":1026,"children":1027},{"style":491},[1028],{"type":326,"value":679},{"type":321,"tag":478,"props":1030,"children":1031},{"style":671},[1032],{"type":326,"value":1033},"res",{"type":321,"tag":478,"props":1035,"children":1036},{"style":491},[1037],{"type":326,"value":1038},") ",{"type":321,"tag":478,"props":1040,"children":1041},{"style":485},[1042],{"type":326,"value":1043},"=>",{"type":321,"tag":478,"props":1045,"children":1046},{"style":491},[1047],{"type":326,"value":1048}," {\n",{"type":321,"tag":478,"props":1050,"children":1051},{"class":480,"line":364},[1052,1057,1061,1065,1069,1074,1079],{"type":321,"tag":478,"props":1053,"children":1054},{"style":485},[1055],{"type":326,"value":1056},"      const",{"type":321,"tag":478,"props":1058,"children":1059},{"style":575},[1060],{"type":326,"value":703},{"type":321,"tag":478,"props":1062,"children":1063},{"style":485},[1064],{"type":326,"value":583},{"type":321,"tag":478,"props":1066,"children":1067},{"style":485},[1068],{"type":326,"value":712},{"type":321,"tag":478,"props":1070,"children":1071},{"style":491},[1072],{"type":326,"value":1073}," db.",{"type":321,"tag":478,"props":1075,"children":1076},{"style":591},[1077],{"type":326,"value":1078},"findSubscription",{"type":321,"tag":478,"props":1080,"children":1081},{"style":491},[1082],{"type":326,"value":1083},"(req.body.customerId, req.body.subscriptionId)\n",{"type":321,"tag":478,"props":1085,"children":1086},{"class":480,"line":529},[1087,1091,1095,1099,1103,1107,1112],{"type":321,"tag":478,"props":1088,"children":1089},{"style":485},[1090],{"type":326,"value":1056},{"type":321,"tag":478,"props":1092,"children":1093},{"style":575},[1094],{"type":326,"value":779},{"type":321,"tag":478,"props":1096,"children":1097},{"style":485},[1098],{"type":326,"value":583},{"type":321,"tag":478,"props":1100,"children":1101},{"style":485},[1102],{"type":326,"value":712},{"type":321,"tag":478,"props":1104,"children":1105},{"style":491},[1106],{"type":326,"value":1073},{"type":321,"tag":478,"props":1108,"children":1109},{"style":591},[1110],{"type":326,"value":1111},"findCoupon",{"type":321,"tag":478,"props":1113,"children":1114},{"style":491},[1115],{"type":326,"value":1116},"(req.body.id)\n",{"type":321,"tag":478,"props":1118,"children":1119},{"class":480,"line":551},[1120],{"type":321,"tag":478,"props":1121,"children":1122},{"emptyLinePlaceholder":555},[1123],{"type":326,"value":558},{"type":321,"tag":478,"props":1125,"children":1126},{"class":480,"line":561},[1127,1132,1136,1140],{"type":321,"tag":478,"props":1128,"children":1129},{"style":485},[1130],{"type":326,"value":1131},"      await",{"type":321,"tag":478,"props":1133,"children":1134},{"style":491},[1135],{"type":326,"value":1073},{"type":321,"tag":478,"props":1137,"children":1138},{"style":591},[1139],{"type":326,"value":848},{"type":321,"tag":478,"props":1141,"children":1142},{"style":491},[1143],{"type":326,"value":1144},"({subscription, coupon})\n",{"type":321,"tag":478,"props":1146,"children":1147},{"class":480,"line":602},[1148,1153,1158],{"type":321,"tag":478,"props":1149,"children":1150},{"style":491},[1151],{"type":326,"value":1152},"      res.",{"type":321,"tag":478,"props":1154,"children":1155},{"style":591},[1156],{"type":326,"value":1157},"send",{"type":321,"tag":478,"props":1159,"children":1160},{"style":491},[1161],{"type":326,"value":1162},"()\n",{"type":321,"tag":478,"props":1164,"children":1165},{"class":480,"line":611},[1166],{"type":321,"tag":478,"props":1167,"children":1168},{"style":491},[1169],{"type":326,"value":1170},"  })\n",{"type":321,"tag":355,"props":1172,"children":1173},{"id":353},[1174,1176],{"type":326,"value":1175},"Features ",{"type":321,"tag":329,"props":1177,"children":1179},{"label":1178,"color":394},"required",[],{"type":321,"tag":322,"props":1181,"children":1182},{},[1183,1185,1190],{"type":326,"value":1184},"Features define which behavior is supported for the ",{"type":321,"tag":341,"props":1186,"children":1188},{"className":1187},[],[1189],{"type":326,"value":315},{"type":326,"value":1191}," action. Depending on the features you enabled, requests body will have different options.",{"type":321,"tag":924,"props":1193,"children":1195},{"name":1194},"schema",[1196],{"type":321,"tag":929,"props":1197,"children":1199},{"schema":1198},"/types/actions/apply-coupon/features.type.json",[],{"type":321,"tag":924,"props":1201,"children":1202},{"name":971},[1203],{"type":321,"tag":463,"props":1204,"children":1205},{},[1206],{"type":321,"tag":467,"props":1207,"children":1209},{"className":469,"code":1208,"filename":471,"language":472,"meta":314,"style":314},"export interface Features {\n  enabled: boolean\n}\n\nexport const features: Features = {\n  enabled: true,\n}\n",[1210],{"type":321,"tag":341,"props":1211,"children":1212},{"__ignoreMap":314},[1213,1234,1252,1260,1267,1299,1317],{"type":321,"tag":478,"props":1214,"children":1215},{"class":480,"line":481},[1216,1220,1225,1230],{"type":321,"tag":478,"props":1217,"children":1218},{"style":485},[1219],{"type":326,"value":567},{"type":321,"tag":478,"props":1221,"children":1222},{"style":485},[1223],{"type":326,"value":1224}," interface",{"type":321,"tag":478,"props":1226,"children":1227},{"style":671},[1228],{"type":326,"value":1229}," Features",{"type":321,"tag":478,"props":1231,"children":1232},{"style":491},[1233],{"type":326,"value":1048},{"type":321,"tag":478,"props":1235,"children":1236},{"class":480,"line":364},[1237,1242,1247],{"type":321,"tag":478,"props":1238,"children":1239},{"style":671},[1240],{"type":326,"value":1241},"  enabled",{"type":321,"tag":478,"props":1243,"children":1244},{"style":485},[1245],{"type":326,"value":1246},":",{"type":321,"tag":478,"props":1248,"children":1249},{"style":575},[1250],{"type":326,"value":1251}," boolean\n",{"type":321,"tag":478,"props":1253,"children":1254},{"class":480,"line":529},[1255],{"type":321,"tag":478,"props":1256,"children":1257},{"style":491},[1258],{"type":326,"value":1259},"}\n",{"type":321,"tag":478,"props":1261,"children":1262},{"class":480,"line":551},[1263],{"type":321,"tag":478,"props":1264,"children":1265},{"emptyLinePlaceholder":555},[1266],{"type":326,"value":558},{"type":321,"tag":478,"props":1268,"children":1269},{"class":480,"line":561},[1270,1274,1278,1283,1287,1291,1295],{"type":321,"tag":478,"props":1271,"children":1272},{"style":485},[1273],{"type":326,"value":567},{"type":321,"tag":478,"props":1275,"children":1276},{"style":485},[1277],{"type":326,"value":572},{"type":321,"tag":478,"props":1279,"children":1280},{"style":575},[1281],{"type":326,"value":1282}," features",{"type":321,"tag":478,"props":1284,"children":1285},{"style":485},[1286],{"type":326,"value":1246},{"type":321,"tag":478,"props":1288,"children":1289},{"style":671},[1290],{"type":326,"value":1229},{"type":321,"tag":478,"props":1292,"children":1293},{"style":485},[1294],{"type":326,"value":583},{"type":321,"tag":478,"props":1296,"children":1297},{"style":491},[1298],{"type":326,"value":1048},{"type":321,"tag":478,"props":1300,"children":1301},{"class":480,"line":602},[1302,1307,1312],{"type":321,"tag":478,"props":1303,"children":1304},{"style":491},[1305],{"type":326,"value":1306},"  enabled: ",{"type":321,"tag":478,"props":1308,"children":1309},{"style":575},[1310],{"type":326,"value":1311},"true",{"type":321,"tag":478,"props":1313,"children":1314},{"style":491},[1315],{"type":326,"value":1316},",\n",{"type":321,"tag":478,"props":1318,"children":1319},{"class":480,"line":611},[1320],{"type":321,"tag":478,"props":1321,"children":1322},{"style":491},[1323],{"type":326,"value":1259},{"type":321,"tag":1325,"props":1326,"children":1327},"style",{},[1328],{"type":326,"value":1329},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":314,"searchDepth":529,"depth":529,"links":1331},[1332,1333,1334,1337],{"id":357,"depth":364,"text":360},{"id":446,"depth":364,"text":449},{"id":874,"depth":364,"text":877,"children":1335},[1336],{"id":881,"depth":529,"text":884},{"id":353,"depth":364,"text":1175},"markdown","content:99.integrations:4.actions:4.apply-coupon.md","content","99.integrations/4.actions/4.apply-coupon.md","99.integrations/4.actions/4.apply-coupon","md",{"loc":311},[1346,1350],{"_path":1347,"title":1348,"description":1349},"/integrations/actions/extend-trial","Extend Trial - Action","Extends a subscription trial period for a specific duration.",{"_path":1351,"title":1352,"description":1353},"/integrations/actions/change-price","Change Price - Action","Changes the price and/or product of a subscription.",{"_path":1355,"_dir":1356,"_draft":313,"_partial":313,"_locale":314,"type":1357,"title":1358,"properties":1359,"_id":1367,"_type":1368,"_source":1340,"_file":1369,"_stem":1370,"_extension":1368},"/types/actions/apply-coupon/request.type","apply-coupon","object","Apply Coupon Request",{"customerId":1360,"subscriptionId":1363,"id":1365},{"type":1361,"severity":1178,"description":1362},"string","Unique identifier of the customer.",{"type":1361,"severity":1178,"description":1364},"Unique identifier of the subscription.",{"type":1361,"severity":1178,"description":1366},"ID of the `Coupon` to apply","content:types:actions:apply-coupon:request.type.json","json","types/actions/apply-coupon/request.type.json","types/actions/apply-coupon/request.type",{"data":1372,"body":1373,"toc":1379},{"title":314,"description":1362},{"type":318,"children":1374},[1375],{"type":321,"tag":322,"props":1376,"children":1377},{},[1378],{"type":326,"value":1362},{"title":314,"searchDepth":364,"depth":364,"links":1380},[],{"data":1382,"body":1383,"toc":1389},{"title":314,"description":1364},{"type":318,"children":1384},[1385],{"type":321,"tag":322,"props":1386,"children":1387},{},[1388],{"type":326,"value":1364},{"title":314,"searchDepth":364,"depth":364,"links":1390},[],{"data":1392,"body":1394,"excerpt":-1,"toc":1409},{"title":314,"description":1393},"ID of the Coupon to apply",{"type":318,"children":1395},[1396],{"type":321,"tag":322,"props":1397,"children":1398},{},[1399,1401,1407],{"type":326,"value":1400},"ID of the ",{"type":321,"tag":341,"props":1402,"children":1404},{"className":1403},[],[1405],{"type":326,"value":1406},"Coupon",{"type":326,"value":1408}," to apply",{"title":314,"searchDepth":364,"depth":364,"links":1410},[],{"_path":1412,"_dir":1356,"_draft":313,"_partial":313,"_locale":314,"type":1357,"title":1413,"properties":1414,"_id":1418,"_type":1368,"_source":1340,"_file":1419,"_stem":1420,"_extension":1368},"/types/actions/apply-coupon/features.type","Apply Coupon Features",{"enabled":1415},{"type":1416,"severity":1178,"description":1417},"boolean","If true, the action is enabled and can be used by Churnkey, otherwise it is disabled.","content:types:actions:apply-coupon:features.type.json","types/actions/apply-coupon/features.type.json","types/actions/apply-coupon/features.type",{"data":1422,"body":1423,"excerpt":-1,"toc":1429},{"title":314,"description":1417},{"type":318,"children":1424},[1425],{"type":321,"tag":322,"props":1426,"children":1427},{},[1428],{"type":326,"value":1417},{"title":314,"searchDepth":364,"depth":364,"links":1430},[],1775515594088]