[{"data":1,"prerenderedAt":1442},["ShallowReactive",2],{"navigation_docs":3,"-packages-fluent-js-subscriptions":465,"-packages-fluent-js-subscriptions-surround":1437},[4,8,62,115,450],{"title":5,"path":6,"stem":7},"Introduction","\u002Fintroduction","0.introduction",{"title":9,"path":10,"stem":11,"children":12,"page":61},"Guides","\u002Fguides","1.guides",[13,17,21,25,29,33,37,41,45,49,53,57],{"title":14,"path":15,"stem":16},"Quickstart","\u002Fguides\u002Fquickstart","1.guides\u002F1.quickstart",{"title":18,"path":19,"stem":20},"Payouts & Settlement","\u002Fguides\u002Fpayouts","1.guides\u002F10.payouts",{"title":22,"path":23,"stem":24},"Customer Emails","\u002Fguides\u002Fcustomer-emails","1.guides\u002F11.customer-emails",{"title":26,"path":27,"stem":28},"Build your own integration","\u002Fguides\u002Fbuild-your-own-integration","1.guides\u002F2.build-your-own-integration",{"title":30,"path":31,"stem":32},"Selling Workflow","\u002Fguides\u002Fselling-workflow","1.guides\u002F2.selling-workflow",{"title":34,"path":35,"stem":36},"Vatly SDKs","\u002Fguides\u002Fsdks","1.guides\u002F3.sdks",{"title":38,"path":39,"stem":40},"Authentication","\u002Fguides\u002Fauthentication","1.guides\u002F4.authentication",{"title":42,"path":43,"stem":44},"Pagination","\u002Fguides\u002Fpagination","1.guides\u002F5.pagination",{"title":46,"path":47,"stem":48},"Errors","\u002Fguides\u002Ferrors","1.guides\u002F6.errors",{"title":50,"path":51,"stem":52},"Webhooks","\u002Fguides\u002Fwebhooks","1.guides\u002F7.webhooks",{"title":54,"path":55,"stem":56},"Idempotency","\u002Fguides\u002Fidempotency","1.guides\u002F8.idempotency",{"title":58,"path":59,"stem":60},"Testing","\u002Fguides\u002Ftesting","1.guides\u002F9.testing",false,{"title":63,"path":64,"stem":65,"children":66,"page":61},"Api Reference","\u002Fapi-reference","2.api-reference",[67,71,75,79,83,87,91,95,99,103,107,111],{"title":68,"path":69,"stem":70},"Customers","\u002Fapi-reference\u002Fcustomers","2.api-reference\u002F1.customers",{"title":72,"path":73,"stem":74},"Webhook Endpoints","\u002Fapi-reference\u002Fwebhook-endpoints","2.api-reference\u002F10.webhook-endpoints",{"title":76,"path":77,"stem":78},"Test helpers","\u002Fapi-reference\u002Ftest-helpers","2.api-reference\u002F11.test-helpers",{"title":80,"path":81,"stem":82},"Checkouts","\u002Fapi-reference\u002Fcheckouts","2.api-reference\u002F2.checkouts",{"title":84,"path":85,"stem":86},"One-off Products","\u002Fapi-reference\u002Fone-off-products","2.api-reference\u002F3.one-off-products",{"title":88,"path":89,"stem":90},"Subscriptions","\u002Fapi-reference\u002Fsubscriptions","2.api-reference\u002F4.subscriptions",{"title":92,"path":93,"stem":94},"Subscription Plans","\u002Fapi-reference\u002Fsubscription-plans","2.api-reference\u002F5.subscription-plans",{"title":96,"path":97,"stem":98},"Orders","\u002Fapi-reference\u002Forders","2.api-reference\u002F6.orders",{"title":100,"path":101,"stem":102},"Order Refunds","\u002Fapi-reference\u002Frefunds","2.api-reference\u002F7.refunds",{"title":104,"path":105,"stem":106},"Refunds","\u002Fapi-reference\u002Fglobal-refunds","2.api-reference\u002F8.global-refunds",{"title":108,"path":109,"stem":110},"Chargebacks","\u002Fapi-reference\u002Fchargebacks","2.api-reference\u002F9.chargebacks",{"title":112,"path":113,"stem":114},"Webhook Events","\u002Fapi-reference\u002Fwebhook-events","2.api-reference\u002F99.webhook-events",{"title":116,"path":117,"stem":118,"children":119},"Packages","\u002Fpackages","3.packages",[120,122,164,210,244,283,318,366,408],{"title":116,"path":117,"stem":121},"3.packages\u002Findex",{"title":123,"path":124,"stem":125,"children":126,"page":61},"PHP SDK","\u002Fpackages\u002Fphp","3.packages\u002F1.php",[127,131,134,137,140,144,147,151,154,157,160],{"title":128,"path":129,"stem":130},"Getting started","\u002Fpackages\u002Fphp\u002Freadme","3.packages\u002F1.php\u002F00.readme",{"title":68,"path":132,"stem":133},"\u002Fpackages\u002Fphp\u002Fcustomers","3.packages\u002F1.php\u002F02.customers",{"title":80,"path":135,"stem":136},"\u002Fpackages\u002Fphp\u002Fcheckouts","3.packages\u002F1.php\u002F03.checkouts",{"title":88,"path":138,"stem":139},"\u002Fpackages\u002Fphp\u002Fsubscriptions","3.packages\u002F1.php\u002F04.subscriptions",{"title":141,"path":142,"stem":143},"Subscription plans","\u002Fpackages\u002Fphp\u002Fsubscriptionplans","3.packages\u002F1.php\u002F05.subscriptionplans",{"title":96,"path":145,"stem":146},"\u002Fpackages\u002Fphp\u002Forders","3.packages\u002F1.php\u002F06.orders",{"title":148,"path":149,"stem":150},"One-off products","\u002Fpackages\u002Fphp\u002Foneoffproducts","3.packages\u002F1.php\u002F07.oneoffproducts",{"title":104,"path":152,"stem":153},"\u002Fpackages\u002Fphp\u002Frefunds","3.packages\u002F1.php\u002F08.refunds",{"title":108,"path":155,"stem":156},"\u002Fpackages\u002Fphp\u002Fchargebacks","3.packages\u002F1.php\u002F09.chargebacks",{"title":50,"path":158,"stem":159},"\u002Fpackages\u002Fphp\u002Fwebhooks","3.packages\u002F1.php\u002F10.webhooks",{"title":161,"path":162,"stem":163},"Webhook URLs","\u002Fpackages\u002Fphp\u002Fwebhookendpoints","3.packages\u002F1.php\u002F11.webhookendpoints",{"title":165,"path":166,"stem":167,"children":168,"page":61},"PHP Fluent","\u002Fpackages\u002Ffluent-php","3.packages\u002F2.fluent-php",[169,172,176,180,183,186,189,192,196,199,203,207],{"title":128,"path":170,"stem":171},"\u002Fpackages\u002Ffluent-php\u002Freadme","3.packages\u002F2.fluent-php\u002F00.readme",{"title":173,"path":174,"stem":175},"Configuration","\u002Fpackages\u002Ffluent-php\u002Fconfiguration","3.packages\u002F2.fluent-php\u002F01.configuration",{"title":177,"path":178,"stem":179},"Core concepts","\u002Fpackages\u002Ffluent-php\u002Fcoreconcepts","3.packages\u002F2.fluent-php\u002F02.coreconcepts",{"title":68,"path":181,"stem":182},"\u002Fpackages\u002Ffluent-php\u002Fcustomers","3.packages\u002F2.fluent-php\u002F03.customers",{"title":80,"path":184,"stem":185},"\u002Fpackages\u002Ffluent-php\u002Fcheckouts","3.packages\u002F2.fluent-php\u002F04.checkouts",{"title":88,"path":187,"stem":188},"\u002Fpackages\u002Ffluent-php\u002Fsubscriptions","3.packages\u002F2.fluent-php\u002F05.subscriptions",{"title":96,"path":190,"stem":191},"\u002Fpackages\u002Ffluent-php\u002Forders","3.packages\u002F2.fluent-php\u002F06.orders",{"title":193,"path":194,"stem":195},"Customer portal","\u002Fpackages\u002Ffluent-php\u002Fcustomerportal","3.packages\u002F2.fluent-php\u002F07.customerportal",{"title":50,"path":197,"stem":198},"\u002Fpackages\u002Ffluent-php\u002Fwebhooks","3.packages\u002F2.fluent-php\u002F08.webhooks",{"title":200,"path":201,"stem":202},"Webhook event flow","\u002Fpackages\u002Ffluent-php\u002Fwebhook-flow","3.packages\u002F2.fluent-php\u002F09.webhook-flow",{"title":204,"path":205,"stem":206},"Existing tables","\u002Fpackages\u002Ffluent-php\u002Fhost-owns-its-tables","3.packages\u002F2.fluent-php\u002F10.host-owns-its-tables",{"title":58,"path":208,"stem":209},"\u002Fpackages\u002Ffluent-php\u002Ftesting","3.packages\u002F2.fluent-php\u002F11.testing",{"title":211,"path":212,"stem":213,"children":214,"page":61},"Laravel","\u002Fpackages\u002Flaravel","3.packages\u002F3.laravel",[215,218,221,224,227,230,233,236,240],{"title":128,"path":216,"stem":217},"\u002Fpackages\u002Flaravel\u002Freadme","3.packages\u002F3.laravel\u002F00.readme",{"title":173,"path":219,"stem":220},"\u002Fpackages\u002Flaravel\u002Fconfiguration","3.packages\u002F3.laravel\u002F01.configuration",{"title":68,"path":222,"stem":223},"\u002Fpackages\u002Flaravel\u002Fcustomers","3.packages\u002F3.laravel\u002F02.customers",{"title":80,"path":225,"stem":226},"\u002Fpackages\u002Flaravel\u002Fcheckouts","3.packages\u002F3.laravel\u002F03.checkouts",{"title":88,"path":228,"stem":229},"\u002Fpackages\u002Flaravel\u002Fsubscriptions","3.packages\u002F3.laravel\u002F04.subscriptions",{"title":96,"path":231,"stem":232},"\u002Fpackages\u002Flaravel\u002Forders","3.packages\u002F3.laravel\u002F05.orders",{"title":50,"path":234,"stem":235},"\u002Fpackages\u002Flaravel\u002Fwebhooks","3.packages\u002F3.laravel\u002F06.webhooks",{"title":237,"path":238,"stem":239},"Comparison","\u002Fpackages\u002Flaravel\u002Fcomparison","3.packages\u002F3.laravel\u002F07.comparison",{"title":241,"path":242,"stem":243},"Migrating from Cashier","\u002Fpackages\u002Flaravel\u002Fmigrating-to-vatly","3.packages\u002F3.laravel\u002F08.migrating-to-vatly",{"title":245,"path":246,"stem":247,"children":248,"page":61},"JavaScript SDK","\u002Fpackages\u002Fjavascript","3.packages\u002F4.javascript",[249,252,255,258,261,264,267,270,273,276,279],{"title":128,"path":250,"stem":251},"\u002Fpackages\u002Fjavascript\u002Freadme","3.packages\u002F4.javascript\u002F00.readme",{"title":68,"path":253,"stem":254},"\u002Fpackages\u002Fjavascript\u002Fcustomers","3.packages\u002F4.javascript\u002F02.customers",{"title":80,"path":256,"stem":257},"\u002Fpackages\u002Fjavascript\u002Fcheckouts","3.packages\u002F4.javascript\u002F03.checkouts",{"title":88,"path":259,"stem":260},"\u002Fpackages\u002Fjavascript\u002Fsubscriptions","3.packages\u002F4.javascript\u002F04.subscriptions",{"title":141,"path":262,"stem":263},"\u002Fpackages\u002Fjavascript\u002Fsubscriptionplans","3.packages\u002F4.javascript\u002F05.subscriptionplans",{"title":96,"path":265,"stem":266},"\u002Fpackages\u002Fjavascript\u002Forders","3.packages\u002F4.javascript\u002F06.orders",{"title":148,"path":268,"stem":269},"\u002Fpackages\u002Fjavascript\u002Foneoffproducts","3.packages\u002F4.javascript\u002F07.oneoffproducts",{"title":104,"path":271,"stem":272},"\u002Fpackages\u002Fjavascript\u002Frefunds","3.packages\u002F4.javascript\u002F08.refunds",{"title":108,"path":274,"stem":275},"\u002Fpackages\u002Fjavascript\u002Fchargebacks","3.packages\u002F4.javascript\u002F09.chargebacks",{"title":50,"path":277,"stem":278},"\u002Fpackages\u002Fjavascript\u002Fwebhooks","3.packages\u002F4.javascript\u002F10.webhooks",{"title":280,"path":281,"stem":282},"API reference","\u002Fpackages\u002Fjavascript\u002Fapi","3.packages\u002F4.javascript\u002F12.api",{"title":284,"path":285,"stem":286,"children":287,"page":61},"JavaScript Fluent","\u002Fpackages\u002Ffluent-js","3.packages\u002F5.fluent-js",[288,291,294,297,300,303,306,309,312,315],{"title":128,"path":289,"stem":290},"\u002Fpackages\u002Ffluent-js\u002Freadme","3.packages\u002F5.fluent-js\u002F00.readme",{"title":173,"path":292,"stem":293},"\u002Fpackages\u002Ffluent-js\u002Fconfiguration","3.packages\u002F5.fluent-js\u002F01.configuration",{"title":177,"path":295,"stem":296},"\u002Fpackages\u002Ffluent-js\u002Fcoreconcepts","3.packages\u002F5.fluent-js\u002F02.coreconcepts",{"title":68,"path":298,"stem":299},"\u002Fpackages\u002Ffluent-js\u002Fcustomers","3.packages\u002F5.fluent-js\u002F03.customers",{"title":80,"path":301,"stem":302},"\u002Fpackages\u002Ffluent-js\u002Fcheckouts","3.packages\u002F5.fluent-js\u002F04.checkouts",{"title":88,"path":304,"stem":305},"\u002Fpackages\u002Ffluent-js\u002Fsubscriptions","3.packages\u002F5.fluent-js\u002F05.subscriptions",{"title":96,"path":307,"stem":308},"\u002Fpackages\u002Ffluent-js\u002Forders","3.packages\u002F5.fluent-js\u002F06.orders",{"title":193,"path":310,"stem":311},"\u002Fpackages\u002Ffluent-js\u002Fcustomerportal","3.packages\u002F5.fluent-js\u002F07.customerportal",{"title":50,"path":313,"stem":314},"\u002Fpackages\u002Ffluent-js\u002Fwebhooks","3.packages\u002F5.fluent-js\u002F08.webhooks",{"title":58,"path":316,"stem":317},"\u002Fpackages\u002Ffluent-js\u002Ftesting","3.packages\u002F5.fluent-js\u002F11.testing",{"title":319,"path":320,"stem":321,"children":322,"page":61},"Python SDK","\u002Fpackages\u002Fpython","3.packages\u002F6.python",[323,326,329,332,335,338,341,344,347,350,353,356,359,362],{"title":128,"path":324,"stem":325},"\u002Fpackages\u002Fpython\u002Freadme","3.packages\u002F6.python\u002F00.readme",{"title":173,"path":327,"stem":328},"\u002Fpackages\u002Fpython\u002Fconfiguration","3.packages\u002F6.python\u002F01.configuration",{"title":68,"path":330,"stem":331},"\u002Fpackages\u002Fpython\u002Fcustomers","3.packages\u002F6.python\u002F02.customers",{"title":80,"path":333,"stem":334},"\u002Fpackages\u002Fpython\u002Fcheckouts","3.packages\u002F6.python\u002F03.checkouts",{"title":88,"path":336,"stem":337},"\u002Fpackages\u002Fpython\u002Fsubscriptions","3.packages\u002F6.python\u002F04.subscriptions",{"title":141,"path":339,"stem":340},"\u002Fpackages\u002Fpython\u002Fsubscriptionplans","3.packages\u002F6.python\u002F05.subscriptionplans",{"title":96,"path":342,"stem":343},"\u002Fpackages\u002Fpython\u002Forders","3.packages\u002F6.python\u002F06.orders",{"title":148,"path":345,"stem":346},"\u002Fpackages\u002Fpython\u002Foneoffproducts","3.packages\u002F6.python\u002F07.oneoffproducts",{"title":104,"path":348,"stem":349},"\u002Fpackages\u002Fpython\u002Frefunds","3.packages\u002F6.python\u002F08.refunds",{"title":108,"path":351,"stem":352},"\u002Fpackages\u002Fpython\u002Fchargebacks","3.packages\u002F6.python\u002F09.chargebacks",{"title":50,"path":354,"stem":355},"\u002Fpackages\u002Fpython\u002Fwebhooks","3.packages\u002F6.python\u002F10.webhooks",{"title":161,"path":357,"stem":358},"\u002Fpackages\u002Fpython\u002Fwebhookendpoints","3.packages\u002F6.python\u002F11.webhookendpoints",{"title":280,"path":360,"stem":361},"\u002Fpackages\u002Fpython\u002Fapi","3.packages\u002F6.python\u002F12.api",{"title":363,"path":364,"stem":365},"Development","\u002Fpackages\u002Fpython\u002Fdevelopment","3.packages\u002F6.python\u002F13.development",{"title":367,"path":368,"stem":369,"children":370,"page":61},"Python Fluent","\u002Fpackages\u002Ffluent-python","3.packages\u002F7.fluent-python",[371,374,377,380,383,386,389,392,395,398,401,405],{"title":128,"path":372,"stem":373},"\u002Fpackages\u002Ffluent-python\u002Freadme","3.packages\u002F7.fluent-python\u002F00.readme",{"title":173,"path":375,"stem":376},"\u002Fpackages\u002Ffluent-python\u002Fconfiguration","3.packages\u002F7.fluent-python\u002F01.configuration",{"title":177,"path":378,"stem":379},"\u002Fpackages\u002Ffluent-python\u002Fcoreconcepts","3.packages\u002F7.fluent-python\u002F02.coreconcepts",{"title":68,"path":381,"stem":382},"\u002Fpackages\u002Ffluent-python\u002Fcustomers","3.packages\u002F7.fluent-python\u002F03.customers",{"title":80,"path":384,"stem":385},"\u002Fpackages\u002Ffluent-python\u002Fcheckouts","3.packages\u002F7.fluent-python\u002F04.checkouts",{"title":88,"path":387,"stem":388},"\u002Fpackages\u002Ffluent-python\u002Fsubscriptions","3.packages\u002F7.fluent-python\u002F05.subscriptions",{"title":96,"path":390,"stem":391},"\u002Fpackages\u002Ffluent-python\u002Forders","3.packages\u002F7.fluent-python\u002F06.orders",{"title":193,"path":393,"stem":394},"\u002Fpackages\u002Ffluent-python\u002Fcustomerportal","3.packages\u002F7.fluent-python\u002F07.customerportal",{"title":50,"path":396,"stem":397},"\u002Fpackages\u002Ffluent-python\u002Fwebhooks","3.packages\u002F7.fluent-python\u002F08.webhooks",{"title":58,"path":399,"stem":400},"\u002Fpackages\u002Ffluent-python\u002Ftesting","3.packages\u002F7.fluent-python\u002F11.testing",{"title":402,"path":403,"stem":404},"Porting","\u002Fpackages\u002Ffluent-python\u002Fporting","3.packages\u002F7.fluent-python\u002F12.porting",{"title":363,"path":406,"stem":407},"\u002Fpackages\u002Ffluent-python\u002Fdevelopment","3.packages\u002F7.fluent-python\u002F13.development",{"title":409,"path":410,"stem":411,"children":412,"page":61},"Django","\u002Fpackages\u002Fdjango","3.packages\u002F8.django",[413,416,420,423,427,431,434,437,440,444,447],{"title":128,"path":414,"stem":415},"\u002Fpackages\u002Fdjango\u002Freadme","3.packages\u002F8.django\u002F00.readme",{"title":417,"path":418,"stem":419},"Installation","\u002Fpackages\u002Fdjango\u002Finstallation","3.packages\u002F8.django\u002F01.installation",{"title":173,"path":421,"stem":422},"\u002Fpackages\u002Fdjango\u002Fconfiguration","3.packages\u002F8.django\u002F02.configuration",{"title":424,"path":425,"stem":426},"Billable models","\u002Fpackages\u002Fdjango\u002Fbillablemodels","3.packages\u002F8.django\u002F03.billablemodels",{"title":428,"path":429,"stem":430},"Checkout","\u002Fpackages\u002Fdjango\u002Fcheckout","3.packages\u002F8.django\u002F04.checkout",{"title":88,"path":432,"stem":433},"\u002Fpackages\u002Fdjango\u002Fbilling","3.packages\u002F8.django\u002F05.billing",{"title":193,"path":435,"stem":436},"\u002Fpackages\u002Fdjango\u002Fcustomerportal","3.packages\u002F8.django\u002F06.customerportal",{"title":50,"path":438,"stem":439},"\u002Fpackages\u002Fdjango\u002Fwebhooks","3.packages\u002F8.django\u002F07.webhooks",{"title":441,"path":442,"stem":443},"Admin","\u002Fpackages\u002Fdjango\u002Fadmin","3.packages\u002F8.django\u002F08.admin",{"title":58,"path":445,"stem":446},"\u002Fpackages\u002Fdjango\u002Ftesting","3.packages\u002F8.django\u002F09.testing",{"title":363,"path":448,"stem":449},"\u002Fpackages\u002Fdjango\u002Fdevelopment","3.packages\u002F8.django\u002F10.development",{"title":451,"path":452,"stem":453,"children":454},"Integrations","\u002Fintegrations","4.integrations",[455,457,461],{"title":451,"path":452,"stem":456},"4.integrations\u002Findex",{"title":458,"path":459,"stem":460},"Lovable payments with Vatly","\u002Fintegrations\u002Flovable","4.integrations\u002F1.lovable",{"title":462,"path":463,"stem":464},"Bolt payments with Vatly","\u002Fintegrations\u002Fbolt","4.integrations\u002F2.bolt",{"id":466,"title":88,"body":467,"description":1430,"extension":1431,"links":1432,"meta":1433,"navigation":1434,"path":304,"seo":1435,"stem":305,"__hash__":1436},"docs\u002F3.packages\u002F5.fluent-js\u002F05.subscriptions.md",{"type":468,"value":469,"toc":1423},"minimark",[470,488,493,839,842,907,918,922,1165,1187,1228,1233,1260,1264,1399,1410,1419],[471,472,473,474,478,479,483,484,487],"p",{},"Change an existing subscription with ",[475,476,477],"code",{},"vatly.subscription(localRecord)",". Load and\nauthorize the record from your ",[480,481,482],"a",{"href":295},"repository","; wire that repository\ninto ",[475,485,486],{},"Vatly"," so swap, resume, and sync can save changes.",[489,490,492],"h2",{"id":491},"change-plan-or-quantity","Change plan or quantity",[494,495,500],"pre",{"className":496,"code":497,"language":498,"meta":499,"style":499},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import type { LocalSubscription, Vatly } from '@getvatly\u002Ffluent';\n\nexport async function schedulePlan(vatly: Vatly, local: LocalSubscription, planId: string) {\n  return vatly.subscription(local).swap(planId, { quantity: 2 });\n}\n\nexport async function changeAndInvoice(vatly: Vatly, local: LocalSubscription, planId: string) {\n  return vatly.subscription(local).swapAndInvoice(planId, { quantity: 2 });\n}\n\nexport async function changeWithoutCharge(vatly: Vatly, local: LocalSubscription, planId: string) {\n  return vatly.subscription(local).swapWithoutCharge(planId);\n}\n","ts","",[475,501,502,547,554,609,661,667,672,712,754,759,764,804,834],{"__ignoreMap":499},[503,504,507,511,514,518,522,525,528,531,534,537,541,544],"span",{"class":505,"line":506},"line",1,[503,508,510],{"class":509},"s7zQu","import",[503,512,513],{"class":509}," type",[503,515,517],{"class":516},"sMK4o"," {",[503,519,521],{"class":520},"sTEyZ"," LocalSubscription",[503,523,524],{"class":516},",",[503,526,527],{"class":520}," Vatly",[503,529,530],{"class":516}," }",[503,532,533],{"class":509}," from",[503,535,536],{"class":516}," '",[503,538,540],{"class":539},"sfazB","@getvatly\u002Ffluent",[503,542,543],{"class":516},"'",[503,545,546],{"class":516},";\n",[503,548,550],{"class":505,"line":549},2,[503,551,553],{"emptyLinePlaceholder":552},true,"\n",[503,555,557,560,564,567,571,574,578,581,584,586,589,591,593,595,598,600,603,606],{"class":505,"line":556},3,[503,558,559],{"class":509},"export",[503,561,563],{"class":562},"spNyl"," async",[503,565,566],{"class":562}," function",[503,568,570],{"class":569},"s2Zo4"," schedulePlan",[503,572,573],{"class":516},"(",[503,575,577],{"class":576},"sHdIc","vatly",[503,579,580],{"class":516},":",[503,582,527],{"class":583},"sBMFI",[503,585,524],{"class":516},[503,587,588],{"class":576}," local",[503,590,580],{"class":516},[503,592,521],{"class":583},[503,594,524],{"class":516},[503,596,597],{"class":576}," planId",[503,599,580],{"class":516},[503,601,602],{"class":583}," string",[503,604,605],{"class":516},")",[503,607,608],{"class":516}," {\n",[503,610,612,615,618,621,624,627,630,632,634,637,639,642,644,646,649,651,655,657,659],{"class":505,"line":611},4,[503,613,614],{"class":509},"  return",[503,616,617],{"class":520}," vatly",[503,619,620],{"class":516},".",[503,622,623],{"class":569},"subscription",[503,625,573],{"class":626},"swJcz",[503,628,629],{"class":520},"local",[503,631,605],{"class":626},[503,633,620],{"class":516},[503,635,636],{"class":569},"swap",[503,638,573],{"class":626},[503,640,641],{"class":520},"planId",[503,643,524],{"class":516},[503,645,517],{"class":516},[503,647,648],{"class":626}," quantity",[503,650,580],{"class":516},[503,652,654],{"class":653},"sbssI"," 2",[503,656,530],{"class":516},[503,658,605],{"class":626},[503,660,546],{"class":516},[503,662,664],{"class":505,"line":663},5,[503,665,666],{"class":516},"}\n",[503,668,670],{"class":505,"line":669},6,[503,671,553],{"emptyLinePlaceholder":552},[503,673,675,677,679,681,684,686,688,690,692,694,696,698,700,702,704,706,708,710],{"class":505,"line":674},7,[503,676,559],{"class":509},[503,678,563],{"class":562},[503,680,566],{"class":562},[503,682,683],{"class":569}," changeAndInvoice",[503,685,573],{"class":516},[503,687,577],{"class":576},[503,689,580],{"class":516},[503,691,527],{"class":583},[503,693,524],{"class":516},[503,695,588],{"class":576},[503,697,580],{"class":516},[503,699,521],{"class":583},[503,701,524],{"class":516},[503,703,597],{"class":576},[503,705,580],{"class":516},[503,707,602],{"class":583},[503,709,605],{"class":516},[503,711,608],{"class":516},[503,713,715,717,719,721,723,725,727,729,731,734,736,738,740,742,744,746,748,750,752],{"class":505,"line":714},8,[503,716,614],{"class":509},[503,718,617],{"class":520},[503,720,620],{"class":516},[503,722,623],{"class":569},[503,724,573],{"class":626},[503,726,629],{"class":520},[503,728,605],{"class":626},[503,730,620],{"class":516},[503,732,733],{"class":569},"swapAndInvoice",[503,735,573],{"class":626},[503,737,641],{"class":520},[503,739,524],{"class":516},[503,741,517],{"class":516},[503,743,648],{"class":626},[503,745,580],{"class":516},[503,747,654],{"class":653},[503,749,530],{"class":516},[503,751,605],{"class":626},[503,753,546],{"class":516},[503,755,757],{"class":505,"line":756},9,[503,758,666],{"class":516},[503,760,762],{"class":505,"line":761},10,[503,763,553],{"emptyLinePlaceholder":552},[503,765,767,769,771,773,776,778,780,782,784,786,788,790,792,794,796,798,800,802],{"class":505,"line":766},11,[503,768,559],{"class":509},[503,770,563],{"class":562},[503,772,566],{"class":562},[503,774,775],{"class":569}," changeWithoutCharge",[503,777,573],{"class":516},[503,779,577],{"class":576},[503,781,580],{"class":516},[503,783,527],{"class":583},[503,785,524],{"class":516},[503,787,588],{"class":576},[503,789,580],{"class":516},[503,791,521],{"class":583},[503,793,524],{"class":516},[503,795,597],{"class":576},[503,797,580],{"class":516},[503,799,602],{"class":583},[503,801,605],{"class":516},[503,803,608],{"class":516},[503,805,807,809,811,813,815,817,819,821,823,826,828,830,832],{"class":505,"line":806},12,[503,808,614],{"class":509},[503,810,617],{"class":520},[503,812,620],{"class":516},[503,814,623],{"class":569},[503,816,573],{"class":626},[503,818,629],{"class":520},[503,820,605],{"class":626},[503,822,620],{"class":516},[503,824,825],{"class":569},"swapWithoutCharge",[503,827,573],{"class":626},[503,829,641],{"class":520},[503,831,605],{"class":626},[503,833,546],{"class":516},[503,835,837],{"class":505,"line":836},13,[503,838,666],{"class":516},[471,840,841],{},"Choose one action:",[843,844,845,858],"table",{},[846,847,848],"thead",{},[849,850,851,855],"tr",{},[852,853,854],"th",{},"Method",[852,856,857],{},"Options sent to the API",[859,860,861,876,893],"tbody",{},[849,862,863,869],{},[864,865,866],"td",{},[475,867,868],{},"swap(planId, body?, requestOptions?)",[864,870,871,872,875],{},"Your update options; without ",[475,873,874],{},"applyImmediately",", changes are scheduled.",[849,877,878,883],{},[864,879,880],{},[475,881,882],{},"swapAndInvoice(...)",[864,884,885,886,889,890,620],{},"Forces ",[475,887,888],{},"applyImmediately: true",", ",[475,891,892],{},"invoiceImmediately: true",[849,894,895,900],{},[864,896,897],{},[475,898,899],{},"swapWithoutCharge(...)",[864,901,885,902,889,904,620],{},[475,903,888],{},[475,905,906],{},"prorationCharge: false",[471,908,909,910,913,914,917],{},"Local plan and quantity follow the API response. A scheduled swap leaves the\ncurrent plan unchanged. ",[475,911,912],{},"scheduledUpdate()"," fetches the pending change;\n",[475,915,916],{},"hasScheduledUpdate()"," checks whether one exists. See the API reference below\nfor proration rules.",[489,919,921],{"id":920},"cancel-and-resume","Cancel and resume",[494,923,925],{"className":496,"code":924,"language":498,"meta":499,"style":499},"import type { LocalSubscription, Vatly } from '@getvatly\u002Ffluent';\n\nexport async function cancelNow(vatly: Vatly, local: LocalSubscription, operationId: string) {\n  await vatly.subscription(local).cancel({\n    immediately: true,\n    idempotencyKey: `cancel:${operationId}`,\n  });\n}\n\nexport async function resume(vatly: Vatly, local: LocalSubscription) {\n  const handle = await vatly.subscription(local).resume();\n  return handle.model();\n}\n",[475,926,927,953,957,997,1024,1038,1062,1071,1075,1079,1110,1146,1161],{"__ignoreMap":499},[503,928,929,931,933,935,937,939,941,943,945,947,949,951],{"class":505,"line":506},[503,930,510],{"class":509},[503,932,513],{"class":509},[503,934,517],{"class":516},[503,936,521],{"class":520},[503,938,524],{"class":516},[503,940,527],{"class":520},[503,942,530],{"class":516},[503,944,533],{"class":509},[503,946,536],{"class":516},[503,948,540],{"class":539},[503,950,543],{"class":516},[503,952,546],{"class":516},[503,954,955],{"class":505,"line":549},[503,956,553],{"emptyLinePlaceholder":552},[503,958,959,961,963,965,968,970,972,974,976,978,980,982,984,986,989,991,993,995],{"class":505,"line":556},[503,960,559],{"class":509},[503,962,563],{"class":562},[503,964,566],{"class":562},[503,966,967],{"class":569}," cancelNow",[503,969,573],{"class":516},[503,971,577],{"class":576},[503,973,580],{"class":516},[503,975,527],{"class":583},[503,977,524],{"class":516},[503,979,588],{"class":576},[503,981,580],{"class":516},[503,983,521],{"class":583},[503,985,524],{"class":516},[503,987,988],{"class":576}," operationId",[503,990,580],{"class":516},[503,992,602],{"class":583},[503,994,605],{"class":516},[503,996,608],{"class":516},[503,998,999,1002,1004,1006,1008,1010,1012,1014,1016,1019,1021],{"class":505,"line":611},[503,1000,1001],{"class":509},"  await",[503,1003,617],{"class":520},[503,1005,620],{"class":516},[503,1007,623],{"class":569},[503,1009,573],{"class":626},[503,1011,629],{"class":520},[503,1013,605],{"class":626},[503,1015,620],{"class":516},[503,1017,1018],{"class":569},"cancel",[503,1020,573],{"class":626},[503,1022,1023],{"class":516},"{\n",[503,1025,1026,1029,1031,1035],{"class":505,"line":663},[503,1027,1028],{"class":626},"    immediately",[503,1030,580],{"class":516},[503,1032,1034],{"class":1033},"sfNiH"," true",[503,1036,1037],{"class":516},",\n",[503,1039,1040,1043,1045,1048,1051,1054,1057,1060],{"class":505,"line":669},[503,1041,1042],{"class":626},"    idempotencyKey",[503,1044,580],{"class":516},[503,1046,1047],{"class":516}," `",[503,1049,1050],{"class":539},"cancel:",[503,1052,1053],{"class":516},"${",[503,1055,1056],{"class":520},"operationId",[503,1058,1059],{"class":516},"}`",[503,1061,1037],{"class":516},[503,1063,1064,1067,1069],{"class":505,"line":674},[503,1065,1066],{"class":516},"  }",[503,1068,605],{"class":626},[503,1070,546],{"class":516},[503,1072,1073],{"class":505,"line":714},[503,1074,666],{"class":516},[503,1076,1077],{"class":505,"line":756},[503,1078,553],{"emptyLinePlaceholder":552},[503,1080,1081,1083,1085,1087,1090,1092,1094,1096,1098,1100,1102,1104,1106,1108],{"class":505,"line":761},[503,1082,559],{"class":509},[503,1084,563],{"class":562},[503,1086,566],{"class":562},[503,1088,1089],{"class":569}," resume",[503,1091,573],{"class":516},[503,1093,577],{"class":576},[503,1095,580],{"class":516},[503,1097,527],{"class":583},[503,1099,524],{"class":516},[503,1101,588],{"class":576},[503,1103,580],{"class":516},[503,1105,521],{"class":583},[503,1107,605],{"class":516},[503,1109,608],{"class":516},[503,1111,1112,1115,1118,1121,1124,1126,1128,1130,1132,1134,1136,1138,1141,1144],{"class":505,"line":766},[503,1113,1114],{"class":562},"  const",[503,1116,1117],{"class":520}," handle",[503,1119,1120],{"class":516}," =",[503,1122,1123],{"class":509}," await",[503,1125,617],{"class":520},[503,1127,620],{"class":516},[503,1129,623],{"class":569},[503,1131,573],{"class":626},[503,1133,629],{"class":520},[503,1135,605],{"class":626},[503,1137,620],{"class":516},[503,1139,1140],{"class":569},"resume",[503,1142,1143],{"class":626},"()",[503,1145,546],{"class":516},[503,1147,1148,1150,1152,1154,1157,1159],{"class":505,"line":806},[503,1149,614],{"class":509},[503,1151,1117],{"class":520},[503,1153,620],{"class":516},[503,1155,1156],{"class":569},"model",[503,1158,1143],{"class":626},[503,1160,546],{"class":516},[503,1162,1163],{"class":505,"line":836},[503,1164,666],{"class":516},[471,1166,1167,1170,1171,1174,1175,1178,1179,1182,1183,1186],{},[475,1168,1169],{},"cancel()"," uses the API's default timing; ",[475,1172,1173],{},"{ immediately: true }"," cancels now.\nCancellation waits for ",[480,1176,1177],{"href":313},"webhooks"," to set local ",[475,1180,1181],{},"endsAt",". Resume clears\nit after the API succeeds. ",[475,1184,1185],{},"cancellationReason()"," fetches the remote reason.",[471,1188,1189,1192,1193,1196,1197,1200,1201,889,1204,889,1207,889,1210,889,1213,1216,1217,1220,1221,1223,1224,1227],{},[475,1190,1191],{},"model()"," returns the local record. ",[475,1194,1195],{},"sync()"," fetches and saves the API resource.\n",[475,1198,1199],{},"state()"," derives ",[475,1202,1203],{},"active",[475,1205,1206],{},"valid",[475,1208,1209],{},"recurring",[475,1211,1212],{},"cancelled",[475,1214,1215],{},"onGracePeriod",", and\n",[475,1218,1219],{},"ended"," from ",[475,1222,1181],{},". Check Vatly's ",[475,1225,1226],{},"status"," separately for states such as paused.",[1229,1230,1232],"h3",{"id":1231},"grace-period-limitation-in-this-alpha","Grace-period limitation in this alpha",[471,1234,1235,1236,1238,1239,1241,1242,1245,1246,1249,1250,1253,1254,1256,1257,1259],{},"This alpha's ",[475,1237,1195],{}," and cancellation reactions set ",[475,1240,1181],{}," to\n",[475,1243,1244],{},"endedAt ?? canceledAt",". During a grace period, ",[475,1247,1248],{},"endedAt"," can be null and\n",[475,1251,1252],{},"canceledAt"," is the cancellation request time, not the access deadline. The local\nflags can therefore report an ended subscription while access is still owed.\nKeep entitlement decisions separate from ",[475,1255,1199],{}," until this is corrected;\nconfirm the grace deadline before changing access. Do not use ",[475,1258,1252],{}," as an expiry.",[489,1261,1263],{"id":1262},"update-billing-details","Update billing details",[494,1265,1267],{"className":496,"code":1266,"language":498,"meta":499,"style":499},"import type { LocalSubscription, Vatly } from '@getvatly\u002Ffluent';\n\nexport async function billingUpdateUrl(vatly: Vatly, local: LocalSubscription) {\n  return vatly.subscription(local).updateBilling({\n    redirectUrlSuccess: 'https:\u002F\u002Fapp.example.com\u002Fbilling\u002Fupdated',\n    redirectUrlCanceled: 'https:\u002F\u002Fapp.example.com\u002Fbilling\u002Fcanceled',\n  });\n}\n",[475,1268,1269,1295,1299,1330,1355,1371,1387,1395],{"__ignoreMap":499},[503,1270,1271,1273,1275,1277,1279,1281,1283,1285,1287,1289,1291,1293],{"class":505,"line":506},[503,1272,510],{"class":509},[503,1274,513],{"class":509},[503,1276,517],{"class":516},[503,1278,521],{"class":520},[503,1280,524],{"class":516},[503,1282,527],{"class":520},[503,1284,530],{"class":516},[503,1286,533],{"class":509},[503,1288,536],{"class":516},[503,1290,540],{"class":539},[503,1292,543],{"class":516},[503,1294,546],{"class":516},[503,1296,1297],{"class":505,"line":549},[503,1298,553],{"emptyLinePlaceholder":552},[503,1300,1301,1303,1305,1307,1310,1312,1314,1316,1318,1320,1322,1324,1326,1328],{"class":505,"line":556},[503,1302,559],{"class":509},[503,1304,563],{"class":562},[503,1306,566],{"class":562},[503,1308,1309],{"class":569}," billingUpdateUrl",[503,1311,573],{"class":516},[503,1313,577],{"class":576},[503,1315,580],{"class":516},[503,1317,527],{"class":583},[503,1319,524],{"class":516},[503,1321,588],{"class":576},[503,1323,580],{"class":516},[503,1325,521],{"class":583},[503,1327,605],{"class":516},[503,1329,608],{"class":516},[503,1331,1332,1334,1336,1338,1340,1342,1344,1346,1348,1351,1353],{"class":505,"line":611},[503,1333,614],{"class":509},[503,1335,617],{"class":520},[503,1337,620],{"class":516},[503,1339,623],{"class":569},[503,1341,573],{"class":626},[503,1343,629],{"class":520},[503,1345,605],{"class":626},[503,1347,620],{"class":516},[503,1349,1350],{"class":569},"updateBilling",[503,1352,573],{"class":626},[503,1354,1023],{"class":516},[503,1356,1357,1360,1362,1364,1367,1369],{"class":505,"line":663},[503,1358,1359],{"class":626},"    redirectUrlSuccess",[503,1361,580],{"class":516},[503,1363,536],{"class":516},[503,1365,1366],{"class":539},"https:\u002F\u002Fapp.example.com\u002Fbilling\u002Fupdated",[503,1368,543],{"class":516},[503,1370,1037],{"class":516},[503,1372,1373,1376,1378,1380,1383,1385],{"class":505,"line":669},[503,1374,1375],{"class":626},"    redirectUrlCanceled",[503,1377,580],{"class":516},[503,1379,536],{"class":516},[503,1381,1382],{"class":539},"https:\u002F\u002Fapp.example.com\u002Fbilling\u002Fcanceled",[503,1384,543],{"class":516},[503,1386,1037],{"class":516},[503,1388,1389,1391,1393],{"class":505,"line":674},[503,1390,1066],{"class":516},[503,1392,605],{"class":626},[503,1394,546],{"class":516},[503,1396,1397],{"class":505,"line":714},[503,1398,666],{"class":516},[471,1400,1401,1402,1405,1406,1409],{},"Redirect to the returned URL; do not log or persist it. This hosted flow updates\nbilling details, rather than writing address fields directly. Both redirects are\nrequired here or in ",[480,1403,1404],{"href":292},"configuration",". Process\n",[475,1407,1408],{},"subscription.billing_updated"," to update local payment details.",[471,1411,1412,1413,620],{},"For all options, eligibility, and fields, see the\n",[480,1414,1418],{"href":1415,"rel":1416},"https:\u002F\u002Fdocs.vatly.com\u002Fapi-reference\u002Fsubscriptions",[1417],"nofollow","Subscriptions API reference",[1420,1421,1422],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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);}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":499,"searchDepth":549,"depth":549,"links":1424},[1425,1426,1429],{"id":491,"depth":549,"text":492},{"id":920,"depth":549,"text":921,"children":1427},[1428],{"id":1231,"depth":556,"text":1232},{"id":1262,"depth":549,"text":1263},"Change an existing subscription with vatly.subscription(localRecord).","md",null,{},{"title":88},{"title":88,"description":1430},"v-39tvz_PR23u2kt6p_kbHDMwGOhPRFMO8aZ2YnwC3E",[1438,1440],{"title":80,"path":301,"stem":302,"description":1439,"children":-1},"Create a hosted payment page, then redirect the customer to checkout.getUrl().",{"title":96,"path":307,"stem":308,"description":1441,"children":-1},"Fetch an order's invoice link, lines, and totals after checking the caller owns it.",1794594930986]