dodopayments-mcp 2.53.0 → 2.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/local-docs-search.d.mts.map +1 -1
- package/local-docs-search.d.ts.map +1 -1
- package/local-docs-search.js +8 -4
- package/local-docs-search.js.map +1 -1
- package/local-docs-search.mjs +8 -4
- package/local-docs-search.mjs.map +1 -1
- package/package.json +2 -2
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/local-docs-search.ts +8 -4
- package/src/server.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-docs-search.d.mts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;
|
|
1
|
+
{"version":3,"file":"local-docs-search.d.mts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;AAw2SF;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,UAAU,CAAiC;IAEnD,OAAO;WAKM,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAY1E,MAAM,CAAC,KAAK,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,YAAY;IA2EhB,OAAO,CAAC,YAAY;YAiBN,iBAAiB;IA4C/B,OAAO,CAAC,UAAU;CAgBnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-docs-search.d.ts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;
|
|
1
|
+
{"version":3,"file":"local-docs-search.d.ts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;AAw2SF;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,UAAU,CAAiC;IAEnD,OAAO;WAKM,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAY1E,MAAM,CAAC,KAAK,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,YAAY;IA2EhB,OAAO,CAAC,YAAY;YAiBN,iBAAiB;IA4C/B,OAAO,CAAC,UAAU;CAgBnB"}
|
package/local-docs-search.js
CHANGED
|
@@ -886,6 +886,7 @@ const EMBEDDED_METHODS = [
|
|
|
886
886
|
'quantity: number;',
|
|
887
887
|
'adaptive_currency_fees_inclusive?: boolean;',
|
|
888
888
|
'addons?: { addon_id: string; quantity: number; }[];',
|
|
889
|
+
'cancel_older_payment_link?: boolean;',
|
|
889
890
|
'cancel_scheduled_change_plan?: boolean;',
|
|
890
891
|
'collect_via_payment_link?: boolean;',
|
|
891
892
|
'discount_code?: string;',
|
|
@@ -893,9 +894,10 @@ const EMBEDDED_METHODS = [
|
|
|
893
894
|
"effective_at?: 'immediately' | 'next_billing_date';",
|
|
894
895
|
'metadata?: object;',
|
|
895
896
|
"on_payment_failure?: 'prevent_change' | 'apply_change';",
|
|
897
|
+
'return_url?: string;',
|
|
896
898
|
],
|
|
897
899
|
response: '{ client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }',
|
|
898
|
-
markdown: "## change_plan\n\n`client.subscriptions.changePlan(subscription_id: string, product_id: string, proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill', quantity: number, adaptive_currency_fees_inclusive?: boolean, addons?: { addon_id: string; quantity: number; }[], cancel_scheduled_change_plan?: boolean, collect_via_payment_link?: boolean, discount_code?: string, discount_codes?: string[], effective_at?: 'immediately' | 'next_billing_date', metadata?: object, on_payment_failure?: 'prevent_change' | 'apply_change'): { client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }`\n\n**post** `/subscriptions/{subscription_id}/change-plan`\n\n### Parameters\n\n- `subscription_id: string`\n\n- `product_id: string`\n Unique identifier of the product to subscribe to\n\n- `proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill'`\n Proration Billing Mode\n\n- `quantity: number`\n Number of units to subscribe for. Must be at least 1.\n\n- `adaptive_currency_fees_inclusive?: boolean`\n Whether adaptive currency fees should be included in the price (true) or added on top (false).\nIf not specified, uses the subscription's stored setting.\n\n- `addons?: { addon_id: string; quantity: number; }[]`\n Addons for the new plan.\nNote : Leaving this empty would remove any existing addons\n\n- `cancel_scheduled_change_plan?: boolean`\n Replace a scheduled plan change with this one.\n\nThe scheduled change is cancelled by the transaction that applies this\nchange. A change that never applies leaves the schedule in place.\n\n`effective_at: next_billing_date` is allowed. The new schedule then\nreplaces the old one in the request transaction.\n\nA pending plan change still gets a `409`. This field does not affect it.\n\nThe preview route shares this request body, so a preview that sets this\nfield also passes the scheduled-change `409`.\n\n- `collect_via_payment_link?: boolean`\n Collect the plan-change amount with a payment link. The customer then\npays on a checkout page.\n\nThe business needs the `allow_plan_change_via_payment_link` capability.\nThe request needs `effective_at: immediately`. The request also needs\n`on_payment_failure: prevent_change`.\n\nThe preview route shares this request body and ignores this field.\n\n- `discount_code?: string`\n DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.\n\n- `discount_codes?: string[]`\n Stacked discount codes to apply to the new plan. Max 20.\nCannot be used together with discount_code.\nIf provided, replaces any existing discount codes.\nEmpty array removes all discounts.\nIf not provided (None), existing discounts with preserve_on_plan_change=true are preserved.\n\n- `effective_at?: 'immediately' | 'next_billing_date'`\n When to apply the plan change.\n- `immediately` (default): Apply the plan change right away\n- `next_billing_date`: Schedule the change for the next billing date\n\n- `metadata?: object`\n Metadata for the payment. If not passed, the metadata of the subscription will be taken\n\n- `on_payment_failure?: 'prevent_change' | 'apply_change'`\n Controls behavior when the plan change payment fails.\n- `prevent_change`: Keep subscription on current plan until payment succeeds\n- `apply_change` (default): Apply plan change immediately regardless of payment outcome\n\nIf not specified, uses the business-level default setting.\n\n### Returns\n\n- `{ client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }`\n Handles for a hosted checkout page that settles a plan change.\n\nThe four fields repeat `UpdatePaymentMethodResponse` and a subset of\n`CreateSubscriptionResponse`. A shared type would rename the generated SDK\ntypes for all three routes, so each route keeps its own.\n\n - `client_secret?: string`\n - `expires_on?: string`\n - `payment_id?: string`\n - `payment_link?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.subscriptions.changePlan('sub_Iuaq622bbmmfOGrVTqdXv', {\n product_id: 'product_id',\n proration_billing_mode: 'prorated_immediately',\n quantity: 0,\n});\n\nconsole.log(response);\n```",
|
|
900
|
+
markdown: "## change_plan\n\n`client.subscriptions.changePlan(subscription_id: string, product_id: string, proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill', quantity: number, adaptive_currency_fees_inclusive?: boolean, addons?: { addon_id: string; quantity: number; }[], cancel_older_payment_link?: boolean, cancel_scheduled_change_plan?: boolean, collect_via_payment_link?: boolean, discount_code?: string, discount_codes?: string[], effective_at?: 'immediately' | 'next_billing_date', metadata?: object, on_payment_failure?: 'prevent_change' | 'apply_change', return_url?: string): { client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }`\n\n**post** `/subscriptions/{subscription_id}/change-plan`\n\n### Parameters\n\n- `subscription_id: string`\n\n- `product_id: string`\n Unique identifier of the product to subscribe to\n\n- `proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill'`\n Proration Billing Mode\n\n- `quantity: number`\n Number of units to subscribe for. Must be at least 1.\n\n- `adaptive_currency_fees_inclusive?: boolean`\n Whether adaptive currency fees should be included in the price (true) or added on top (false).\nIf not specified, uses the subscription's stored setting.\n\n- `addons?: { addon_id: string; quantity: number; }[]`\n Addons for the new plan.\nNote : Leaving this empty would remove any existing addons\n\n- `cancel_older_payment_link?: boolean`\n Cancel the payment link of a pending plan change, so that this change\ncan replace it.\n\nThe link is cancelled only if the customer has not started to pay. A\npaid or in-progress payment gives a `409`. A failed cancel gives a\n`503`, and a retry is safe.\n\nThe request is validated before the cancel. A later failure, for example\nan amount below the minimum, leaves the subscription on its current plan\nwith no open link. A retry is safe.\n\nThe preview route shares this request body and ignores this field.\n\n- `cancel_scheduled_change_plan?: boolean`\n Replace a scheduled plan change with this one.\n\nThe scheduled change is cancelled by the transaction that applies this\nchange. A change that never applies leaves the schedule in place.\n\n`effective_at: next_billing_date` is allowed. The new schedule then\nreplaces the old one in the request transaction.\n\nA pending plan change still gets a `409`. This field does not affect it.\n\nThe preview route shares this request body, so a preview that sets this\nfield also passes the scheduled-change `409`.\n\n- `collect_via_payment_link?: boolean`\n Collect the plan-change amount with a payment link. The customer then\npays on a checkout page.\n\nThe business needs the `allow_plan_change_via_payment_link` capability.\nThe request needs `effective_at: immediately`. The request also needs\n`on_payment_failure: prevent_change`.\n\nThe preview route shares this request body and ignores this field.\n\n- `discount_code?: string`\n DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.\n\n- `discount_codes?: string[]`\n Stacked discount codes to apply to the new plan. Max 20.\nCannot be used together with discount_code.\nIf provided, replaces any existing discount codes.\nEmpty array removes all discounts.\nIf not provided (None), existing discounts with preserve_on_plan_change=true are preserved.\n\n- `effective_at?: 'immediately' | 'next_billing_date'`\n When to apply the plan change.\n- `immediately` (default): Apply the plan change right away\n- `next_billing_date`: Schedule the change for the next billing date\n\n- `metadata?: object`\n Metadata for the payment. If not passed, the metadata of the subscription will be taken\n\n- `on_payment_failure?: 'prevent_change' | 'apply_change'`\n Controls behavior when the plan change payment fails.\n- `prevent_change`: Keep subscription on current plan until payment succeeds\n- `apply_change` (default): Apply plan change immediately regardless of payment outcome\n\nIf not specified, uses the business-level default setting.\n\n- `return_url?: string`\n The URL that receives the customer after they pay the payment link.\nNeeds `collect_via_payment_link: true`. Without it, the request gets a\n`422`. A change that collects no money issues no link and does not use\nthe URL. The preview route validates this field but does not use it.\n\nThe redirect adds `subscription_id`, `payment_id` and `status`. The\n`status` value is the status of the plan-change payment. It is not the\nstatus of the subscription. When that payment fails, the subscription\nstays active on its current plan. To try again, call this endpoint\nagain to get a new link. The new plan can apply after the redirect,\nwhen the payment webhook arrives.\n\n### Returns\n\n- `{ client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }`\n Handles for a hosted checkout page that settles a plan change.\n\nThe four fields repeat `UpdatePaymentMethodResponse` and a subset of\n`CreateSubscriptionResponse`. A shared type would rename the generated SDK\ntypes for all three routes, so each route keeps its own.\n\n - `client_secret?: string`\n - `expires_on?: string`\n - `payment_id?: string`\n - `payment_link?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.subscriptions.changePlan('sub_Iuaq622bbmmfOGrVTqdXv', {\n product_id: 'product_id',\n proration_billing_mode: 'prorated_immediately',\n quantity: 0,\n});\n\nconsole.log(response);\n```",
|
|
899
901
|
perLanguage: {
|
|
900
902
|
typescript: {
|
|
901
903
|
method: 'client.subscriptions.changePlan',
|
|
@@ -926,7 +928,7 @@ const EMBEDDED_METHODS = [
|
|
|
926
928
|
},
|
|
927
929
|
php: {
|
|
928
930
|
method: 'subscriptions->changePlan',
|
|
929
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->subscriptions->changePlan(\n 'sub_Iuaq622bbmmfOGrVTqdXv',\n productID: 'product_id',\n prorationBillingMode: 'prorated_immediately',\n quantity: 0,\n adaptiveCurrencyFeesInclusive: true,\n addons: [['addonID' => 'addon_id', 'quantity' => 0]],\n cancelScheduledChangePlan: true,\n collectViaPaymentLink: true,\n discountCode: 'discount_code',\n discountCodes: ['string'],\n effectiveAt: 'immediately',\n metadata: ['foo' => 'string'],\n onPaymentFailure: 'prevent_change',\n);\n\nvar_dump($response);",
|
|
931
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->subscriptions->changePlan(\n 'sub_Iuaq622bbmmfOGrVTqdXv',\n productID: 'product_id',\n prorationBillingMode: 'prorated_immediately',\n quantity: 0,\n adaptiveCurrencyFeesInclusive: true,\n addons: [['addonID' => 'addon_id', 'quantity' => 0]],\n cancelOlderPaymentLink: true,\n cancelScheduledChangePlan: true,\n collectViaPaymentLink: true,\n discountCode: 'discount_code',\n discountCodes: ['string'],\n effectiveAt: 'immediately',\n metadata: ['foo' => 'string'],\n onPaymentFailure: 'prevent_change',\n returnURL: 'return_url',\n);\n\nvar_dump($response);",
|
|
930
932
|
},
|
|
931
933
|
csharp: {
|
|
932
934
|
method: 'Subscriptions.ChangePlan',
|
|
@@ -1057,6 +1059,7 @@ const EMBEDDED_METHODS = [
|
|
|
1057
1059
|
'quantity: number;',
|
|
1058
1060
|
'adaptive_currency_fees_inclusive?: boolean;',
|
|
1059
1061
|
'addons?: { addon_id: string; quantity: number; }[];',
|
|
1062
|
+
'cancel_older_payment_link?: boolean;',
|
|
1060
1063
|
'cancel_scheduled_change_plan?: boolean;',
|
|
1061
1064
|
'collect_via_payment_link?: boolean;',
|
|
1062
1065
|
'discount_code?: string;',
|
|
@@ -1064,9 +1067,10 @@ const EMBEDDED_METHODS = [
|
|
|
1064
1067
|
"effective_at?: 'immediately' | 'next_billing_date';",
|
|
1065
1068
|
'metadata?: object;',
|
|
1066
1069
|
"on_payment_failure?: 'prevent_change' | 'apply_change';",
|
|
1070
|
+
'return_url?: string;',
|
|
1067
1071
|
],
|
|
1068
1072
|
response: '{ immediate_charge: { effective_at: string; line_items: object | object | object[]; summary: object; }; new_plan: object; }',
|
|
1069
|
-
markdown: "## preview_change_plan\n\n`client.subscriptions.previewChangePlan(subscription_id: string, product_id: string, proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill', quantity: number, adaptive_currency_fees_inclusive?: boolean, addons?: { addon_id: string; quantity: number; }[], cancel_scheduled_change_plan?: boolean, collect_via_payment_link?: boolean, discount_code?: string, discount_codes?: string[], effective_at?: 'immediately' | 'next_billing_date', metadata?: object, on_payment_failure?: 'prevent_change' | 'apply_change'): { immediate_charge: object; new_plan: subscription; }`\n\n**post** `/subscriptions/{subscription_id}/change-plan/preview`\n\n### Parameters\n\n- `subscription_id: string`\n\n- `product_id: string`\n Unique identifier of the product to subscribe to\n\n- `proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill'`\n Proration Billing Mode\n\n- `quantity: number`\n Number of units to subscribe for. Must be at least 1.\n\n- `adaptive_currency_fees_inclusive?: boolean`\n Whether adaptive currency fees should be included in the price (true) or added on top (false).\nIf not specified, uses the subscription's stored setting.\n\n- `addons?: { addon_id: string; quantity: number; }[]`\n Addons for the new plan.\nNote : Leaving this empty would remove any existing addons\n\n- `cancel_scheduled_change_plan?: boolean`\n Replace a scheduled plan change with this one.\n\nThe scheduled change is cancelled by the transaction that applies this\nchange. A change that never applies leaves the schedule in place.\n\n`effective_at: next_billing_date` is allowed. The new schedule then\nreplaces the old one in the request transaction.\n\nA pending plan change still gets a `409`. This field does not affect it.\n\nThe preview route shares this request body, so a preview that sets this\nfield also passes the scheduled-change `409`.\n\n- `collect_via_payment_link?: boolean`\n Collect the plan-change amount with a payment link. The customer then\npays on a checkout page.\n\nThe business needs the `allow_plan_change_via_payment_link` capability.\nThe request needs `effective_at: immediately`. The request also needs\n`on_payment_failure: prevent_change`.\n\nThe preview route shares this request body and ignores this field.\n\n- `discount_code?: string`\n DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.\n\n- `discount_codes?: string[]`\n Stacked discount codes to apply to the new plan. Max 20.\nCannot be used together with discount_code.\nIf provided, replaces any existing discount codes.\nEmpty array removes all discounts.\nIf not provided (None), existing discounts with preserve_on_plan_change=true are preserved.\n\n- `effective_at?: 'immediately' | 'next_billing_date'`\n When to apply the plan change.\n- `immediately` (default): Apply the plan change right away\n- `next_billing_date`: Schedule the change for the next billing date\n\n- `metadata?: object`\n Metadata for the payment. If not passed, the metadata of the subscription will be taken\n\n- `on_payment_failure?: 'prevent_change' | 'apply_change'`\n Controls behavior when the plan change payment fails.\n- `prevent_change`: Keep subscription on current plan until payment succeeds\n- `apply_change` (default): Apply plan change immediately regardless of payment outcome\n\nIf not specified, uses the business-level default setting.\n\n### Returns\n\n- `{ immediate_charge: { effective_at: string; line_items: { id: string; currency: currency; product_id: string; proration_factor: number; quantity: number; tax_inclusive: boolean; type: 'subscription'; unit_price: number; description?: string; name?: string; tax?: number; tax_rate?: number; } | { id: string; currency: currency; name: string; proration_factor: number; quantity: number; tax_category: tax_category; tax_inclusive: boolean; tax_rate: number; type: 'addon'; unit_price: number; description?: string; tax?: number; } | { id: string; chargeable_units: string; currency: currency; free_threshold: number; name: string; price_per_unit: string; subtotal: number; tax_inclusive: boolean; tax_rate: number; type: 'meter'; units_consumed: string; description?: string; tax?: number; }[]; summary: { currency: currency; customer_credits: number; customer_credits_currency: currency; settlement_amount: number; settlement_currency: currency; total_amount: number; settlement_tax?: number; tax?: number; }; }; new_plan: { addons: addon_cart_response_item[]; billing: billing_address; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; has_payment_method: boolean; metadata: metadata; meter_credit_entitlement_cart: meter_credit_entitlement_cart_response[]; meters: meter_cart_response_item[]; next_billing_date: string; on_demand: boolean; payment_frequency_count: number; payment_frequency_interval: time_interval; previous_billing_date: string; product_id: string; quantity: number; recurring_pre_tax_amount: number; status: subscription_status; subscription_id: string; subscription_period_count: number; subscription_period_interval: time_interval; tax_inclusive: boolean; trial_period_days: number; cancellation_comment?: string; cancellation_feedback?: cancellation_feedback; cancelled_at?: string; cancelled_by?: subscription_cancelled_by; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_at?: string; paused_at?: string; payment_method_id?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; trial_amount?: number; }; }`\n\n - `immediate_charge: { effective_at: string; line_items: { id: string; currency: string; product_id: string; proration_factor: number; quantity: number; tax_inclusive: boolean; type: 'subscription'; unit_price: number; description?: string; name?: string; tax?: number; tax_rate?: number; } | { id: string; currency: string; name: string; proration_factor: number; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech' | 'live_tutoring'; tax_inclusive: boolean; tax_rate: number; type: 'addon'; unit_price: number; description?: string; tax?: number; } | { id: string; chargeable_units: string; currency: string; free_threshold: number; name: string; price_per_unit: string; subtotal: number; tax_inclusive: boolean; tax_rate: number; type: 'meter'; units_consumed: string; description?: string; tax?: number; }[]; summary: { currency: string; customer_credits: number; customer_credits_currency: string; settlement_amount: number; settlement_currency: string; total_amount: number; settlement_tax?: number; tax?: number; }; }`\n - `new_plan: { addons: { addon_id: string; quantity: number; }[]; billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: { credit_entitlement_id: string; credit_entitlement_name: string; credits_amount: string; overage_balance: string; overage_behavior: cbb_overage_behavior; overage_enabled: boolean; product_id: string; remaining_balance: string; rollover_enabled: boolean; unit: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; }[]; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; has_payment_method: boolean; metadata: object; meter_credit_entitlement_cart: { credit_entitlement_id: string; meter_id: string; meter_name: string; meter_units_per_credit: string; product_id: string; }[]; meters: { currency: currency; free_threshold: number; measurement_unit: string; meter_id: string; name: string; description?: string; price_per_unit?: string; }[]; next_billing_date: string; on_demand: boolean; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; previous_billing_date: string; product_id: string; quantity: number; recurring_pre_tax_amount: number; status: 'pending' | 'active' | 'on_hold' | 'paused' | 'cancelled' | 'failed' | 'expired' | 'past_due'; subscription_id: string; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; tax_inclusive: boolean; trial_period_days: number; cancellation_comment?: string; cancellation_feedback?: string; cancelled_at?: string; cancelled_by?: { actor_type: 'customer' | 'merchant_user' | 'api_key' | 'dodo_team'; email?: string; name?: string; }; custom_field_responses?: { key: string; value: string; }[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: metadata; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]; expires_at?: string; paused_at?: string; payment_method_id?: string; scheduled_change?: { id: string; addons: object[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }; tax_id?: string; trial_amount?: number; }`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.subscriptions.previewChangePlan('sub_Iuaq622bbmmfOGrVTqdXv', {\n product_id: 'product_id',\n proration_billing_mode: 'prorated_immediately',\n quantity: 0,\n});\n\nconsole.log(response);\n```",
|
|
1073
|
+
markdown: "## preview_change_plan\n\n`client.subscriptions.previewChangePlan(subscription_id: string, product_id: string, proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill', quantity: number, adaptive_currency_fees_inclusive?: boolean, addons?: { addon_id: string; quantity: number; }[], cancel_older_payment_link?: boolean, cancel_scheduled_change_plan?: boolean, collect_via_payment_link?: boolean, discount_code?: string, discount_codes?: string[], effective_at?: 'immediately' | 'next_billing_date', metadata?: object, on_payment_failure?: 'prevent_change' | 'apply_change', return_url?: string): { immediate_charge: object; new_plan: subscription; }`\n\n**post** `/subscriptions/{subscription_id}/change-plan/preview`\n\n### Parameters\n\n- `subscription_id: string`\n\n- `product_id: string`\n Unique identifier of the product to subscribe to\n\n- `proration_billing_mode: 'prorated_immediately' | 'full_immediately' | 'difference_immediately' | 'do_not_bill'`\n Proration Billing Mode\n\n- `quantity: number`\n Number of units to subscribe for. Must be at least 1.\n\n- `adaptive_currency_fees_inclusive?: boolean`\n Whether adaptive currency fees should be included in the price (true) or added on top (false).\nIf not specified, uses the subscription's stored setting.\n\n- `addons?: { addon_id: string; quantity: number; }[]`\n Addons for the new plan.\nNote : Leaving this empty would remove any existing addons\n\n- `cancel_older_payment_link?: boolean`\n Cancel the payment link of a pending plan change, so that this change\ncan replace it.\n\nThe link is cancelled only if the customer has not started to pay. A\npaid or in-progress payment gives a `409`. A failed cancel gives a\n`503`, and a retry is safe.\n\nThe request is validated before the cancel. A later failure, for example\nan amount below the minimum, leaves the subscription on its current plan\nwith no open link. A retry is safe.\n\nThe preview route shares this request body and ignores this field.\n\n- `cancel_scheduled_change_plan?: boolean`\n Replace a scheduled plan change with this one.\n\nThe scheduled change is cancelled by the transaction that applies this\nchange. A change that never applies leaves the schedule in place.\n\n`effective_at: next_billing_date` is allowed. The new schedule then\nreplaces the old one in the request transaction.\n\nA pending plan change still gets a `409`. This field does not affect it.\n\nThe preview route shares this request body, so a preview that sets this\nfield also passes the scheduled-change `409`.\n\n- `collect_via_payment_link?: boolean`\n Collect the plan-change amount with a payment link. The customer then\npays on a checkout page.\n\nThe business needs the `allow_plan_change_via_payment_link` capability.\nThe request needs `effective_at: immediately`. The request also needs\n`on_payment_failure: prevent_change`.\n\nThe preview route shares this request body and ignores this field.\n\n- `discount_code?: string`\n DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.\n\n- `discount_codes?: string[]`\n Stacked discount codes to apply to the new plan. Max 20.\nCannot be used together with discount_code.\nIf provided, replaces any existing discount codes.\nEmpty array removes all discounts.\nIf not provided (None), existing discounts with preserve_on_plan_change=true are preserved.\n\n- `effective_at?: 'immediately' | 'next_billing_date'`\n When to apply the plan change.\n- `immediately` (default): Apply the plan change right away\n- `next_billing_date`: Schedule the change for the next billing date\n\n- `metadata?: object`\n Metadata for the payment. If not passed, the metadata of the subscription will be taken\n\n- `on_payment_failure?: 'prevent_change' | 'apply_change'`\n Controls behavior when the plan change payment fails.\n- `prevent_change`: Keep subscription on current plan until payment succeeds\n- `apply_change` (default): Apply plan change immediately regardless of payment outcome\n\nIf not specified, uses the business-level default setting.\n\n- `return_url?: string`\n The URL that receives the customer after they pay the payment link.\nNeeds `collect_via_payment_link: true`. Without it, the request gets a\n`422`. A change that collects no money issues no link and does not use\nthe URL. The preview route validates this field but does not use it.\n\nThe redirect adds `subscription_id`, `payment_id` and `status`. The\n`status` value is the status of the plan-change payment. It is not the\nstatus of the subscription. When that payment fails, the subscription\nstays active on its current plan. To try again, call this endpoint\nagain to get a new link. The new plan can apply after the redirect,\nwhen the payment webhook arrives.\n\n### Returns\n\n- `{ immediate_charge: { effective_at: string; line_items: { id: string; currency: currency; product_id: string; proration_factor: number; quantity: number; tax_inclusive: boolean; type: 'subscription'; unit_price: number; description?: string; name?: string; tax?: number; tax_rate?: number; } | { id: string; currency: currency; name: string; proration_factor: number; quantity: number; tax_category: tax_category; tax_inclusive: boolean; tax_rate: number; type: 'addon'; unit_price: number; description?: string; tax?: number; } | { id: string; chargeable_units: string; currency: currency; free_threshold: number; name: string; price_per_unit: string; subtotal: number; tax_inclusive: boolean; tax_rate: number; type: 'meter'; units_consumed: string; description?: string; tax?: number; }[]; summary: { currency: currency; customer_credits: number; customer_credits_currency: currency; settlement_amount: number; settlement_currency: currency; total_amount: number; settlement_tax?: number; tax?: number; }; }; new_plan: { addons: addon_cart_response_item[]; billing: billing_address; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; has_payment_method: boolean; metadata: metadata; meter_credit_entitlement_cart: meter_credit_entitlement_cart_response[]; meters: meter_cart_response_item[]; next_billing_date: string; on_demand: boolean; payment_frequency_count: number; payment_frequency_interval: time_interval; previous_billing_date: string; product_id: string; quantity: number; recurring_pre_tax_amount: number; status: subscription_status; subscription_id: string; subscription_period_count: number; subscription_period_interval: time_interval; tax_inclusive: boolean; trial_period_days: number; cancellation_comment?: string; cancellation_feedback?: cancellation_feedback; cancelled_at?: string; cancelled_by?: subscription_cancelled_by; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_at?: string; paused_at?: string; payment_method_id?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; trial_amount?: number; }; }`\n\n - `immediate_charge: { effective_at: string; line_items: { id: string; currency: string; product_id: string; proration_factor: number; quantity: number; tax_inclusive: boolean; type: 'subscription'; unit_price: number; description?: string; name?: string; tax?: number; tax_rate?: number; } | { id: string; currency: string; name: string; proration_factor: number; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech' | 'live_tutoring'; tax_inclusive: boolean; tax_rate: number; type: 'addon'; unit_price: number; description?: string; tax?: number; } | { id: string; chargeable_units: string; currency: string; free_threshold: number; name: string; price_per_unit: string; subtotal: number; tax_inclusive: boolean; tax_rate: number; type: 'meter'; units_consumed: string; description?: string; tax?: number; }[]; summary: { currency: string; customer_credits: number; customer_credits_currency: string; settlement_amount: number; settlement_currency: string; total_amount: number; settlement_tax?: number; tax?: number; }; }`\n - `new_plan: { addons: { addon_id: string; quantity: number; }[]; billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: { credit_entitlement_id: string; credit_entitlement_name: string; credits_amount: string; overage_balance: string; overage_behavior: cbb_overage_behavior; overage_enabled: boolean; product_id: string; remaining_balance: string; rollover_enabled: boolean; unit: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; }[]; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; has_payment_method: boolean; metadata: object; meter_credit_entitlement_cart: { credit_entitlement_id: string; meter_id: string; meter_name: string; meter_units_per_credit: string; product_id: string; }[]; meters: { currency: currency; free_threshold: number; measurement_unit: string; meter_id: string; name: string; description?: string; price_per_unit?: string; }[]; next_billing_date: string; on_demand: boolean; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; previous_billing_date: string; product_id: string; quantity: number; recurring_pre_tax_amount: number; status: 'pending' | 'active' | 'on_hold' | 'paused' | 'cancelled' | 'failed' | 'expired' | 'past_due'; subscription_id: string; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; tax_inclusive: boolean; trial_period_days: number; cancellation_comment?: string; cancellation_feedback?: string; cancelled_at?: string; cancelled_by?: { actor_type: 'customer' | 'merchant_user' | 'api_key' | 'dodo_team'; email?: string; name?: string; }; custom_field_responses?: { key: string; value: string; }[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: metadata; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]; expires_at?: string; paused_at?: string; payment_method_id?: string; scheduled_change?: { id: string; addons: object[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }; tax_id?: string; trial_amount?: number; }`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.subscriptions.previewChangePlan('sub_Iuaq622bbmmfOGrVTqdXv', {\n product_id: 'product_id',\n proration_billing_mode: 'prorated_immediately',\n quantity: 0,\n});\n\nconsole.log(response);\n```",
|
|
1070
1074
|
perLanguage: {
|
|
1071
1075
|
typescript: {
|
|
1072
1076
|
method: 'client.subscriptions.previewChangePlan',
|
|
@@ -1097,7 +1101,7 @@ const EMBEDDED_METHODS = [
|
|
|
1097
1101
|
},
|
|
1098
1102
|
php: {
|
|
1099
1103
|
method: 'subscriptions->previewChangePlan',
|
|
1100
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->subscriptions->previewChangePlan(\n 'sub_Iuaq622bbmmfOGrVTqdXv',\n productID: 'product_id',\n prorationBillingMode: 'prorated_immediately',\n quantity: 0,\n adaptiveCurrencyFeesInclusive: true,\n addons: [['addonID' => 'addon_id', 'quantity' => 0]],\n cancelScheduledChangePlan: true,\n collectViaPaymentLink: true,\n discountCode: 'discount_code',\n discountCodes: ['string'],\n effectiveAt: 'immediately',\n metadata: ['foo' => 'string'],\n onPaymentFailure: 'prevent_change',\n);\n\nvar_dump($response);",
|
|
1104
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->subscriptions->previewChangePlan(\n 'sub_Iuaq622bbmmfOGrVTqdXv',\n productID: 'product_id',\n prorationBillingMode: 'prorated_immediately',\n quantity: 0,\n adaptiveCurrencyFeesInclusive: true,\n addons: [['addonID' => 'addon_id', 'quantity' => 0]],\n cancelOlderPaymentLink: true,\n cancelScheduledChangePlan: true,\n collectViaPaymentLink: true,\n discountCode: 'discount_code',\n discountCodes: ['string'],\n effectiveAt: 'immediately',\n metadata: ['foo' => 'string'],\n onPaymentFailure: 'prevent_change',\n returnURL: 'return_url',\n);\n\nvar_dump($response);",
|
|
1101
1105
|
},
|
|
1102
1106
|
csharp: {
|
|
1103
1107
|
method: 'Subscriptions.PreviewChangePlan',
|