dodopayments-mcp 2.42.2 → 2.44.0
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 +55 -46
- package/local-docs-search.js.map +1 -1
- package/local-docs-search.mjs +55 -46
- 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 +55 -46
- package/src/server.ts +1 -1
package/local-docs-search.js
CHANGED
|
@@ -200,8 +200,8 @@ const EMBEDDED_METHODS = [
|
|
|
200
200
|
'subscription_data?: { on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: currency; product_description?: string; product_price?: number; }; trial_period_days?: number; };',
|
|
201
201
|
'tax_id?: string;',
|
|
202
202
|
],
|
|
203
|
-
response: '{ billing_country: string; currency: string; current_breakup: { discount: number; subtotal: number; total_amount: number; tax?: number; }; is_byop: boolean; product_cart: { credit_entitlements: object[]; currency: currency; discounted_price: number; is_subscription: boolean; is_usage_based: boolean; meters: object[]; og_currency: currency; og_price: number; product_id: string; quantity: number; tax_category: tax_category; tax_inclusive: boolean; tax_rate: number; addons?: object[]; description?: string; discount_amount?: number; discount_cycle?: number; name?: string; tax?: number; }[]; total_price: number; next_billing_date?: string; recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }; tax_id_business_name?: string; tax_id_err_msg?: string; tax_id_format_name?: string; total_tax?: number; }',
|
|
204
|
-
markdown: "## preview\n\n`client.checkoutSessions.preview(product_cart: { product_id: string; quantity: number; addons?: attach_addon[]; amount?: number; credit_entitlements?: object[]; }[], allowed_payment_method_types?: string[], billing_address?: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, billing_currency?: string, cancel_url?: string, confirm?: boolean, custom_fields?: { field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean'; key: string; label: string; options?: string[]; placeholder?: string; required?: boolean; }[], customer?: object | object, customer_business_name?: string, customization?: { force_language?: string; show_on_demand_tag?: boolean; show_order_details?: boolean; theme?: 'dark' | 'light' | 'system'; theme_config?: theme_config; }, discount_code?: string, discount_codes?: string[], feature_flags?: { allow_currency_selection?: boolean; allow_customer_editing_business_name?: boolean; allow_customer_editing_city?: boolean; allow_customer_editing_country?: boolean; allow_customer_editing_email?: boolean; allow_customer_editing_name?: boolean; allow_customer_editing_state?: boolean; allow_customer_editing_street?: boolean; allow_customer_editing_tax_id?: boolean; allow_customer_editing_zipcode?: boolean; allow_discount_code?: boolean; allow_editing_addons?: boolean; allow_phone_number_collection?: boolean; allow_tax_id?: boolean; always_create_new_customer?: boolean; redirect_immediately?: boolean; require_phone_number?: boolean; }, force_3ds?: boolean, mandate_min_amount_inr_paise?: number, metadata?: object, minimal_address?: boolean, payment_method_id?: string, product_collection_id?: string, return_url?: string, short_link?: boolean, show_saved_payment_methods?: boolean, subscription_data?: { on_demand?: on_demand_subscription; trial_period_days?: number; }, tax_id?: string): { billing_country: country_code; currency: currency; current_breakup: object; is_byop: boolean; product_cart: object[]; total_price: number; next_billing_date?: string; recurring_breakup?: object; tax_id_business_name?: string; tax_id_err_msg?: string; tax_id_format_name?: string; total_tax?: number; }`\n\n**post** `/checkouts/preview`\n\n### Parameters\n\n- `product_cart: { product_id: string; quantity: number; addons?: { addon_id: string; quantity: number; }[]; amount?: number; credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; }[]; }[]`\n\n- `allowed_payment_method_types?: string[]`\n Customers will never see payment methods that are not in this list.\nHowever, adding a method here does not guarantee customers will see it.\nAvailability still depends on other factors (e.g., customer location, merchant settings).\n\nDisclaimar: Always provide 'credit' and 'debit' as a fallback.\nIf all payment methods are unavailable, checkout session will fail.\n\n- `billing_address?: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n Billing address information for the session\n - `country: string`\n Two-letter ISO country code (ISO 3166-1 alpha-2)\n - `city?: string`\n City name\n - `state?: string`\n State or province name\n - `street?: string`\n Street address including house number and unit/apartment if applicable\n - `zipcode?: string`\n Postal code or ZIP code\n\n- `billing_currency?: string`\n This field is ingored if adaptive pricing is disabled\n\n- `cancel_url?: string`\n The URL to redirect the customer if they cancel or go back from the checkout.\nIf not provided, the back button will not be displayed.\n\n- `confirm?: boolean`\n If confirm is true, all the details will be finalized. If required data is missing, an API error is thrown.\n\n- `custom_fields?: { field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean'; key: string; label: string; options?: string[]; placeholder?: string; required?: boolean; }[]`\n Custom fields to collect from customer during checkout (max 5 fields)\n\n- `customer?: { customer_id: string; } | { email: string; name?: string; phone_number?: string; }`\n Customer details for the session\n\n- `customer_business_name?: string`\n Optional business / legal name associated with the tax id. When provided\ntogether with a valid tax id for a B2B purchase, this name is rendered\non the invoice instead of the customer's personal name.\n\n- `customization?: { force_language?: string; show_on_demand_tag?: boolean; show_order_details?: boolean; theme?: 'dark' | 'light' | 'system'; theme_config?: { dark?: theme_mode_config; font_primary_url?: string; font_secondary_url?: string; font_size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; font_weight?: 'normal' | 'medium' | 'bold' | 'extraBold'; light?: theme_mode_config; pay_button_text?: string; radius?: string; }; }`\n Customization for the checkout session page\n - `force_language?: string`\n Force the checkout interface to render in a specific language (e.g. `en`, `es`)\n - `show_on_demand_tag?: boolean`\n Show on demand tag\n\nDefault is true\n - `show_order_details?: boolean`\n Show order details by default\n\nDefault is true\n - `theme?: 'dark' | 'light' | 'system'`\n Theme of the page (determines which mode - light/dark/system - to use)\n\nIf not provided, uses the business-configured theme from business_themes table.\n - `theme_config?: { dark?: { bg_primary?: string; bg_secondary?: string; border_primary?: string; border_secondary?: string; button_primary?: string; button_primary_hover?: string; button_secondary?: string; button_secondary_hover?: string; button_text_primary?: string; button_text_secondary?: string; input_focus_border?: string; text_error?: string; text_placeholder?: string; text_primary?: string; text_secondary?: string; text_success?: string; }; font_primary_url?: string; font_secondary_url?: string; font_size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; font_weight?: 'normal' | 'medium' | 'bold' | 'extraBold'; light?: { bg_primary?: string; bg_secondary?: string; border_primary?: string; border_secondary?: string; button_primary?: string; button_primary_hover?: string; button_secondary?: string; button_secondary_hover?: string; button_text_primary?: string; button_text_secondary?: string; input_focus_border?: string; text_error?: string; text_placeholder?: string; text_primary?: string; text_secondary?: string; text_success?: string; }; pay_button_text?: string; radius?: string; }`\n Optional custom theme configuration with colors for light and dark modes\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, in order. Max 20.\nCannot be used together with discount_code.\n\n- `feature_flags?: { allow_currency_selection?: boolean; allow_customer_editing_business_name?: boolean; allow_customer_editing_city?: boolean; allow_customer_editing_country?: boolean; allow_customer_editing_email?: boolean; allow_customer_editing_name?: boolean; allow_customer_editing_state?: boolean; allow_customer_editing_street?: boolean; allow_customer_editing_tax_id?: boolean; allow_customer_editing_zipcode?: boolean; allow_discount_code?: boolean; allow_editing_addons?: boolean; allow_phone_number_collection?: boolean; allow_tax_id?: boolean; always_create_new_customer?: boolean; redirect_immediately?: boolean; require_phone_number?: boolean; }`\n - `allow_currency_selection?: boolean`\n if customer is allowed to change currency, set it to true\n\nDefault is true\n - `allow_customer_editing_business_name?: boolean`\n If true, the customer can supply or edit the business name associated\nwith the tax id during checkout. Works independently of\n`allow_customer_editing_tax_id` — either flag (or `allow_tax_id`) is\nsufficient to let the customer override the session's business name.\nTypically set together with `allow_customer_editing_tax_id`.\n\nDefault is false\n - `allow_customer_editing_city?: boolean`\n - `allow_customer_editing_country?: boolean`\n - `allow_customer_editing_email?: boolean`\n - `allow_customer_editing_name?: boolean`\n - `allow_customer_editing_state?: boolean`\n - `allow_customer_editing_street?: boolean`\n - `allow_customer_editing_tax_id?: boolean`\n - `allow_customer_editing_zipcode?: boolean`\n - `allow_discount_code?: boolean`\n If the customer is allowed to apply discount code, set it to true.\n\nDefault is true\n - `allow_editing_addons?: boolean`\n If true, the customer can add or remove addons on a subscription product\nduring checkout.\n\nDefault is false\n - `allow_phone_number_collection?: boolean`\n If phone number is collected from customer, set it to rue\n\nDefault is true\n - `allow_tax_id?: boolean`\n If the customer is allowed to add tax id, set it to true\n\nDefault is true\n - `always_create_new_customer?: boolean`\n Set to true if a new customer object should be created.\nBy default email is used to find an existing customer to attach the session to\n\nDefault is false\n - `redirect_immediately?: boolean`\n If true, redirects the customer immediately after payment completion\n\nDefault is false\n - `require_phone_number?: boolean`\n If true, the customer must provide a phone number to complete checkout.\nRequires `allow_phone_number_collection` to also be true.\n\nDefault is false\n\n- `force_3ds?: boolean`\n Override merchant default 3DS behaviour for this session\n\n- `mandate_min_amount_inr_paise?: number`\n Override the merchant-level mandate floor (in INR paise) for INR\ne-mandates on Indian-card recurring payments. The mandate amount sent to\nthe processor is `max(this_floor, actual_billing_amount)`, so this is\neffectively the customer-facing authorization ceiling whenever billing is\nlower. When unset, the merchant setting applies; when that's also unset,\nthe system default of ₹15,000 applies.\n\n- `metadata?: object`\n Additional metadata associated with the payment. Defaults to empty if not provided.\n\n- `minimal_address?: boolean`\n If true, only zipcode is required when confirm is true; other address fields remain optional\n\n- `payment_method_id?: string`\n Optional payment method ID to use for this checkout session.\nOnly allowed when `confirm` is true.\nIf provided, existing customer id must also be provided.\n\n- `product_collection_id?: string`\n Product collection ID for collection-based checkout flow\n\n- `return_url?: string`\n The url to redirect after payment failure or success.\n\n- `short_link?: boolean`\n If true, returns a shortened checkout URL.\nDefaults to false if not specified.\n\n- `show_saved_payment_methods?: boolean`\n Display saved payment methods of a returning customer False by default\n\n- `subscription_data?: { on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: currency; product_description?: string; product_price?: number; }; trial_period_days?: number; }`\n - `on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: string; product_description?: string; product_price?: number; }`\n - `trial_period_days?: number`\n Optional trial period in days If specified, this value overrides the trial period set in the product's price Must be between 0 and 10000 days\n\n- `tax_id?: string`\n Tax ID for the customer (e.g. VAT number). Requires billing_address with country.\n\n### Returns\n\n- `{ billing_country: string; currency: string; current_breakup: { discount: number; subtotal: number; total_amount: number; tax?: number; }; is_byop: boolean; product_cart: { credit_entitlements: { credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; }[]; currency: string; discounted_price: number; is_subscription: boolean; is_usage_based: boolean; meters: { measurement_unit: string; name: string; price_per_unit: string; description?: string; free_threshold?: number; }[]; og_currency: string; og_price: number; product_id: string; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive: boolean; tax_rate: number; addons?: { addon_id: string; currency: currency; discounted_price: number; name: string; og_currency: currency; og_price: number; quantity: number; tax_category: tax_category; tax_inclusive: boolean; tax_rate: number; description?: string; discount_amount?: number; tax?: number; }[]; description?: string; discount_amount?: number; discount_cycle?: number; name?: string; tax?: number; }[]; total_price: number; next_billing_date?: string; recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }; tax_id_business_name?: string; tax_id_err_msg?: string; tax_id_format_name?: string; total_tax?: number; }`\n Data returned by the calculate checkout session API\n\n - `billing_country: string`\n - `currency: string`\n - `current_breakup: { discount: number; subtotal: number; total_amount: number; tax?: number; }`\n - `is_byop: boolean`\n - `product_cart: { credit_entitlements: { credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; }[]; currency: string; discounted_price: number; is_subscription: boolean; is_usage_based: boolean; meters: { measurement_unit: string; name: string; price_per_unit: string; description?: string; free_threshold?: number; }[]; og_currency: string; og_price: number; product_id: string; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive: boolean; tax_rate: number; addons?: { addon_id: string; currency: string; discounted_price: number; name: string; og_currency: string; og_price: number; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive: boolean; tax_rate: number; description?: string; discount_amount?: number; tax?: number; }[]; description?: string; discount_amount?: number; discount_cycle?: number; name?: string; tax?: number; }[]`\n - `total_price: number`\n - `next_billing_date?: string`\n - `recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }`\n - `tax_id_business_name?: string`\n - `tax_id_err_msg?: string`\n - `tax_id_format_name?: string`\n - `total_tax?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.checkoutSessions.preview({ product_cart: [{ product_id: 'product_id', quantity: 0 }] });\n\nconsole.log(response);\n```",
|
|
203
|
+
response: '{ billing_country: string; currency: string; current_breakup: { discount: number; subtotal: number; total_amount: number; tax?: number; }; is_byop: boolean; product_cart: { credit_entitlements: object[]; currency: currency; discounted_price: number; is_subscription: boolean; is_usage_based: boolean; meters: object[]; og_currency: currency; og_price: number; product_id: string; quantity: number; tax_category: tax_category; tax_inclusive: boolean; tax_rate: number; addons?: object[]; description?: string; discount_amount?: number; discount_cycle?: number; name?: string; tax?: number; }[]; total_price: number; next_billing_date?: string; recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }; tax_id_business_name?: string; tax_id_err_msg?: string; tax_id_format_name?: string; total_tax?: number; trial_amount?: number; trial_period_days?: number; }',
|
|
204
|
+
markdown: "## preview\n\n`client.checkoutSessions.preview(product_cart: { product_id: string; quantity: number; addons?: attach_addon[]; amount?: number; credit_entitlements?: object[]; }[], allowed_payment_method_types?: string[], billing_address?: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, billing_currency?: string, cancel_url?: string, confirm?: boolean, custom_fields?: { field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean'; key: string; label: string; options?: string[]; placeholder?: string; required?: boolean; }[], customer?: object | object, customer_business_name?: string, customization?: { force_language?: string; show_on_demand_tag?: boolean; show_order_details?: boolean; theme?: 'dark' | 'light' | 'system'; theme_config?: theme_config; }, discount_code?: string, discount_codes?: string[], feature_flags?: { allow_currency_selection?: boolean; allow_customer_editing_business_name?: boolean; allow_customer_editing_city?: boolean; allow_customer_editing_country?: boolean; allow_customer_editing_email?: boolean; allow_customer_editing_name?: boolean; allow_customer_editing_state?: boolean; allow_customer_editing_street?: boolean; allow_customer_editing_tax_id?: boolean; allow_customer_editing_zipcode?: boolean; allow_discount_code?: boolean; allow_editing_addons?: boolean; allow_phone_number_collection?: boolean; allow_tax_id?: boolean; always_create_new_customer?: boolean; redirect_immediately?: boolean; require_phone_number?: boolean; }, force_3ds?: boolean, mandate_min_amount_inr_paise?: number, metadata?: object, minimal_address?: boolean, payment_method_id?: string, product_collection_id?: string, return_url?: string, short_link?: boolean, show_saved_payment_methods?: boolean, subscription_data?: { on_demand?: on_demand_subscription; trial_period_days?: number; }, tax_id?: string): { billing_country: country_code; currency: currency; current_breakup: object; is_byop: boolean; product_cart: object[]; total_price: number; next_billing_date?: string; recurring_breakup?: object; tax_id_business_name?: string; tax_id_err_msg?: string; tax_id_format_name?: string; total_tax?: number; trial_amount?: number; trial_period_days?: number; }`\n\n**post** `/checkouts/preview`\n\n### Parameters\n\n- `product_cart: { product_id: string; quantity: number; addons?: { addon_id: string; quantity: number; }[]; amount?: number; credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; }[]; }[]`\n\n- `allowed_payment_method_types?: string[]`\n Customers will never see payment methods that are not in this list.\nHowever, adding a method here does not guarantee customers will see it.\nAvailability still depends on other factors (e.g., customer location, merchant settings).\n\nDisclaimar: Always provide 'credit' and 'debit' as a fallback.\nIf all payment methods are unavailable, checkout session will fail.\n\n- `billing_address?: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n Billing address information for the session\n - `country: string`\n Two-letter ISO country code (ISO 3166-1 alpha-2)\n - `city?: string`\n City name\n - `state?: string`\n State or province name\n - `street?: string`\n Street address including house number and unit/apartment if applicable\n - `zipcode?: string`\n Postal code or ZIP code\n\n- `billing_currency?: string`\n This field is ingored if adaptive pricing is disabled\n\n- `cancel_url?: string`\n The URL to redirect the customer if they cancel or go back from the checkout.\nIf not provided, the back button will not be displayed.\n\n- `confirm?: boolean`\n If confirm is true, all the details will be finalized. If required data is missing, an API error is thrown.\n\n- `custom_fields?: { field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean'; key: string; label: string; options?: string[]; placeholder?: string; required?: boolean; }[]`\n Custom fields to collect from customer during checkout (max 5 fields)\n\n- `customer?: { customer_id: string; } | { email: string; name?: string; phone_number?: string; }`\n Customer details for the session\n\n- `customer_business_name?: string`\n Optional business / legal name associated with the tax id. When provided\ntogether with a valid tax id for a B2B purchase, this name is rendered\non the invoice instead of the customer's personal name.\n\n- `customization?: { force_language?: string; show_on_demand_tag?: boolean; show_order_details?: boolean; theme?: 'dark' | 'light' | 'system'; theme_config?: { dark?: theme_mode_config; font_primary_url?: string; font_secondary_url?: string; font_size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; font_weight?: 'normal' | 'medium' | 'bold' | 'extraBold'; light?: theme_mode_config; pay_button_text?: string; radius?: string; }; }`\n Customization for the checkout session page\n - `force_language?: string`\n Force the checkout interface to render in a specific language (e.g. `en`, `es`)\n - `show_on_demand_tag?: boolean`\n Show on demand tag\n\nDefault is true\n - `show_order_details?: boolean`\n Show order details by default\n\nDefault is true\n - `theme?: 'dark' | 'light' | 'system'`\n Theme of the page (determines which mode - light/dark/system - to use)\n\nIf not provided, uses the business-configured theme from business_themes table.\n - `theme_config?: { dark?: { bg_primary?: string; bg_secondary?: string; border_primary?: string; border_secondary?: string; button_primary?: string; button_primary_hover?: string; button_secondary?: string; button_secondary_hover?: string; button_text_primary?: string; button_text_secondary?: string; input_focus_border?: string; text_error?: string; text_placeholder?: string; text_primary?: string; text_secondary?: string; text_success?: string; }; font_primary_url?: string; font_secondary_url?: string; font_size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; font_weight?: 'normal' | 'medium' | 'bold' | 'extraBold'; light?: { bg_primary?: string; bg_secondary?: string; border_primary?: string; border_secondary?: string; button_primary?: string; button_primary_hover?: string; button_secondary?: string; button_secondary_hover?: string; button_text_primary?: string; button_text_secondary?: string; input_focus_border?: string; text_error?: string; text_placeholder?: string; text_primary?: string; text_secondary?: string; text_success?: string; }; pay_button_text?: string; radius?: string; }`\n Optional custom theme configuration with colors for light and dark modes\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, in order. Max 20.\nCannot be used together with discount_code.\n\n- `feature_flags?: { allow_currency_selection?: boolean; allow_customer_editing_business_name?: boolean; allow_customer_editing_city?: boolean; allow_customer_editing_country?: boolean; allow_customer_editing_email?: boolean; allow_customer_editing_name?: boolean; allow_customer_editing_state?: boolean; allow_customer_editing_street?: boolean; allow_customer_editing_tax_id?: boolean; allow_customer_editing_zipcode?: boolean; allow_discount_code?: boolean; allow_editing_addons?: boolean; allow_phone_number_collection?: boolean; allow_tax_id?: boolean; always_create_new_customer?: boolean; redirect_immediately?: boolean; require_phone_number?: boolean; }`\n - `allow_currency_selection?: boolean`\n if customer is allowed to change currency, set it to true\n\nDefault is true\n - `allow_customer_editing_business_name?: boolean`\n If true, the customer can supply or edit the business name associated\nwith the tax id during checkout. Works independently of\n`allow_customer_editing_tax_id` — either flag (or `allow_tax_id`) is\nsufficient to let the customer override the session's business name.\nTypically set together with `allow_customer_editing_tax_id`.\n\nDefault is false\n - `allow_customer_editing_city?: boolean`\n - `allow_customer_editing_country?: boolean`\n - `allow_customer_editing_email?: boolean`\n - `allow_customer_editing_name?: boolean`\n - `allow_customer_editing_state?: boolean`\n - `allow_customer_editing_street?: boolean`\n - `allow_customer_editing_tax_id?: boolean`\n - `allow_customer_editing_zipcode?: boolean`\n - `allow_discount_code?: boolean`\n If the customer is allowed to apply discount code, set it to true.\n\nDefault is true\n - `allow_editing_addons?: boolean`\n If true, the customer can add or remove addons on a subscription product\nduring checkout.\n\nDefault is false\n - `allow_phone_number_collection?: boolean`\n If phone number is collected from customer, set it to rue\n\nDefault is true\n - `allow_tax_id?: boolean`\n If the customer is allowed to add tax id, set it to true\n\nDefault is true\n - `always_create_new_customer?: boolean`\n Set to true if a new customer object should be created.\nBy default email is used to find an existing customer to attach the session to\n\nDefault is false\n - `redirect_immediately?: boolean`\n If true, redirects the customer immediately after payment completion\n\nDefault is false\n - `require_phone_number?: boolean`\n If true, the customer must provide a phone number to complete checkout.\nRequires `allow_phone_number_collection` to also be true.\n\nDefault is false\n\n- `force_3ds?: boolean`\n Override merchant default 3DS behaviour for this session\n\n- `mandate_min_amount_inr_paise?: number`\n Override the merchant-level mandate floor (in INR paise) for INR\ne-mandates on Indian-card recurring payments. The mandate amount sent to\nthe processor is `max(this_floor, actual_billing_amount)`, so this is\neffectively the customer-facing authorization ceiling whenever billing is\nlower. When unset, the merchant setting applies; when that's also unset,\nthe system default of ₹15,000 applies.\n\n- `metadata?: object`\n Additional metadata associated with the payment. Defaults to empty if not provided.\n\n- `minimal_address?: boolean`\n If true, only zipcode is required when confirm is true; other address fields remain optional\n\n- `payment_method_id?: string`\n Optional payment method ID to use for this checkout session.\nOnly allowed when `confirm` is true.\nIf provided, existing customer id must also be provided.\n\n- `product_collection_id?: string`\n Product collection ID for collection-based checkout flow\n\n- `return_url?: string`\n The url to redirect after payment failure or success.\n\n- `short_link?: boolean`\n If true, returns a shortened checkout URL.\nDefaults to false if not specified.\n\n- `show_saved_payment_methods?: boolean`\n Display saved payment methods of a returning customer False by default\n\n- `subscription_data?: { on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: currency; product_description?: string; product_price?: number; }; trial_period_days?: number; }`\n - `on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: string; product_description?: string; product_price?: number; }`\n - `trial_period_days?: number`\n Optional trial period in days If specified, this value overrides the trial period set in the product's price Must be between 0 and 10000 days\n\n- `tax_id?: string`\n Tax ID for the customer (e.g. VAT number). Requires billing_address with country.\n\n### Returns\n\n- `{ billing_country: string; currency: string; current_breakup: { discount: number; subtotal: number; total_amount: number; tax?: number; }; is_byop: boolean; product_cart: { credit_entitlements: { credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; }[]; currency: string; discounted_price: number; is_subscription: boolean; is_usage_based: boolean; meters: { measurement_unit: string; name: string; price_per_unit: string; description?: string; free_threshold?: number; }[]; og_currency: string; og_price: number; product_id: string; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive: boolean; tax_rate: number; addons?: { addon_id: string; currency: currency; discounted_price: number; name: string; og_currency: currency; og_price: number; quantity: number; tax_category: tax_category; tax_inclusive: boolean; tax_rate: number; description?: string; discount_amount?: number; tax?: number; }[]; description?: string; discount_amount?: number; discount_cycle?: number; name?: string; tax?: number; }[]; total_price: number; next_billing_date?: string; recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }; tax_id_business_name?: string; tax_id_err_msg?: string; tax_id_format_name?: string; total_tax?: number; trial_amount?: number; trial_period_days?: number; }`\n Data returned by the calculate checkout session API\n\n - `billing_country: string`\n - `currency: string`\n - `current_breakup: { discount: number; subtotal: number; total_amount: number; tax?: number; }`\n - `is_byop: boolean`\n - `product_cart: { credit_entitlements: { credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; }[]; currency: string; discounted_price: number; is_subscription: boolean; is_usage_based: boolean; meters: { measurement_unit: string; name: string; price_per_unit: string; description?: string; free_threshold?: number; }[]; og_currency: string; og_price: number; product_id: string; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive: boolean; tax_rate: number; addons?: { addon_id: string; currency: string; discounted_price: number; name: string; og_currency: string; og_price: number; quantity: number; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive: boolean; tax_rate: number; description?: string; discount_amount?: number; tax?: number; }[]; description?: string; discount_amount?: number; discount_cycle?: number; name?: string; tax?: number; }[]`\n - `total_price: number`\n - `next_billing_date?: string`\n - `recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }`\n - `tax_id_business_name?: string`\n - `tax_id_err_msg?: string`\n - `tax_id_format_name?: string`\n - `total_tax?: number`\n - `trial_amount?: number`\n - `trial_period_days?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.checkoutSessions.preview({ product_cart: [{ product_id: 'product_id', quantity: 0 }] });\n\nconsole.log(response);\n```",
|
|
205
205
|
perLanguage: {
|
|
206
206
|
typescript: {
|
|
207
207
|
method: 'client.checkoutSessions.preview',
|
|
@@ -252,6 +252,7 @@ const EMBEDDED_METHODS = [
|
|
|
252
252
|
'brand_id?: string;',
|
|
253
253
|
'created_at_gte?: string;',
|
|
254
254
|
'created_at_lte?: string;',
|
|
255
|
+
'currency?: string;',
|
|
255
256
|
'customer_id?: string;',
|
|
256
257
|
'page_number?: number;',
|
|
257
258
|
'page_size?: number;',
|
|
@@ -260,7 +261,7 @@ const EMBEDDED_METHODS = [
|
|
|
260
261
|
'subscription_id?: string;',
|
|
261
262
|
],
|
|
262
263
|
response: "{ brand_id: string; created_at: string; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; digital_products_delivered: boolean; has_license_key: boolean; metadata: object; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; total_amount: number; card_last_four?: string; card_network?: string; dispute_status?: string; invoice_id?: string; invoice_url?: string; payment_method?: string; payment_method_type?: string; refund_status?: 'partial' | 'full'; status?: string; subscription_id?: string; }",
|
|
263
|
-
markdown: "## list\n\n`client.payments.list(brand_id?: string, created_at_gte?: string, created_at_lte?: string, customer_id?: string, page_number?: number, page_size?: number, product_id?: string, status?: string, subscription_id?: string): { brand_id: string; created_at: string; currency: currency; customer: customer_limited_details; digital_products_delivered: boolean; has_license_key: boolean; metadata: metadata; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; total_amount: number; card_last_four?: string; card_network?: string; dispute_status?: dispute_status; invoice_id?: string; invoice_url?: string; payment_method?: string; payment_method_type?: string; refund_status?: payment_refund_status; status?: intent_status; subscription_id?: string; }`\n\n**get** `/payments`\n\n### Parameters\n\n- `brand_id?: string`\n filter by Brand id\n\n- `created_at_gte?: string`\n Get events after this created time\n\n- `created_at_lte?: string`\n Get events created before this time\n\n- `customer_id?: string`\n Filter by customer id\n\n- `page_number?: number`\n Page number default is 0
|
|
264
|
+
markdown: "## list\n\n`client.payments.list(brand_id?: string, created_at_gte?: string, created_at_lte?: string, currency?: string, customer_id?: string, page_number?: number, page_size?: number, product_id?: string, status?: string, subscription_id?: string): { brand_id: string; created_at: string; currency: currency; customer: customer_limited_details; digital_products_delivered: boolean; has_license_key: boolean; metadata: metadata; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; total_amount: number; card_last_four?: string; card_network?: string; dispute_status?: dispute_status; invoice_id?: string; invoice_url?: string; payment_method?: string; payment_method_type?: string; refund_status?: payment_refund_status; status?: intent_status; subscription_id?: string; }`\n\n**get** `/payments`\n\n### Parameters\n\n- `brand_id?: string`\n filter by Brand id\n\n- `created_at_gte?: string`\n Get events after this created time\n\n- `created_at_lte?: string`\n Get events created before this time\n\n- `currency?: string`\n Filter by currency\n\n- `customer_id?: string`\n Filter by customer id\n\n- `page_number?: number`\n Page number default is 0. Capped to bound OFFSET-based deep pagination,\nwhich forces Postgres to scan and discard every preceding row.\n\n- `page_size?: number`\n Page size default is 10 max is 100\n\n- `product_id?: string`\n Filter by product id\n\n- `status?: string`\n Filter by status\n\n- `subscription_id?: string`\n Filter by subscription id\n\n### Returns\n\n- `{ brand_id: string; created_at: string; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; digital_products_delivered: boolean; has_license_key: boolean; metadata: object; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; total_amount: number; card_last_four?: string; card_network?: string; dispute_status?: string; invoice_id?: string; invoice_url?: string; payment_method?: string; payment_method_type?: string; refund_status?: 'partial' | 'full'; status?: string; subscription_id?: string; }`\n\n - `brand_id: string`\n - `created_at: string`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `digital_products_delivered: boolean`\n - `has_license_key: boolean`\n - `metadata: object`\n - `payment_id: string`\n - `payment_provider: 'stripe' | 'adyen' | 'dodo'`\n - `total_amount: number`\n - `card_last_four?: string`\n - `card_network?: string`\n - `dispute_status?: string`\n - `invoice_id?: string`\n - `invoice_url?: string`\n - `payment_method?: string`\n - `payment_method_type?: string`\n - `refund_status?: 'partial' | 'full'`\n - `status?: string`\n - `subscription_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\n// Automatically fetches more pages as needed.\nfor await (const paymentListResponse of client.payments.list()) {\n console.log(paymentListResponse);\n}\n```",
|
|
264
265
|
perLanguage: {
|
|
265
266
|
typescript: {
|
|
266
267
|
method: 'client.payments.list',
|
|
@@ -291,7 +292,7 @@ const EMBEDDED_METHODS = [
|
|
|
291
292
|
},
|
|
292
293
|
php: {
|
|
293
294
|
method: 'payments->list',
|
|
294
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$page = $client->payments->list(\n brandID: 'brand_id',\n createdAtGte: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n createdAtLte: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n customerID: 'customer_id',\n pageNumber: 0,\n pageSize: 0,\n productID: 'product_id',\n status: 'succeeded',\n subscriptionID: 'subscription_id',\n);\n\nvar_dump($page);",
|
|
295
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$page = $client->payments->list(\n brandID: 'brand_id',\n createdAtGte: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n createdAtLte: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n currency: 'AED',\n customerID: 'customer_id',\n pageNumber: 0,\n pageSize: 0,\n productID: 'product_id',\n status: 'succeeded',\n subscriptionID: 'subscription_id',\n);\n\nvar_dump($page);",
|
|
295
296
|
},
|
|
296
297
|
csharp: {
|
|
297
298
|
method: 'Payments.List',
|
|
@@ -378,7 +379,7 @@ const EMBEDDED_METHODS = [
|
|
|
378
379
|
qualified: 'client.payments.retrieve',
|
|
379
380
|
params: ['payment_id: string;'],
|
|
380
381
|
response: "{ billing: object; brand_id: string; business_id: string; created_at: string; currency: string; customer: object; digital_products_delivered: boolean; disputes: object[]; is_update_payment_method: boolean; metadata: object; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; refunds: object[]; retry_attempt: number; settlement_amount: number; settlement_currency: string; total_amount: number; card_holder_name?: string; card_issuing_country?: string; card_last_four?: string; card_network?: string; card_type?: string; checkout_session_id?: string; custom_field_responses?: object[]; discount_id?: string; discounts?: object[]; error_code?: string; error_message?: string; invoice_id?: string; invoice_url?: string; payment_link?: string; payment_method?: string; payment_method_id?: string; payment_method_type?: string; product_cart?: { product_id: string; quantity: number; }[]; refund_status?: 'partial' | 'full'; settlement_tax?: number; status?: string; subscription_id?: string; tax?: number; updated_at?: string; }",
|
|
381
|
-
markdown: "## retrieve\n\n`client.payments.retrieve(payment_id: string): { billing: billing_address; brand_id: string; business_id: string; created_at: string; currency: currency; customer: customer_limited_details; digital_products_delivered: boolean; disputes: dispute[]; is_update_payment_method: boolean; metadata: metadata; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; refunds: refund_list_item[]; retry_attempt: number; settlement_amount: number; settlement_currency: currency; total_amount: number; card_holder_name?: string; card_issuing_country?: country_code; card_last_four?: string; card_network?: string; card_type?: string; checkout_session_id?: string; custom_field_responses?: custom_field_response[]; discount_id?: string; discounts?: discount_detail[]; error_code?: string; error_message?: string; invoice_id?: string; invoice_url?: string; payment_link?: string; payment_method?: string; payment_method_id?: string; payment_method_type?: string; product_cart?: object[]; refund_status?: payment_refund_status; settlement_tax?: number; status?: intent_status; subscription_id?: string; tax?: number; updated_at?: string; }`\n\n**get** `/payments/{payment_id}`\n\n### Parameters\n\n- `payment_id: string`\n\n### Returns\n\n- `{ billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }; brand_id: string; business_id: string; created_at: string; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; digital_products_delivered: boolean; disputes: { amount: string; business_id: string; created_at: string; currency: string; dispute_id: string; dispute_stage: dispute_stage; dispute_status: dispute_status; payment_id: string; is_resolved_by_rdr?: boolean; remarks?: string; }[]; is_update_payment_method: boolean; metadata: object; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; refunds: { business_id: string; created_at: string; is_partial: boolean; payment_id: string; refund_id: string; status: refund_status; amount?: number; currency?: currency; reason?: string; }[]; retry_attempt: number; settlement_amount: number; settlement_currency: string; total_amount: number; card_holder_name?: string; card_issuing_country?: string; card_last_four?: string; card_network?: string; card_type?: string; checkout_session_id?: string; custom_field_responses?: { key: string; value: string; }[]; 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; }[]; error_code?: string; error_message?: string; invoice_id?: string; invoice_url?: string; payment_link?: string; payment_method?: string; payment_method_id?: string; payment_method_type?: string; product_cart?: { product_id: string; quantity: number; }[]; refund_status?: 'partial' | 'full'; settlement_tax?: number; status?: string; subscription_id?: string; tax?: number; updated_at?: string; }`\n\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `brand_id: string`\n - `business_id: string`\n - `created_at: string`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `digital_products_delivered: boolean`\n - `disputes: { amount: string; business_id: string; created_at: string; currency: string; dispute_id: string; dispute_stage: 'pre_dispute' | 'dispute' | 'pre_arbitration'; dispute_status: string; payment_id: string; is_resolved_by_rdr?: boolean; remarks?: string; }[]`\n - `is_update_payment_method: boolean`\n - `metadata: object`\n - `payment_id: string`\n - `payment_provider: 'stripe' | 'adyen' | 'dodo'`\n - `refunds: { business_id: string; created_at: string; is_partial: boolean; payment_id: string; refund_id: string; status: 'succeeded' | 'failed' | 'pending' | 'review'; amount?: number; currency?: string; reason?: string; }[]`\n - `retry_attempt: number`\n - `settlement_amount: number`\n - `settlement_currency: string`\n - `total_amount: number`\n - `card_holder_name?: string`\n - `card_issuing_country?: string`\n - `card_last_four?: string`\n - `card_network?: string`\n - `card_type?: string`\n - `checkout_session_id?: string`\n - `custom_field_responses?: { key: string; value: string; }[]`\n - `discount_id?: string`\n - `discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]`\n - `error_code?: string`\n - `error_message?: string`\n - `invoice_id?: string`\n - `invoice_url?: string`\n - `payment_link?: string`\n - `payment_method?: string`\n - `payment_method_id?: string`\n - `payment_method_type?: string`\n - `product_cart?: { product_id: string; quantity: number; }[]`\n - `refund_status?: 'partial' | 'full'`\n - `settlement_tax?: number`\n - `status?: string`\n - `subscription_id?: string`\n - `tax?: number`\n - `updated_at?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst payment = await client.payments.retrieve('pay_gr4RizvMOXFJ6xca3y2tU');\n\nconsole.log(payment);\n```",
|
|
382
|
+
markdown: "## retrieve\n\n`client.payments.retrieve(payment_id: string): { billing: billing_address; brand_id: string; business_id: string; created_at: string; currency: currency; customer: customer_limited_details; digital_products_delivered: boolean; disputes: dispute[]; is_update_payment_method: boolean; metadata: metadata; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; refunds: refund_list_item[]; retry_attempt: number; settlement_amount: number; settlement_currency: currency; total_amount: number; card_holder_name?: string; card_issuing_country?: country_code; card_last_four?: string; card_network?: string; card_type?: string; checkout_session_id?: string; custom_field_responses?: custom_field_response[]; discount_id?: string; discounts?: discount_detail[]; error_code?: string; error_message?: string; invoice_id?: string; invoice_url?: string; payment_link?: string; payment_method?: string; payment_method_id?: string; payment_method_type?: string; product_cart?: object[]; refund_status?: payment_refund_status; settlement_tax?: number; status?: intent_status; subscription_id?: string; tax?: number; updated_at?: string; }`\n\n**get** `/payments/{payment_id}`\n\n### Parameters\n\n- `payment_id: string`\n\n### Returns\n\n- `{ billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }; brand_id: string; business_id: string; created_at: string; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; digital_products_delivered: boolean; disputes: { amount: string; business_id: string; created_at: string; currency: string; dispute_id: string; dispute_stage: dispute_stage; dispute_status: dispute_status; payment_id: string; is_resolved_by_rdr?: boolean; remarks?: string; }[]; is_update_payment_method: boolean; metadata: object; payment_id: string; payment_provider: 'stripe' | 'adyen' | 'dodo'; refunds: { business_id: string; created_at: string; is_partial: boolean; payment_id: string; refund_id: string; status: refund_status; amount?: number; currency?: currency; reason?: string; }[]; retry_attempt: number; settlement_amount: number; settlement_currency: string; total_amount: number; card_holder_name?: string; card_issuing_country?: string; card_last_four?: string; card_network?: string; card_type?: string; checkout_session_id?: string; custom_field_responses?: { key: string; value: string; }[]; 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; }[]; error_code?: string; error_message?: string; invoice_id?: string; invoice_url?: string; payment_link?: string; payment_method?: string; payment_method_id?: string; payment_method_type?: string; product_cart?: { product_id: string; quantity: number; }[]; refund_status?: 'partial' | 'full'; settlement_tax?: number; status?: string; subscription_id?: string; tax?: number; updated_at?: string; }`\n\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `brand_id: string`\n - `business_id: string`\n - `created_at: string`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `digital_products_delivered: boolean`\n - `disputes: { amount: string; business_id: string; created_at: string; currency: string; dispute_id: string; dispute_stage: 'pre_dispute' | 'dispute' | 'pre_arbitration'; dispute_status: string; payment_id: string; is_resolved_by_rdr?: boolean; remarks?: string; }[]`\n - `is_update_payment_method: boolean`\n - `metadata: object`\n - `payment_id: string`\n - `payment_provider: 'stripe' | 'adyen' | 'dodo'`\n - `refunds: { business_id: string; created_at: string; is_partial: boolean; payment_id: string; refund_id: string; status: 'succeeded' | 'failed' | 'pending' | 'review'; amount?: number; currency?: string; reason?: string; }[]`\n - `retry_attempt: number`\n - `settlement_amount: number`\n - `settlement_currency: string`\n - `total_amount: number`\n - `card_holder_name?: string`\n - `card_issuing_country?: string`\n - `card_last_four?: string`\n - `card_network?: string`\n - `card_type?: string`\n - `checkout_session_id?: string`\n - `custom_field_responses?: { key: string; value: string; }[]`\n - `discount_id?: string`\n - `discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]`\n - `error_code?: string`\n - `error_message?: string`\n - `invoice_id?: string`\n - `invoice_url?: string`\n - `payment_link?: string`\n - `payment_method?: string`\n - `payment_method_id?: string`\n - `payment_method_type?: string`\n - `product_cart?: { product_id: string; quantity: number; }[]`\n - `refund_status?: 'partial' | 'full'`\n - `settlement_tax?: number`\n - `status?: string`\n - `subscription_id?: string`\n - `tax?: number`\n - `updated_at?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst payment = await client.payments.retrieve('pay_gr4RizvMOXFJ6xca3y2tU');\n\nconsole.log(payment);\n```",
|
|
382
383
|
perLanguage: {
|
|
383
384
|
typescript: {
|
|
384
385
|
method: 'client.payments.retrieve',
|
|
@@ -485,8 +486,8 @@ const EMBEDDED_METHODS = [
|
|
|
485
486
|
'product_id?: string;',
|
|
486
487
|
"status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';",
|
|
487
488
|
],
|
|
488
|
-
response: "{ billing: object; cancel_at_next_billing_date: boolean; created_at: string; currency: string; customer: object; discounts: { discount_id: string; discount_cycles_remaining?: number; }[]; metadata: object; 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' | 'cancelled' | 'failed' | 'expired'; subscription_id: string; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; tax_inclusive: boolean; trial_period_days: number; cancelled_at?: string; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; payment_method_id?: string; product_name?: string; scheduled_change?: object; tax_id?: string; }",
|
|
489
|
-
markdown: "## list\n\n`client.subscriptions.list(brand_id?: string, cancel_at_next_billing_date?: boolean, created_at_gte?: string, created_at_lte?: string, customer_id?: string, page_number?: number, page_size?: number, product_id?: string, status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'): { billing: billing_address; cancel_at_next_billing_date: boolean; created_at: string; currency: currency; customer: customer_limited_details; discounts: object[]; metadata: metadata; 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; cancelled_at?: string; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; payment_method_id?: string; product_name?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; }`\n\n**get** `/subscriptions`\n\n### Parameters\n\n- `brand_id?: string`\n filter by Brand id\n\n- `cancel_at_next_billing_date?: boolean`\n Filter by cancel_at_next_billing_date (subscriptions scheduled for cancellation)\n\n- `created_at_gte?: string`\n Get events after this created time\n\n- `created_at_lte?: string`\n Get events created before this time\n\n- `customer_id?: string`\n Filter by customer id\n\n- `page_number?: number`\n Page number default is 0\n\n- `page_size?: number`\n Page size default is 10 max is 100\n\n- `product_id?: string`\n Filter by product id\n\n- `status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n Filter by status\n\n### Returns\n\n- `{ billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }; cancel_at_next_billing_date: boolean; created_at: string; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; discounts: { discount_id: string; discount_cycles_remaining?: number; }[]; metadata: object; 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' | 'cancelled' | 'failed' | 'expired'; subscription_id: string; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; tax_inclusive: boolean; trial_period_days: number; cancelled_at?: string; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; payment_method_id?: string; product_name?: 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; }`\n Response struct representing subscription details\n\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `cancel_at_next_billing_date: boolean`\n - `created_at: string`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `discounts: { discount_id: string; discount_cycles_remaining?: number; }[]`\n - `metadata: object`\n - `next_billing_date: string`\n - `on_demand: boolean`\n - `payment_frequency_count: number`\n - `payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `previous_billing_date: string`\n - `product_id: string`\n - `quantity: number`\n - `recurring_pre_tax_amount: number`\n - `status: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n - `subscription_id: string`\n - `subscription_period_count: number`\n - `subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `tax_inclusive: boolean`\n - `trial_period_days: number`\n - `cancelled_at?: string`\n - `customer_business_name?: string`\n - `discount_cycles_remaining?: number`\n - `discount_id?: string`\n - `payment_method_id?: string`\n - `product_name?: string`\n - `scheduled_change?: { id: string; addons: { addon_id: string; name: string; quantity: number; }[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }`\n - `tax_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\n// Automatically fetches more pages as needed.\nfor await (const subscriptionListResponse of client.subscriptions.list()) {\n console.log(subscriptionListResponse);\n}\n```",
|
|
489
|
+
response: "{ billing: object; cancel_at_next_billing_date: boolean; created_at: string; currency: string; customer: object; discounts: { discount_id: string; discount_cycles_remaining?: number; }[]; metadata: object; 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' | 'cancelled' | 'failed' | 'expired'; subscription_id: string; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; tax_inclusive: boolean; trial_period_days: number; cancelled_at?: string; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; payment_method_id?: string; product_name?: string; scheduled_change?: object; tax_id?: string; trial_amount?: number; }",
|
|
490
|
+
markdown: "## list\n\n`client.subscriptions.list(brand_id?: string, cancel_at_next_billing_date?: boolean, created_at_gte?: string, created_at_lte?: string, customer_id?: string, page_number?: number, page_size?: number, product_id?: string, status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'): { billing: billing_address; cancel_at_next_billing_date: boolean; created_at: string; currency: currency; customer: customer_limited_details; discounts: object[]; metadata: metadata; 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; cancelled_at?: string; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; payment_method_id?: string; product_name?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; trial_amount?: number; }`\n\n**get** `/subscriptions`\n\n### Parameters\n\n- `brand_id?: string`\n filter by Brand id\n\n- `cancel_at_next_billing_date?: boolean`\n Filter by cancel_at_next_billing_date (subscriptions scheduled for cancellation)\n\n- `created_at_gte?: string`\n Get events after this created time\n\n- `created_at_lte?: string`\n Get events created before this time\n\n- `customer_id?: string`\n Filter by customer id\n\n- `page_number?: number`\n Page number default is 0\n\n- `page_size?: number`\n Page size default is 10 max is 100\n\n- `product_id?: string`\n Filter by product id\n\n- `status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n Filter by status\n\n### Returns\n\n- `{ billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }; cancel_at_next_billing_date: boolean; created_at: string; currency: string; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; discounts: { discount_id: string; discount_cycles_remaining?: number; }[]; metadata: object; 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' | 'cancelled' | 'failed' | 'expired'; subscription_id: string; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; tax_inclusive: boolean; trial_period_days: number; cancelled_at?: string; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; payment_method_id?: string; product_name?: 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 Response struct representing subscription details\n\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `cancel_at_next_billing_date: boolean`\n - `created_at: string`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `discounts: { discount_id: string; discount_cycles_remaining?: number; }[]`\n - `metadata: object`\n - `next_billing_date: string`\n - `on_demand: boolean`\n - `payment_frequency_count: number`\n - `payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `previous_billing_date: string`\n - `product_id: string`\n - `quantity: number`\n - `recurring_pre_tax_amount: number`\n - `status: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n - `subscription_id: string`\n - `subscription_period_count: number`\n - `subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `tax_inclusive: boolean`\n - `trial_period_days: number`\n - `cancelled_at?: string`\n - `customer_business_name?: string`\n - `discount_cycles_remaining?: number`\n - `discount_id?: string`\n - `payment_method_id?: string`\n - `product_name?: string`\n - `scheduled_change?: { id: string; addons: { addon_id: string; name: string; quantity: number; }[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }`\n - `tax_id?: string`\n - `trial_amount?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\n// Automatically fetches more pages as needed.\nfor await (const subscriptionListResponse of client.subscriptions.list()) {\n console.log(subscriptionListResponse);\n}\n```",
|
|
490
491
|
perLanguage: {
|
|
491
492
|
typescript: {
|
|
492
493
|
method: 'client.subscriptions.list',
|
|
@@ -559,8 +560,8 @@ const EMBEDDED_METHODS = [
|
|
|
559
560
|
'tax_id?: string;',
|
|
560
561
|
'trial_period_days?: number;',
|
|
561
562
|
],
|
|
562
|
-
response: '{ addons: { addon_id: string; quantity: number; }[]; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; metadata: object; payment_id: string; recurring_pre_tax_amount: number; subscription_id: string; client_secret?: string; discount_id?: string; discount_ids?: string[]; expires_on?: string; one_time_product_cart?: { product_id: string; quantity: number; }[]; payment_link?: string; }',
|
|
563
|
-
markdown: "## create\n\n`client.subscriptions.create(billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, customer: object | object, product_id: string, quantity: number, addons?: { addon_id: string; quantity: number; }[], allowed_payment_method_types?: string[], billing_currency?: string, customer_business_name?: string, discount_code?: string, discount_codes?: string[], force_3ds?: boolean, mandate_min_amount_inr_paise?: number, metadata?: object, on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: currency; product_description?: string; product_price?: number; }, one_time_product_cart?: { product_id: string; quantity: number; amount?: number; }[], payment_link?: boolean, payment_method_id?: string, redirect_immediately?: boolean, require_phone_number?: boolean, return_url?: string, short_link?: boolean, show_saved_payment_methods?: boolean, tax_id?: string, trial_period_days?: number): { addons: addon_cart_response_item[]; customer: customer_limited_details; metadata: metadata; payment_id: string; recurring_pre_tax_amount: number; subscription_id: string; client_secret?: string; discount_id?: string; discount_ids?: string[]; expires_on?: string; one_time_product_cart?: object[]; payment_link?: string; }`\n\n**post** `/subscriptions`\n\n### Parameters\n\n- `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n Billing address information for the subscription\n - `country: string`\n Two-letter ISO country code (ISO 3166-1 alpha-2)\n - `city?: string`\n City name\n - `state?: string`\n State or province name\n - `street?: string`\n Street address including house number and unit/apartment if applicable\n - `zipcode?: string`\n Postal code or ZIP code\n\n- `customer: { customer_id: string; } | { email: string; name?: string; phone_number?: string; }`\n Customer details for the subscription\n\n- `product_id: string`\n Unique identifier of the product to subscribe to\n\n- `quantity: number`\n Number of units to subscribe for. Must be at least 1.\n\n- `addons?: { addon_id: string; quantity: number; }[]`\n Attach addons to this subscription\n\n- `allowed_payment_method_types?: string[]`\n List of payment methods allowed during checkout.\n\nCustomers will **never** see payment methods that are **not** in this list.\nHowever, adding a method here **does not guarantee** customers will see it.\nAvailability still depends on other factors (e.g., customer location, merchant settings).\n\n- `billing_currency?: string`\n Fix the currency in which the end customer is billed.\nIf Dodo Payments cannot support that currency for this transaction, it will not proceed\n\n- `customer_business_name?: string`\n Optional business / legal name associated with the tax id. When provided\ntogether with a valid tax id for a B2B purchase, this name is rendered\non the invoice instead of the customer's personal name.\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, in order of application. Max 20.\nCannot be used together with discount_code.\n\n- `force_3ds?: boolean`\n Override merchant default 3DS behaviour for this subscription\n\n- `mandate_min_amount_inr_paise?: number`\n Override the merchant-level mandate floor (in INR paise) for INR\ne-mandates on Indian-card recurring payments. The mandate amount sent to\nthe processor is `max(this_floor, actual_billing_amount)`, so this is\neffectively the customer-facing authorization ceiling whenever billing is\nlower. When unset, the merchant setting applies; when that's also unset,\nthe system default of ₹15,000 applies.\n\n- `metadata?: object`\n Additional metadata for the subscription\nDefaults to empty if not specified\n\n- `on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: string; product_description?: string; product_price?: number; }`\n - `mandate_only: boolean`\n If set as True, does not perform any charge and only authorizes payment method details for future use.\n - `adaptive_currency_fees_inclusive?: boolean`\n Whether adaptive currency fees should be included in the product_price (true) or added on top (false).\nThis field is ignored if adaptive pricing is not enabled for the business.\n - `product_currency?: string`\n Optional currency of the product price. If not specified, defaults to the currency of the product.\n - `product_description?: string`\n Optional product description override for billing and line items.\nIf not specified, the stored description of the product will be used.\n - `product_price?: number`\n Product price for the initial charge to customer\nIf not specified the stored price of the product will be used\nRepresented in the lowest denomination of the currency (e.g., cents for USD).\nFor example, to charge $1.00, pass `100`.\n\n- `one_time_product_cart?: { product_id: string; quantity: number; amount?: number; }[]`\n List of one time products that will be bundled with the first payment for this subscription\n\n- `payment_link?: boolean`\n If true, generates a payment link.\nDefaults to false if not specified.\n\n- `payment_method_id?: string`\n Optional payment method ID to use for this subscription.\nIf provided, customer_id must also be provided (via AttachExistingCustomer).\nThe payment method will be validated for eligibility with the subscription's currency.\n\n- `redirect_immediately?: boolean`\n If true, redirects the customer immediately after payment completion\nFalse by default\n\n- `require_phone_number?: boolean`\n If true, the customer's phone number is required to create this subscription.\nTypically set alongside `payment_link=true` so merchants can enforce phone\ncollection on the hosted payment page. Defaults to false.\n\n- `return_url?: string`\n Optional URL to redirect after successful subscription creation\n\n- `short_link?: boolean`\n If true, returns a shortened payment link.\nDefaults to false if not specified.\n\n- `show_saved_payment_methods?: boolean`\n Display saved payment methods of a returning customer\nFalse by default\n\n- `tax_id?: string`\n Tax ID in case the payment is B2B. If tax id validation fails the payment creation will fail\n\n- `trial_period_days?: number`\n Optional trial period in days\nIf specified, this value overrides the trial period set in the product's price\nMust be between 0 and 10000 days\n\n### Returns\n\n- `{ addons: { addon_id: string; quantity: number; }[]; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; metadata: object; payment_id: string; recurring_pre_tax_amount: number; subscription_id: string; client_secret?: string; discount_id?: string; discount_ids?: string[]; expires_on?: string; one_time_product_cart?: { product_id: string; quantity: number; }[]; payment_link?: string; }`\n\n - `addons: { addon_id: string; quantity: number; }[]`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `payment_id: string`\n - `recurring_pre_tax_amount: number`\n - `subscription_id: string`\n - `client_secret?: string`\n - `discount_id?: string`\n - `discount_ids?: string[]`\n - `expires_on?: string`\n - `one_time_product_cart?: { product_id: string; quantity: number; }[]`\n - `payment_link?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst subscription = await client.subscriptions.create({\n billing: { country: 'AF' },\n customer: { customer_id: 'customer_id' },\n product_id: 'product_id',\n quantity: 0,\n});\n\nconsole.log(subscription);\n```",
|
|
563
|
+
response: '{ addons: { addon_id: string; quantity: number; }[]; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; metadata: object; payment_id: string; recurring_pre_tax_amount: number; subscription_id: string; client_secret?: string; discount_id?: string; discount_ids?: string[]; expires_on?: string; one_time_product_cart?: { product_id: string; quantity: number; }[]; payment_link?: string; trial_amount?: number; }',
|
|
564
|
+
markdown: "## create\n\n`client.subscriptions.create(billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, customer: object | object, product_id: string, quantity: number, addons?: { addon_id: string; quantity: number; }[], allowed_payment_method_types?: string[], billing_currency?: string, customer_business_name?: string, discount_code?: string, discount_codes?: string[], force_3ds?: boolean, mandate_min_amount_inr_paise?: number, metadata?: object, on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: currency; product_description?: string; product_price?: number; }, one_time_product_cart?: { product_id: string; quantity: number; amount?: number; }[], payment_link?: boolean, payment_method_id?: string, redirect_immediately?: boolean, require_phone_number?: boolean, return_url?: string, short_link?: boolean, show_saved_payment_methods?: boolean, tax_id?: string, trial_period_days?: number): { addons: addon_cart_response_item[]; customer: customer_limited_details; metadata: metadata; payment_id: string; recurring_pre_tax_amount: number; subscription_id: string; client_secret?: string; discount_id?: string; discount_ids?: string[]; expires_on?: string; one_time_product_cart?: object[]; payment_link?: string; trial_amount?: number; }`\n\n**post** `/subscriptions`\n\n### Parameters\n\n- `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n Billing address information for the subscription\n - `country: string`\n Two-letter ISO country code (ISO 3166-1 alpha-2)\n - `city?: string`\n City name\n - `state?: string`\n State or province name\n - `street?: string`\n Street address including house number and unit/apartment if applicable\n - `zipcode?: string`\n Postal code or ZIP code\n\n- `customer: { customer_id: string; } | { email: string; name?: string; phone_number?: string; }`\n Customer details for the subscription\n\n- `product_id: string`\n Unique identifier of the product to subscribe to\n\n- `quantity: number`\n Number of units to subscribe for. Must be at least 1.\n\n- `addons?: { addon_id: string; quantity: number; }[]`\n Attach addons to this subscription\n\n- `allowed_payment_method_types?: string[]`\n List of payment methods allowed during checkout.\n\nCustomers will **never** see payment methods that are **not** in this list.\nHowever, adding a method here **does not guarantee** customers will see it.\nAvailability still depends on other factors (e.g., customer location, merchant settings).\n\n- `billing_currency?: string`\n Fix the currency in which the end customer is billed.\nIf Dodo Payments cannot support that currency for this transaction, it will not proceed\n\n- `customer_business_name?: string`\n Optional business / legal name associated with the tax id. When provided\ntogether with a valid tax id for a B2B purchase, this name is rendered\non the invoice instead of the customer's personal name.\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, in order of application. Max 20.\nCannot be used together with discount_code.\n\n- `force_3ds?: boolean`\n Override merchant default 3DS behaviour for this subscription\n\n- `mandate_min_amount_inr_paise?: number`\n Override the merchant-level mandate floor (in INR paise) for INR\ne-mandates on Indian-card recurring payments. The mandate amount sent to\nthe processor is `max(this_floor, actual_billing_amount)`, so this is\neffectively the customer-facing authorization ceiling whenever billing is\nlower. When unset, the merchant setting applies; when that's also unset,\nthe system default of ₹15,000 applies.\n\n- `metadata?: object`\n Additional metadata for the subscription\nDefaults to empty if not specified\n\n- `on_demand?: { mandate_only: boolean; adaptive_currency_fees_inclusive?: boolean; product_currency?: string; product_description?: string; product_price?: number; }`\n - `mandate_only: boolean`\n If set as True, does not perform any charge and only authorizes payment method details for future use.\n - `adaptive_currency_fees_inclusive?: boolean`\n Whether adaptive currency fees should be included in the product_price (true) or added on top (false).\nThis field is ignored if adaptive pricing is not enabled for the business.\n - `product_currency?: string`\n Optional currency of the product price. If not specified, defaults to the currency of the product.\n - `product_description?: string`\n Optional product description override for billing and line items.\nIf not specified, the stored description of the product will be used.\n - `product_price?: number`\n Product price for the initial charge to customer\nIf not specified the stored price of the product will be used\nRepresented in the lowest denomination of the currency (e.g., cents for USD).\nFor example, to charge $1.00, pass `100`.\n\n- `one_time_product_cart?: { product_id: string; quantity: number; amount?: number; }[]`\n List of one time products that will be bundled with the first payment for this subscription\n\n- `payment_link?: boolean`\n If true, generates a payment link.\nDefaults to false if not specified.\n\n- `payment_method_id?: string`\n Optional payment method ID to use for this subscription.\nIf provided, customer_id must also be provided (via AttachExistingCustomer).\nThe payment method will be validated for eligibility with the subscription's currency.\n\n- `redirect_immediately?: boolean`\n If true, redirects the customer immediately after payment completion\nFalse by default\n\n- `require_phone_number?: boolean`\n If true, the customer's phone number is required to create this subscription.\nTypically set alongside `payment_link=true` so merchants can enforce phone\ncollection on the hosted payment page. Defaults to false.\n\n- `return_url?: string`\n Optional URL to redirect after successful subscription creation\n\n- `short_link?: boolean`\n If true, returns a shortened payment link.\nDefaults to false if not specified.\n\n- `show_saved_payment_methods?: boolean`\n Display saved payment methods of a returning customer\nFalse by default\n\n- `tax_id?: string`\n Tax ID in case the payment is B2B. If tax id validation fails the payment creation will fail\n\n- `trial_period_days?: number`\n Optional trial period in days\nIf specified, this value overrides the trial period set in the product's price\nMust be between 0 and 10000 days\n\n### Returns\n\n- `{ addons: { addon_id: string; quantity: number; }[]; customer: { customer_id: string; email: string; name: string; metadata?: metadata; phone_number?: string; }; metadata: object; payment_id: string; recurring_pre_tax_amount: number; subscription_id: string; client_secret?: string; discount_id?: string; discount_ids?: string[]; expires_on?: string; one_time_product_cart?: { product_id: string; quantity: number; }[]; payment_link?: string; trial_amount?: number; }`\n\n - `addons: { addon_id: string; quantity: number; }[]`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `payment_id: string`\n - `recurring_pre_tax_amount: number`\n - `subscription_id: string`\n - `client_secret?: string`\n - `discount_id?: string`\n - `discount_ids?: string[]`\n - `expires_on?: string`\n - `one_time_product_cart?: { product_id: string; quantity: number; }[]`\n - `payment_link?: string`\n - `trial_amount?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst subscription = await client.subscriptions.create({\n billing: { country: 'AF' },\n customer: { customer_id: 'customer_id' },\n product_id: 'product_id',\n quantity: 0,\n});\n\nconsole.log(subscription);\n```",
|
|
564
565
|
perLanguage: {
|
|
565
566
|
typescript: {
|
|
566
567
|
method: 'client.subscriptions.create',
|
|
@@ -608,8 +609,8 @@ const EMBEDDED_METHODS = [
|
|
|
608
609
|
stainlessPath: '(resource) subscriptions > (method) retrieve',
|
|
609
610
|
qualified: 'client.subscriptions.retrieve',
|
|
610
611
|
params: ['subscription_id: string;'],
|
|
611
|
-
response: "{ addons: object[]; billing: object; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: object[]; currency: string; customer: object; metadata: object; meter_credit_entitlement_cart: object[]; meters: object[]; 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' | 'cancelled' | 'failed' | 'expired'; 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; custom_field_responses?: object[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: object[]; expires_at?: string; payment_method_id?: string; scheduled_change?: object; tax_id?: string; }",
|
|
612
|
-
markdown: "## retrieve\n\n`client.subscriptions.retrieve(subscription_id: string): { 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; 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; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_at?: string; payment_method_id?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; }`\n\n**get** `/subscriptions/{subscription_id}`\n\n### Parameters\n\n- `subscription_id: string`\n\n### Returns\n\n- `{ 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; }; 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' | 'cancelled' | 'failed' | 'expired'; 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; 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; 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; }`\n Response struct representing subscription details\n\n - `addons: { addon_id: string; quantity: number; }[]`\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `brand_id: string`\n - `cancel_at_next_billing_date: boolean`\n - `created_at: string`\n - `credit_entitlement_cart: { credit_entitlement_id: string; credit_entitlement_name: string; credits_amount: string; overage_balance: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; 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?: 'Day' | 'Week' | 'Month' | 'Year'; }[]`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `meter_credit_entitlement_cart: { credit_entitlement_id: string; meter_id: string; meter_name: string; meter_units_per_credit: string; product_id: string; }[]`\n - `meters: { currency: string; free_threshold: number; measurement_unit: string; meter_id: string; name: string; description?: string; price_per_unit?: string; }[]`\n - `next_billing_date: string`\n - `on_demand: boolean`\n - `payment_frequency_count: number`\n - `payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `previous_billing_date: string`\n - `product_id: string`\n - `quantity: number`\n - `recurring_pre_tax_amount: number`\n - `status: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n - `subscription_id: string`\n - `subscription_period_count: number`\n - `subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `tax_inclusive: boolean`\n - `trial_period_days: number`\n - `cancellation_comment?: string`\n - `cancellation_feedback?: string`\n - `cancelled_at?: string`\n - `custom_field_responses?: { key: string; value: string; }[]`\n - `customer_business_name?: string`\n - `discount_cycles_remaining?: number`\n - `discount_id?: string`\n - `discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]`\n - `expires_at?: string`\n - `payment_method_id?: string`\n - `scheduled_change?: { id: string; addons: { addon_id: string; name: string; quantity: number; }[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }`\n - `tax_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst subscription = await client.subscriptions.retrieve('sub_Iuaq622bbmmfOGrVTqdXv');\n\nconsole.log(subscription);\n```",
|
|
612
|
+
response: "{ addons: object[]; billing: object; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: object[]; currency: string; customer: object; metadata: object; meter_credit_entitlement_cart: object[]; meters: object[]; 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' | 'cancelled' | 'failed' | 'expired'; 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; custom_field_responses?: object[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: object[]; expires_at?: string; payment_method_id?: string; scheduled_change?: object; tax_id?: string; trial_amount?: number; }",
|
|
613
|
+
markdown: "## retrieve\n\n`client.subscriptions.retrieve(subscription_id: string): { 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; 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; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_at?: string; payment_method_id?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; trial_amount?: number; }`\n\n**get** `/subscriptions/{subscription_id}`\n\n### Parameters\n\n- `subscription_id: string`\n\n### Returns\n\n- `{ 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; }; 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' | 'cancelled' | 'failed' | 'expired'; 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; 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; 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 Response struct representing subscription details\n\n - `addons: { addon_id: string; quantity: number; }[]`\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `brand_id: string`\n - `cancel_at_next_billing_date: boolean`\n - `created_at: string`\n - `credit_entitlement_cart: { credit_entitlement_id: string; credit_entitlement_name: string; credits_amount: string; overage_balance: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; 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?: 'Day' | 'Week' | 'Month' | 'Year'; }[]`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `meter_credit_entitlement_cart: { credit_entitlement_id: string; meter_id: string; meter_name: string; meter_units_per_credit: string; product_id: string; }[]`\n - `meters: { currency: string; free_threshold: number; measurement_unit: string; meter_id: string; name: string; description?: string; price_per_unit?: string; }[]`\n - `next_billing_date: string`\n - `on_demand: boolean`\n - `payment_frequency_count: number`\n - `payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `previous_billing_date: string`\n - `product_id: string`\n - `quantity: number`\n - `recurring_pre_tax_amount: number`\n - `status: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n - `subscription_id: string`\n - `subscription_period_count: number`\n - `subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `tax_inclusive: boolean`\n - `trial_period_days: number`\n - `cancellation_comment?: string`\n - `cancellation_feedback?: string`\n - `cancelled_at?: string`\n - `custom_field_responses?: { key: string; value: string; }[]`\n - `customer_business_name?: string`\n - `discount_cycles_remaining?: number`\n - `discount_id?: string`\n - `discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]`\n - `expires_at?: string`\n - `payment_method_id?: string`\n - `scheduled_change?: { id: string; addons: { addon_id: string; name: string; quantity: number; }[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }`\n - `tax_id?: string`\n - `trial_amount?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst subscription = await client.subscriptions.retrieve('sub_Iuaq622bbmmfOGrVTqdXv');\n\nconsole.log(subscription);\n```",
|
|
613
614
|
perLanguage: {
|
|
614
615
|
typescript: {
|
|
615
616
|
method: 'client.subscriptions.retrieve',
|
|
@@ -674,8 +675,8 @@ const EMBEDDED_METHODS = [
|
|
|
674
675
|
"subscription_period_interval?: 'Day' | 'Week' | 'Month' | 'Year';",
|
|
675
676
|
'tax_id?: string;',
|
|
676
677
|
],
|
|
677
|
-
response: "{ addons: object[]; billing: object; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: object[]; currency: string; customer: object; metadata: object; meter_credit_entitlement_cart: object[]; meters: object[]; 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' | 'cancelled' | 'failed' | 'expired'; 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; custom_field_responses?: object[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: object[]; expires_at?: string; payment_method_id?: string; scheduled_change?: object; tax_id?: string; }",
|
|
678
|
-
markdown: "## update\n\n`client.subscriptions.update(subscription_id: string, billing?: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, cancel_at_next_billing_date?: boolean, cancel_reason?: string, cancellation_comment?: string, cancellation_feedback?: string, credit_entitlement_cart?: { credit_entitlement_id: string; credits_amount?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_enabled?: boolean; overage_limit?: string; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }[], customer_business_name?: string, customer_name?: string, disable_on_demand?: { next_billing_date: string; }, metadata?: object, next_billing_date?: string, status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired', subscription_period_count?: number, subscription_period_interval?: 'Day' | 'Week' | 'Month' | 'Year', tax_id?: string): { 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; 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; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_at?: string; payment_method_id?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; }`\n\n**patch** `/subscriptions/{subscription_id}`\n\n### Parameters\n\n- `subscription_id: string`\n\n- `billing?: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `country: string`\n Two-letter ISO country code (ISO 3166-1 alpha-2)\n - `city?: string`\n City name\n - `state?: string`\n State or province name\n - `street?: string`\n Street address including house number and unit/apartment if applicable\n - `zipcode?: string`\n Postal code or ZIP code\n\n- `cancel_at_next_billing_date?: boolean`\n When set, the subscription will remain active until the end of billing period\n\n- `cancel_reason?: string`\n\n- `cancellation_comment?: string`\n Free-text cancellation comment (only valid when cancelling or scheduling cancellation).\n\n- `cancellation_feedback?: string`\n Customer-supplied churn reason (only valid when cancelling or scheduling cancellation).\n\n- `credit_entitlement_cart?: { credit_entitlement_id: string; credits_amount?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_enabled?: boolean; overage_limit?: string; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }[]`\n Update credit entitlement cart settings\n\n- `customer_business_name?: string`\n Optional business / legal name associated with the tax id. When provided\ntogether with a valid tax id for a B2B subscription, this name is rendered\non the invoice instead of the customer's personal name. Send `null` to\nexplicitly clear the business name.\n\n- `customer_name?: string`\n\n- `disable_on_demand?: { next_billing_date: string; }`\n - `next_billing_date: string`\n\n- `metadata?: object`\n Arbitrary key-value metadata. Values can be string, integer, number, or boolean.\n\n- `next_billing_date?: string`\n\n- `status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n\n- `subscription_period_count?: number`\n New number of `subscription_period_interval` units the subscription\nentitlement should span. Used together with `subscription_period_interval`\nto extend the subscription period. The resulting period must not be\nshorter than the current one (this endpoint only extends).\n\n- `subscription_period_interval?: 'Day' | 'Week' | 'Month' | 'Year'`\n New interval unit for the subscription period. When changing the period,\nthis may be supplied alongside `subscription_period_count`; if omitted the\nexisting interval is retained.\n\n- `tax_id?: string`\n\n### Returns\n\n- `{ 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; }; 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' | 'cancelled' | 'failed' | 'expired'; 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; 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; 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; }`\n Response struct representing subscription details\n\n - `addons: { addon_id: string; quantity: number; }[]`\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `brand_id: string`\n - `cancel_at_next_billing_date: boolean`\n - `created_at: string`\n - `credit_entitlement_cart: { credit_entitlement_id: string; credit_entitlement_name: string; credits_amount: string; overage_balance: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; 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?: 'Day' | 'Week' | 'Month' | 'Year'; }[]`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `meter_credit_entitlement_cart: { credit_entitlement_id: string; meter_id: string; meter_name: string; meter_units_per_credit: string; product_id: string; }[]`\n - `meters: { currency: string; free_threshold: number; measurement_unit: string; meter_id: string; name: string; description?: string; price_per_unit?: string; }[]`\n - `next_billing_date: string`\n - `on_demand: boolean`\n - `payment_frequency_count: number`\n - `payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `previous_billing_date: string`\n - `product_id: string`\n - `quantity: number`\n - `recurring_pre_tax_amount: number`\n - `status: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n - `subscription_id: string`\n - `subscription_period_count: number`\n - `subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `tax_inclusive: boolean`\n - `trial_period_days: number`\n - `cancellation_comment?: string`\n - `cancellation_feedback?: string`\n - `cancelled_at?: string`\n - `custom_field_responses?: { key: string; value: string; }[]`\n - `customer_business_name?: string`\n - `discount_cycles_remaining?: number`\n - `discount_id?: string`\n - `discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]`\n - `expires_at?: string`\n - `payment_method_id?: string`\n - `scheduled_change?: { id: string; addons: { addon_id: string; name: string; quantity: number; }[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }`\n - `tax_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst subscription = await client.subscriptions.update('sub_Iuaq622bbmmfOGrVTqdXv');\n\nconsole.log(subscription);\n```",
|
|
678
|
+
response: "{ addons: object[]; billing: object; brand_id: string; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: object[]; currency: string; customer: object; metadata: object; meter_credit_entitlement_cart: object[]; meters: object[]; 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' | 'cancelled' | 'failed' | 'expired'; 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; custom_field_responses?: object[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: object[]; expires_at?: string; payment_method_id?: string; scheduled_change?: object; tax_id?: string; trial_amount?: number; }",
|
|
679
|
+
markdown: "## update\n\n`client.subscriptions.update(subscription_id: string, billing?: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, cancel_at_next_billing_date?: boolean, cancel_reason?: string, cancellation_comment?: string, cancellation_feedback?: string, credit_entitlement_cart?: { credit_entitlement_id: string; credits_amount?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_enabled?: boolean; overage_limit?: string; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }[], customer_business_name?: string, customer_name?: string, disable_on_demand?: { next_billing_date: string; }, metadata?: object, next_billing_date?: string, status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired', subscription_period_count?: number, subscription_period_interval?: 'Day' | 'Week' | 'Month' | 'Year', tax_id?: string): { 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; 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; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_at?: string; payment_method_id?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; trial_amount?: number; }`\n\n**patch** `/subscriptions/{subscription_id}`\n\n### Parameters\n\n- `subscription_id: string`\n\n- `billing?: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `country: string`\n Two-letter ISO country code (ISO 3166-1 alpha-2)\n - `city?: string`\n City name\n - `state?: string`\n State or province name\n - `street?: string`\n Street address including house number and unit/apartment if applicable\n - `zipcode?: string`\n Postal code or ZIP code\n\n- `cancel_at_next_billing_date?: boolean`\n When set, the subscription will remain active until the end of billing period\n\n- `cancel_reason?: string`\n\n- `cancellation_comment?: string`\n Free-text cancellation comment (only valid when cancelling or scheduling cancellation).\n\n- `cancellation_feedback?: string`\n Customer-supplied churn reason (only valid when cancelling or scheduling cancellation).\n\n- `credit_entitlement_cart?: { credit_entitlement_id: string; credits_amount?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_enabled?: boolean; overage_limit?: string; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }[]`\n Update credit entitlement cart settings\n\n- `customer_business_name?: string`\n Optional business / legal name associated with the tax id. When provided\ntogether with a valid tax id for a B2B subscription, this name is rendered\non the invoice instead of the customer's personal name. Send `null` to\nexplicitly clear the business name.\n\n- `customer_name?: string`\n\n- `disable_on_demand?: { next_billing_date: string; }`\n - `next_billing_date: string`\n\n- `metadata?: object`\n Arbitrary key-value metadata. Values can be string, integer, number, or boolean.\n\n- `next_billing_date?: string`\n\n- `status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n\n- `subscription_period_count?: number`\n New number of `subscription_period_interval` units the subscription\nentitlement should span. Used together with `subscription_period_interval`\nto extend the subscription period. The resulting period must not be\nshorter than the current one (this endpoint only extends).\n\n- `subscription_period_interval?: 'Day' | 'Week' | 'Month' | 'Year'`\n New interval unit for the subscription period. When changing the period,\nthis may be supplied alongside `subscription_period_count`; if omitted the\nexisting interval is retained.\n\n- `tax_id?: string`\n\n### Returns\n\n- `{ 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; }; 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' | 'cancelled' | 'failed' | 'expired'; 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; 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; 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 Response struct representing subscription details\n\n - `addons: { addon_id: string; quantity: number; }[]`\n - `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n - `brand_id: string`\n - `cancel_at_next_billing_date: boolean`\n - `created_at: string`\n - `credit_entitlement_cart: { credit_entitlement_id: string; credit_entitlement_name: string; credits_amount: string; overage_balance: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; 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?: 'Day' | 'Week' | 'Month' | 'Year'; }[]`\n - `currency: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `meter_credit_entitlement_cart: { credit_entitlement_id: string; meter_id: string; meter_name: string; meter_units_per_credit: string; product_id: string; }[]`\n - `meters: { currency: string; free_threshold: number; measurement_unit: string; meter_id: string; name: string; description?: string; price_per_unit?: string; }[]`\n - `next_billing_date: string`\n - `on_demand: boolean`\n - `payment_frequency_count: number`\n - `payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `previous_billing_date: string`\n - `product_id: string`\n - `quantity: number`\n - `recurring_pre_tax_amount: number`\n - `status: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\n - `subscription_id: string`\n - `subscription_period_count: number`\n - `subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'`\n - `tax_inclusive: boolean`\n - `trial_period_days: number`\n - `cancellation_comment?: string`\n - `cancellation_feedback?: string`\n - `cancelled_at?: string`\n - `custom_field_responses?: { key: string; value: string; }[]`\n - `customer_business_name?: string`\n - `discount_cycles_remaining?: number`\n - `discount_id?: string`\n - `discounts?: { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; position: number; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; cycles_remaining?: number; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }[]`\n - `expires_at?: string`\n - `payment_method_id?: string`\n - `scheduled_change?: { id: string; addons: { addon_id: string; name: string; quantity: number; }[]; created_at: string; effective_at: string; product_id: string; quantity: number; product_description?: string; product_name?: string; }`\n - `tax_id?: string`\n - `trial_amount?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst subscription = await client.subscriptions.update('sub_Iuaq622bbmmfOGrVTqdXv');\n\nconsole.log(subscription);\n```",
|
|
679
680
|
perLanguage: {
|
|
680
681
|
typescript: {
|
|
681
682
|
method: 'client.subscriptions.update',
|
|
@@ -961,7 +962,7 @@ const EMBEDDED_METHODS = [
|
|
|
961
962
|
"on_payment_failure?: 'prevent_change' | 'apply_change';",
|
|
962
963
|
],
|
|
963
964
|
response: '{ immediate_charge: { effective_at: string; line_items: object | object | object[]; summary: object; }; new_plan: object; }',
|
|
964
|
-
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; }[], 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- `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; 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; 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; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_at?: string; payment_method_id?: string; scheduled_change?: scheduled_plan_change; tax_id?: string; }; }`\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'; 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; 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; }; 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' | 'cancelled' | 'failed' | 'expired'; 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; 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; 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; }`\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```",
|
|
965
|
+
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; }[], 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- `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; 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; 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; custom_field_responses?: custom_field_response[]; customer_business_name?: string; discount_cycles_remaining?: number; discount_id?: string; discounts?: discount_detail[]; expires_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'; 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; 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; }; 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' | 'cancelled' | 'failed' | 'expired'; 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; 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; 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```",
|
|
965
966
|
perLanguage: {
|
|
966
967
|
typescript: {
|
|
967
968
|
method: 'client.subscriptions.previewChangePlan',
|
|
@@ -2897,7 +2898,7 @@ const EMBEDDED_METHODS = [
|
|
|
2897
2898
|
'recurring?: boolean;',
|
|
2898
2899
|
],
|
|
2899
2900
|
response: "{ business_id: string; created_at: string; entitlements: object[]; is_recurring: boolean; metadata: object; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; currency?: string; description?: string; image?: string; name?: string; price?: number; price_detail?: object | object | object; pricing_mode?: 'by_currency' | 'by_country'; tax_inclusive?: boolean; }",
|
|
2900
|
-
markdown: "## list\n\n`client.products.list(archived?: boolean, brand_id?: string, page_number?: number, page_size?: number, recurring?: boolean): { business_id: string; created_at: string; entitlements: product_entitlement_summary[]; is_recurring: boolean; metadata: metadata; product_id: string; tax_category: tax_category; updated_at: string; currency?: currency; description?: string; image?: string; name?: string; price?: number; price_detail?: price; pricing_mode?: pricing_mode; tax_inclusive?: boolean; }`\n\n**get** `/products`\n\n### Parameters\n\n- `archived?: boolean`\n List archived products\n\n- `brand_id?: string`\n filter by Brand id\n\n- `page_number?: number`\n Page number default is 0\n\n- `page_size?: number`\n Page size default is 10 max is 100\n\n- `recurring?: boolean`\n Filter products by pricing type:\n- `true`: Show only recurring pricing products (e.g. subscriptions)\n- `false`: Show only one-time price products\n- `null` or absent: Show both types of products\n\n### Returns\n\n- `{ business_id: string; created_at: string; entitlements: { id: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; name: string; description?: string; }[]; is_recurring: boolean; metadata: object; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; currency?: string; description?: string; image?: string; name?: string; price?: number; price_detail?: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; pricing_mode?: 'by_currency' | 'by_country'; tax_inclusive?: boolean; }`\n\n - `business_id: string`\n - `created_at: string`\n - `entitlements: { id: string; integration_config: { feature_id: string; feature_type: feature_type; } | { permission: github_permission; target_id: string; } | { guild_id: string; role_id?: string; } | { chat_id: string; } | { figma_file_id: string; } | { framer_template_id: string; } | { notion_template_id: string; } | { digital_files: object; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; fulfillment_mode?: 'auto' | 'manual'; }; integration_type: string; name: string; description?: string; }[]`\n - `is_recurring: boolean`\n - `metadata: object`\n - `product_id: string`\n - `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n - `updated_at: string`\n - `currency?: string`\n - `description?: string`\n - `image?: string`\n - `name?: string`\n - `price?: number`\n - `price_detail?: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n - `pricing_mode?: 'by_currency' | 'by_country'`\n - `tax_inclusive?: boolean`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\n// Automatically fetches more pages as needed.\nfor await (const productListResponse of client.products.list()) {\n console.log(productListResponse);\n}\n```",
|
|
2901
|
+
markdown: "## list\n\n`client.products.list(archived?: boolean, brand_id?: string, page_number?: number, page_size?: number, recurring?: boolean): { business_id: string; created_at: string; entitlements: product_entitlement_summary[]; is_recurring: boolean; metadata: metadata; product_id: string; tax_category: tax_category; updated_at: string; currency?: currency; description?: string; image?: string; name?: string; price?: number; price_detail?: price; pricing_mode?: pricing_mode; tax_inclusive?: boolean; }`\n\n**get** `/products`\n\n### Parameters\n\n- `archived?: boolean`\n List archived products\n\n- `brand_id?: string`\n filter by Brand id\n\n- `page_number?: number`\n Page number default is 0\n\n- `page_size?: number`\n Page size default is 10 max is 100\n\n- `recurring?: boolean`\n Filter products by pricing type:\n- `true`: Show only recurring pricing products (e.g. subscriptions)\n- `false`: Show only one-time price products\n- `null` or absent: Show both types of products\n\n### Returns\n\n- `{ business_id: string; created_at: string; entitlements: { id: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; name: string; description?: string; }[]; is_recurring: boolean; metadata: object; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; currency?: string; description?: string; image?: string; name?: string; price?: number; price_detail?: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; pricing_mode?: 'by_currency' | 'by_country'; tax_inclusive?: boolean; }`\n\n - `business_id: string`\n - `created_at: string`\n - `entitlements: { id: string; integration_config: { feature_id: string; feature_type: feature_type; } | { permission: github_permission; target_id: string; } | { guild_id: string; role_id?: string; } | { chat_id: string; } | { figma_file_id: string; } | { framer_template_id: string; } | { notion_template_id: string; } | { digital_files: object; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; fulfillment_mode?: 'auto' | 'manual'; }; integration_type: string; name: string; description?: string; }[]`\n - `is_recurring: boolean`\n - `metadata: object`\n - `product_id: string`\n - `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n - `updated_at: string`\n - `currency?: string`\n - `description?: string`\n - `image?: string`\n - `name?: string`\n - `price?: number`\n - `price_detail?: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n - `pricing_mode?: 'by_currency' | 'by_country'`\n - `tax_inclusive?: boolean`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\n// Automatically fetches more pages as needed.\nfor await (const productListResponse of client.products.list()) {\n console.log(productListResponse);\n}\n```",
|
|
2901
2902
|
perLanguage: {
|
|
2902
2903
|
typescript: {
|
|
2903
2904
|
method: 'client.products.list',
|
|
@@ -2946,7 +2947,7 @@ const EMBEDDED_METHODS = [
|
|
|
2946
2947
|
qualified: 'client.products.create',
|
|
2947
2948
|
params: [
|
|
2948
2949
|
'name: string;',
|
|
2949
|
-
"price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; };",
|
|
2950
|
+
"price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; };",
|
|
2950
2951
|
"tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech';",
|
|
2951
2952
|
'addons?: string[];',
|
|
2952
2953
|
'brand_id?: string;',
|
|
@@ -2962,7 +2963,7 @@ const EMBEDDED_METHODS = [
|
|
|
2962
2963
|
"pricing_mode?: 'by_currency' | 'by_country';",
|
|
2963
2964
|
],
|
|
2964
2965
|
response: "{ brand_id: string; business_id: string; created_at: string; credit_entitlements: object[]; entitlements: object[]; is_recurring: boolean; license_key_enabled: boolean; metadata: object; price: object | object | object; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: object; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: object; name?: string; pricing_mode?: 'by_currency' | 'by_country'; product_collection_id?: string; }",
|
|
2965
|
-
markdown: "## create\n\n`client.products.create(name: string, price: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }, tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech', addons?: string[], brand_id?: string, credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: cbb_overage_behavior; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: cbb_proration_behavior; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[], description?: string, digital_product_delivery?: { external_url?: string; instructions?: string; }, entitlements?: { entitlement_id: string; }[], license_key_activation_message?: string, license_key_activations_limit?: number, license_key_duration?: { count: number; interval: time_interval; }, license_key_enabled?: boolean, metadata?: object, pricing_mode?: 'by_currency' | 'by_country'): { brand_id: string; business_id: string; created_at: string; credit_entitlements: credit_entitlement_mapping_response[]; entitlements: product_entitlement_summary[]; is_recurring: boolean; license_key_enabled: boolean; metadata: metadata; price: price; product_id: string; tax_category: tax_category; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: digital_product_delivery; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: license_key_duration; name?: string; pricing_mode?: pricing_mode; product_collection_id?: string; }`\n\n**post** `/products`\n\n### Parameters\n\n- `name: string`\n Name of the product\n\n- `price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n Price configuration for the product\n\n- `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n Tax category applied to this product\n\n- `addons?: string[]`\n Addons available for subscription product\n\n- `brand_id?: string`\n Brand id for the product, if not provided will default to primary brand\n\n- `credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: 'prorate' | 'no_prorate'; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[]`\n Optional credit entitlements to attach (max 5)\n\n- `description?: string`\n Optional description of the product\n\n- `digital_product_delivery?: { external_url?: string; instructions?: string; }`\n Choose how you would like you digital product delivered\n\ndeprecated: use entitlements instead\n - `external_url?: string`\n External URL to digital product\n - `instructions?: string`\n Instructions to download and use the digital product\n\n- `entitlements?: { entitlement_id: string; }[]`\n Optional entitlements to attach to this product (max 50)\n\n- `license_key_activation_message?: string`\n Optional message displayed during license key activation\n\ndeprecated: use entitlements instead. Ignored when a `license_key`\nentitlement is attached via the `entitlements` field.\n\n- `license_key_activations_limit?: number`\n The number of times the license key can be activated.\nMust be 0 or greater\n\ndeprecated: use entitlements instead. Ignored when a `license_key`\nentitlement is attached via the `entitlements` field.\n\n- `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n Duration configuration for the license key.\nSet to null if you don't want the license key to expire.\nFor subscriptions, the lifetime of the license key is tied to the subscription period\n\ndeprecated: use entitlements instead. Ignored when a `license_key`\nentitlement is attached via the `entitlements` field.\n - `count: number`\n - `interval: 'Day' | 'Week' | 'Month' | 'Year'`\n Unit of a duration count (e.g. license-key validity period).\n\n- `license_key_enabled?: boolean`\n When true, generates and sends a license key to your customer.\nDefaults to false\n\ndeprecated: use entitlements instead. If a `license_key` entitlement is\nalso attached via the `entitlements` field, the `license_key_*` config\nfields below are ignored — the attached entitlement's config is the\nsource of truth.\n\n- `metadata?: object`\n Additional metadata for the product\n\n- `pricing_mode?: 'by_currency' | 'by_country'`\n Pricing mode for localized pricing. When set, rules from\n/products/{id}/localized-prices apply at checkout. NULL means base-only\n(existing behavior).\n\n### Returns\n\n- `{ brand_id: string; business_id: string; created_at: string; credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: cbb_overage_behavior; overage_enabled: boolean; proration_behavior: cbb_proration_behavior; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; }[]; entitlements: { id: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; name: string; description?: string; }[]; is_recurring: boolean; license_key_enabled: boolean; metadata: object; price: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: { files: digital_product_delivery_file[]; external_url?: string; instructions?: string; }; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: { count: number; interval: time_interval; }; name?: string; pricing_mode?: 'by_currency' | 'by_country'; product_collection_id?: string; }`\n\n - `brand_id: string`\n - `business_id: string`\n - `created_at: string`\n - `credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled: boolean; proration_behavior: 'prorate' | 'no_prorate'; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; }[]`\n - `entitlements: { id: string; integration_config: { feature_id: string; feature_type: feature_type; } | { permission: github_permission; target_id: string; } | { guild_id: string; role_id?: string; } | { chat_id: string; } | { figma_file_id: string; } | { framer_template_id: string; } | { notion_template_id: string; } | { digital_files: object; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; fulfillment_mode?: 'auto' | 'manual'; }; integration_type: string; name: string; description?: string; }[]`\n - `is_recurring: boolean`\n - `license_key_enabled: boolean`\n - `metadata: object`\n - `price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n - `product_id: string`\n - `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n - `updated_at: string`\n - `addons?: string[]`\n - `description?: string`\n - `digital_product_delivery?: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }`\n - `image?: string`\n - `license_key_activation_message?: string`\n - `license_key_activations_limit?: number`\n - `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `name?: string`\n - `pricing_mode?: 'by_currency' | 'by_country'`\n - `product_collection_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst product = await client.products.create({\n name: 'name',\n price: {\n currency: 'AED',\n discount: 0,\n price: 0,\n purchasing_power_parity: true,\n type: 'one_time_price',\n},\n tax_category: 'digital_products',\n});\n\nconsole.log(product);\n```",
|
|
2966
|
+
markdown: "## create\n\n`client.products.create(name: string, price: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }, tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech', addons?: string[], brand_id?: string, credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: cbb_overage_behavior; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: cbb_proration_behavior; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[], description?: string, digital_product_delivery?: { external_url?: string; instructions?: string; }, entitlements?: { entitlement_id: string; }[], license_key_activation_message?: string, license_key_activations_limit?: number, license_key_duration?: { count: number; interval: time_interval; }, license_key_enabled?: boolean, metadata?: object, pricing_mode?: 'by_currency' | 'by_country'): { brand_id: string; business_id: string; created_at: string; credit_entitlements: credit_entitlement_mapping_response[]; entitlements: product_entitlement_summary[]; is_recurring: boolean; license_key_enabled: boolean; metadata: metadata; price: price; product_id: string; tax_category: tax_category; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: digital_product_delivery; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: license_key_duration; name?: string; pricing_mode?: pricing_mode; product_collection_id?: string; }`\n\n**post** `/products`\n\n### Parameters\n\n- `name: string`\n Name of the product\n\n- `price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n Price configuration for the product\n\n- `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n Tax category applied to this product\n\n- `addons?: string[]`\n Addons available for subscription product\n\n- `brand_id?: string`\n Brand id for the product, if not provided will default to primary brand\n\n- `credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: 'prorate' | 'no_prorate'; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[]`\n Optional credit entitlements to attach (max 5)\n\n- `description?: string`\n Optional description of the product\n\n- `digital_product_delivery?: { external_url?: string; instructions?: string; }`\n Choose how you would like you digital product delivered\n\ndeprecated: use entitlements instead\n - `external_url?: string`\n External URL to digital product\n - `instructions?: string`\n Instructions to download and use the digital product\n\n- `entitlements?: { entitlement_id: string; }[]`\n Optional entitlements to attach to this product (max 50)\n\n- `license_key_activation_message?: string`\n Optional message displayed during license key activation\n\ndeprecated: use entitlements instead. Ignored when a `license_key`\nentitlement is attached via the `entitlements` field.\n\n- `license_key_activations_limit?: number`\n The number of times the license key can be activated.\nMust be 0 or greater\n\ndeprecated: use entitlements instead. Ignored when a `license_key`\nentitlement is attached via the `entitlements` field.\n\n- `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n Duration configuration for the license key.\nSet to null if you don't want the license key to expire.\nFor subscriptions, the lifetime of the license key is tied to the subscription period\n\ndeprecated: use entitlements instead. Ignored when a `license_key`\nentitlement is attached via the `entitlements` field.\n - `count: number`\n - `interval: 'Day' | 'Week' | 'Month' | 'Year'`\n Unit of a duration count (e.g. license-key validity period).\n\n- `license_key_enabled?: boolean`\n When true, generates and sends a license key to your customer.\nDefaults to false\n\ndeprecated: use entitlements instead. If a `license_key` entitlement is\nalso attached via the `entitlements` field, the `license_key_*` config\nfields below are ignored — the attached entitlement's config is the\nsource of truth.\n\n- `metadata?: object`\n Additional metadata for the product\n\n- `pricing_mode?: 'by_currency' | 'by_country'`\n Pricing mode for localized pricing. When set, rules from\n/products/{id}/localized-prices apply at checkout. NULL means base-only\n(existing behavior).\n\n### Returns\n\n- `{ brand_id: string; business_id: string; created_at: string; credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: cbb_overage_behavior; overage_enabled: boolean; proration_behavior: cbb_proration_behavior; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; }[]; entitlements: { id: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; name: string; description?: string; }[]; is_recurring: boolean; license_key_enabled: boolean; metadata: object; price: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: { files: digital_product_delivery_file[]; external_url?: string; instructions?: string; }; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: { count: number; interval: time_interval; }; name?: string; pricing_mode?: 'by_currency' | 'by_country'; product_collection_id?: string; }`\n\n - `brand_id: string`\n - `business_id: string`\n - `created_at: string`\n - `credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled: boolean; proration_behavior: 'prorate' | 'no_prorate'; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; }[]`\n - `entitlements: { id: string; integration_config: { feature_id: string; feature_type: feature_type; } | { permission: github_permission; target_id: string; } | { guild_id: string; role_id?: string; } | { chat_id: string; } | { figma_file_id: string; } | { framer_template_id: string; } | { notion_template_id: string; } | { digital_files: object; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; fulfillment_mode?: 'auto' | 'manual'; }; integration_type: string; name: string; description?: string; }[]`\n - `is_recurring: boolean`\n - `license_key_enabled: boolean`\n - `metadata: object`\n - `price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n - `product_id: string`\n - `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n - `updated_at: string`\n - `addons?: string[]`\n - `description?: string`\n - `digital_product_delivery?: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }`\n - `image?: string`\n - `license_key_activation_message?: string`\n - `license_key_activations_limit?: number`\n - `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `name?: string`\n - `pricing_mode?: 'by_currency' | 'by_country'`\n - `product_collection_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst product = await client.products.create({\n name: 'name',\n price: {\n currency: 'AED',\n discount: 0,\n price: 0,\n purchasing_power_parity: true,\n type: 'one_time_price',\n},\n tax_category: 'digital_products',\n});\n\nconsole.log(product);\n```",
|
|
2966
2967
|
perLanguage: {
|
|
2967
2968
|
typescript: {
|
|
2968
2969
|
method: 'client.products.create',
|
|
@@ -3011,7 +3012,7 @@ const EMBEDDED_METHODS = [
|
|
|
3011
3012
|
qualified: 'client.products.retrieve',
|
|
3012
3013
|
params: ['id: string;'],
|
|
3013
3014
|
response: "{ brand_id: string; business_id: string; created_at: string; credit_entitlements: object[]; entitlements: object[]; is_recurring: boolean; license_key_enabled: boolean; metadata: object; price: object | object | object; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: object; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: object; name?: string; pricing_mode?: 'by_currency' | 'by_country'; product_collection_id?: string; }",
|
|
3014
|
-
markdown: "## retrieve\n\n`client.products.retrieve(id: string): { brand_id: string; business_id: string; created_at: string; credit_entitlements: credit_entitlement_mapping_response[]; entitlements: product_entitlement_summary[]; is_recurring: boolean; license_key_enabled: boolean; metadata: metadata; price: price; product_id: string; tax_category: tax_category; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: digital_product_delivery; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: license_key_duration; name?: string; pricing_mode?: pricing_mode; product_collection_id?: string; }`\n\n**get** `/products/{id}`\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ brand_id: string; business_id: string; created_at: string; credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: cbb_overage_behavior; overage_enabled: boolean; proration_behavior: cbb_proration_behavior; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; }[]; entitlements: { id: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; name: string; description?: string; }[]; is_recurring: boolean; license_key_enabled: boolean; metadata: object; price: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: { files: digital_product_delivery_file[]; external_url?: string; instructions?: string; }; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: { count: number; interval: time_interval; }; name?: string; pricing_mode?: 'by_currency' | 'by_country'; product_collection_id?: string; }`\n\n - `brand_id: string`\n - `business_id: string`\n - `created_at: string`\n - `credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled: boolean; proration_behavior: 'prorate' | 'no_prorate'; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; }[]`\n - `entitlements: { id: string; integration_config: { feature_id: string; feature_type: feature_type; } | { permission: github_permission; target_id: string; } | { guild_id: string; role_id?: string; } | { chat_id: string; } | { figma_file_id: string; } | { framer_template_id: string; } | { notion_template_id: string; } | { digital_files: object; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; fulfillment_mode?: 'auto' | 'manual'; }; integration_type: string; name: string; description?: string; }[]`\n - `is_recurring: boolean`\n - `license_key_enabled: boolean`\n - `metadata: object`\n - `price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n - `product_id: string`\n - `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n - `updated_at: string`\n - `addons?: string[]`\n - `description?: string`\n - `digital_product_delivery?: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }`\n - `image?: string`\n - `license_key_activation_message?: string`\n - `license_key_activations_limit?: number`\n - `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `name?: string`\n - `pricing_mode?: 'by_currency' | 'by_country'`\n - `product_collection_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst product = await client.products.retrieve('pdt_R8AWMPiV8RyJElcCKvAID');\n\nconsole.log(product);\n```",
|
|
3015
|
+
markdown: "## retrieve\n\n`client.products.retrieve(id: string): { brand_id: string; business_id: string; created_at: string; credit_entitlements: credit_entitlement_mapping_response[]; entitlements: product_entitlement_summary[]; is_recurring: boolean; license_key_enabled: boolean; metadata: metadata; price: price; product_id: string; tax_category: tax_category; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: digital_product_delivery; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: license_key_duration; name?: string; pricing_mode?: pricing_mode; product_collection_id?: string; }`\n\n**get** `/products/{id}`\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ brand_id: string; business_id: string; created_at: string; credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: cbb_overage_behavior; overage_enabled: boolean; proration_behavior: cbb_proration_behavior; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; }[]; entitlements: { id: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; name: string; description?: string; }[]; is_recurring: boolean; license_key_enabled: boolean; metadata: object; price: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; product_id: string; tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'; updated_at: string; addons?: string[]; description?: string; digital_product_delivery?: { files: digital_product_delivery_file[]; external_url?: string; instructions?: string; }; image?: string; license_key_activation_message?: string; license_key_activations_limit?: number; license_key_duration?: { count: number; interval: time_interval; }; name?: string; pricing_mode?: 'by_currency' | 'by_country'; product_collection_id?: string; }`\n\n - `brand_id: string`\n - `business_id: string`\n - `created_at: string`\n - `credit_entitlements: { id: string; credit_entitlement_id: string; credit_entitlement_name: string; credit_entitlement_unit: string; credits_amount: string; overage_behavior: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled: boolean; proration_behavior: 'prorate' | 'no_prorate'; rollover_enabled: boolean; trial_credits_expire_after_trial: boolean; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_limit?: string; price_per_unit?: string; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; }[]`\n - `entitlements: { id: string; integration_config: { feature_id: string; feature_type: feature_type; } | { permission: github_permission; target_id: string; } | { guild_id: string; role_id?: string; } | { chat_id: string; } | { figma_file_id: string; } | { framer_template_id: string; } | { notion_template_id: string; } | { digital_files: object; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; fulfillment_mode?: 'auto' | 'manual'; }; integration_type: string; name: string; description?: string; }[]`\n - `is_recurring: boolean`\n - `license_key_enabled: boolean`\n - `metadata: object`\n - `price: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n - `product_id: string`\n - `tax_category: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n - `updated_at: string`\n - `addons?: string[]`\n - `description?: string`\n - `digital_product_delivery?: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }`\n - `image?: string`\n - `license_key_activation_message?: string`\n - `license_key_activations_limit?: number`\n - `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `name?: string`\n - `pricing_mode?: 'by_currency' | 'by_country'`\n - `product_collection_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst product = await client.products.retrieve('pdt_R8AWMPiV8RyJElcCKvAID');\n\nconsole.log(product);\n```",
|
|
3015
3016
|
perLanguage: {
|
|
3016
3017
|
typescript: {
|
|
3017
3018
|
method: 'client.products.retrieve',
|
|
@@ -3073,11 +3074,11 @@ const EMBEDDED_METHODS = [
|
|
|
3073
3074
|
'license_key_enabled?: boolean;',
|
|
3074
3075
|
'metadata?: object;',
|
|
3075
3076
|
'name?: string;',
|
|
3076
|
-
"price?: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; };",
|
|
3077
|
+
"price?: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; };",
|
|
3077
3078
|
"pricing_mode?: 'by_currency' | 'by_country';",
|
|
3078
3079
|
"tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech';",
|
|
3079
3080
|
],
|
|
3080
|
-
markdown: "## update\n\n`client.products.update(id: string, addons?: string[], brand_id?: string, credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: cbb_overage_behavior; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: cbb_proration_behavior; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[], description?: string, digital_product_delivery?: { external_url?: string; files?: string[]; instructions?: string; }, entitlements?: { entitlement_id: string; }[], image_id?: string, license_key_activation_message?: string, license_key_activations_limit?: number, license_key_duration?: { count: number; interval: time_interval; }, license_key_enabled?: boolean, metadata?: object, name?: string, price?: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }, pricing_mode?: 'by_currency' | 'by_country', tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'): void`\n\n**patch** `/products/{id}`\n\n### Parameters\n\n- `id: string`\n\n- `addons?: string[]`\n Available Addons for subscription products\n\n- `brand_id?: string`\n\n- `credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: 'prorate' | 'no_prorate'; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[]`\n Credit entitlements to update (replaces all existing when present)\nSend empty array to remove all, omit field to leave unchanged\n\n- `description?: string`\n Description of the product, optional and must be at most 1000 characters.\n\n- `digital_product_delivery?: { external_url?: string; files?: string[]; instructions?: string; }`\n Choose how you would like you digital product delivered\n\ndeprecated: use entitlements instead\n - `external_url?: string`\n External URL to digital product\n - `files?: string[]`\n Uploaded files ids of digital product\n - `instructions?: string`\n Instructions to download and use the digital product\n\n- `entitlements?: { entitlement_id: string; }[]`\n Entitlements to attach (replaces all existing when present)\nSend empty array to remove all, omit field to leave unchanged\n\n- `image_id?: string`\n Product image id after its uploaded to S3\n\n- `license_key_activation_message?: string`\n Message sent to the customer upon license key activation.\n\nOnly applicable if `license_key_enabled` is `true`. This message contains instructions for\nactivating the license key.\n\ndeprecated: use entitlements instead\n\n- `license_key_activations_limit?: number`\n Limit for the number of activations for the license key.\n\nOnly applicable if `license_key_enabled` is `true`. Represents the maximum number of times\nthe license key can be activated.\n\ndeprecated: use entitlements instead\n\n- `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n Duration of the license key if enabled.\n\nOnly applicable if `license_key_enabled` is `true`. Represents the duration in days for which\nthe license key is valid.\n\ndeprecated: use entitlements instead\n - `count: number`\n - `interval: 'Day' | 'Week' | 'Month' | 'Year'`\n Unit of a duration count (e.g. license-key validity period).\n\n- `license_key_enabled?: boolean`\n Whether the product requires a license key.\n\nIf `true`, additional fields related to license key (duration, activations limit, activation message)\nbecome applicable.\n\ndeprecated: use entitlements instead\n\n- `metadata?: object`\n Additional metadata for the product\n\n- `name?: string`\n Name of the product, optional and must be at most 100 characters.\n\n- `price?: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n Price details of the product.\n\n- `pricing_mode?: 'by_currency' | 'by_country'`\n Update the pricing mode. Omit to leave unchanged; set to null to clear\n(which archives all active localized rules for this product). Changing\nto a different non-null mode also archives any rules whose mode doesn't\nmatch the new mode.\n\n- `tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n Tax category of the product.\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.products.update('pdt_R8AWMPiV8RyJElcCKvAID')\n```",
|
|
3081
|
+
markdown: "## update\n\n`client.products.update(id: string, addons?: string[], brand_id?: string, credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: currency; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: cbb_overage_behavior; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: cbb_proration_behavior; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: time_interval; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[], description?: string, digital_product_delivery?: { external_url?: string; files?: string[]; instructions?: string; }, entitlements?: { entitlement_id: string; }[], image_id?: string, license_key_activation_message?: string, license_key_activations_limit?: number, license_key_duration?: { count: number; interval: time_interval; }, license_key_enabled?: boolean, metadata?: object, name?: string, price?: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }, pricing_mode?: 'by_currency' | 'by_country', tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'): void`\n\n**patch** `/products/{id}`\n\n### Parameters\n\n- `id: string`\n\n- `addons?: string[]`\n Available Addons for subscription products\n\n- `brand_id?: string`\n\n- `credit_entitlements?: { credit_entitlement_id: string; credits_amount: string; currency?: string; expires_after_days?: number; low_balance_threshold_percent?: number; max_rollover_count?: number; overage_behavior?: 'forgive_at_reset' | 'invoice_at_billing' | 'carry_deficit' | 'carry_deficit_auto_repay'; overage_enabled?: boolean; overage_limit?: string; price_per_unit?: string; proration_behavior?: 'prorate' | 'no_prorate'; rollover_enabled?: boolean; rollover_percentage?: number; rollover_timeframe_count?: number; rollover_timeframe_interval?: 'Day' | 'Week' | 'Month' | 'Year'; trial_credits?: string; trial_credits_expire_after_trial?: boolean; }[]`\n Credit entitlements to update (replaces all existing when present)\nSend empty array to remove all, omit field to leave unchanged\n\n- `description?: string`\n Description of the product, optional and must be at most 1000 characters.\n\n- `digital_product_delivery?: { external_url?: string; files?: string[]; instructions?: string; }`\n Choose how you would like you digital product delivered\n\ndeprecated: use entitlements instead\n - `external_url?: string`\n External URL to digital product\n - `files?: string[]`\n Uploaded files ids of digital product\n - `instructions?: string`\n Instructions to download and use the digital product\n\n- `entitlements?: { entitlement_id: string; }[]`\n Entitlements to attach (replaces all existing when present)\nSend empty array to remove all, omit field to leave unchanged\n\n- `image_id?: string`\n Product image id after its uploaded to S3\n\n- `license_key_activation_message?: string`\n Message sent to the customer upon license key activation.\n\nOnly applicable if `license_key_enabled` is `true`. This message contains instructions for\nactivating the license key.\n\ndeprecated: use entitlements instead\n\n- `license_key_activations_limit?: number`\n Limit for the number of activations for the license key.\n\nOnly applicable if `license_key_enabled` is `true`. Represents the maximum number of times\nthe license key can be activated.\n\ndeprecated: use entitlements instead\n\n- `license_key_duration?: { count: number; interval: 'Day' | 'Week' | 'Month' | 'Year'; }`\n Duration of the license key if enabled.\n\nOnly applicable if `license_key_enabled` is `true`. Represents the duration in days for which\nthe license key is valid.\n\ndeprecated: use entitlements instead\n - `count: number`\n - `interval: 'Day' | 'Week' | 'Month' | 'Year'`\n Unit of a duration count (e.g. license-key validity period).\n\n- `license_key_enabled?: boolean`\n Whether the product requires a license key.\n\nIf `true`, additional fields related to license key (duration, activations limit, activation message)\nbecome applicable.\n\ndeprecated: use entitlements instead\n\n- `metadata?: object`\n Additional metadata for the product\n\n- `name?: string`\n Name of the product, optional and must be at most 100 characters.\n\n- `price?: { currency: string; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: string; discount: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: string; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: 'Day' | 'Week' | 'Month' | 'Year'; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: 'Day' | 'Week' | 'Month' | 'Year'; type: 'usage_based_price'; meters?: { meter_id: string; credit_entitlement_id?: string; description?: string; free_threshold?: number; measurement_unit?: string; meter_units_per_credit?: string; name?: string; price_per_unit?: string; }[]; tax_inclusive?: boolean; }`\n Price details of the product.\n\n- `pricing_mode?: 'by_currency' | 'by_country'`\n Update the pricing mode. Omit to leave unchanged; set to null to clear\n(which archives all active localized rules for this product). Changing\nto a different non-null mode also archives any rules whose mode doesn't\nmatch the new mode.\n\n- `tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'`\n Tax category of the product.\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.products.update('pdt_R8AWMPiV8RyJElcCKvAID')\n```",
|
|
3081
3082
|
perLanguage: {
|
|
3082
3083
|
typescript: {
|
|
3083
3084
|
method: 'client.products.update',
|
|
@@ -3711,13 +3712,13 @@ const EMBEDDED_METHODS = [
|
|
|
3711
3712
|
params: [
|
|
3712
3713
|
'active?: boolean;',
|
|
3713
3714
|
'code?: string;',
|
|
3714
|
-
"discount_type?: 'percentage';",
|
|
3715
|
+
"discount_type?: 'flat' | 'percentage';",
|
|
3715
3716
|
'page_number?: number;',
|
|
3716
3717
|
'page_size?: number;',
|
|
3717
3718
|
'product_id?: string;',
|
|
3718
3719
|
],
|
|
3719
|
-
response: "{ amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3720
|
-
markdown: "## list\n\n`client.discounts.list(active?: boolean, code?: string, discount_type?: 'percentage', page_number?: number, page_size?: number, product_id?: string): { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**get** `/discounts`\n\nGET /discounts\n\n### Parameters\n\n- `active?: boolean`\n Filter by active status
|
|
3720
|
+
response: "{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3721
|
+
markdown: "## list\n\n`client.discounts.list(active?: boolean, code?: string, discount_type?: 'flat' | 'percentage', page_number?: number, page_size?: number, product_id?: string): { amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; currency_options?: object[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**get** `/discounts`\n\nGET /discounts\n\n### Parameters\n\n- `active?: boolean`\n Filter by active status. `true` = currently redeemable (started, not\nexpired, not usage-exhausted). `false` = not currently redeemable\n(expired, usage-exhausted, or pending a future `starts_at`).\n\n- `code?: string`\n Filter by discount code (partial match, case-insensitive)\n\n- `discount_type?: 'flat' | 'percentage'`\n Filter by discount type\n\n- `page_number?: number`\n Page number (default = 0).\n\n- `page_size?: number`\n Page size (default = 10, max = 100).\n\n- `product_id?: string`\n Filter by product restriction (only discounts that apply to this product)\n\n### Returns\n\n- `{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n - `amount: number`\n - `business_id: string`\n - `code: string`\n - `created_at: string`\n - `customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'`\n - `discount_id: string`\n - `metadata: object`\n - `preserve_on_plan_change: boolean`\n - `restricted_to: string[]`\n - `times_used: number`\n - `type: 'flat' | 'percentage'`\n - `currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]`\n - `expires_at?: string`\n - `name?: string`\n - `per_customer_usage_limit?: number`\n - `starts_at?: string`\n - `subscription_cycles?: number`\n - `usage_limit?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\n// Automatically fetches more pages as needed.\nfor await (const discount of client.discounts.list()) {\n console.log(discount);\n}\n```",
|
|
3721
3722
|
perLanguage: {
|
|
3722
3723
|
typescript: {
|
|
3723
3724
|
method: 'client.discounts.list',
|
|
@@ -3748,7 +3749,7 @@ const EMBEDDED_METHODS = [
|
|
|
3748
3749
|
},
|
|
3749
3750
|
php: {
|
|
3750
3751
|
method: 'discounts->list',
|
|
3751
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$page = $client->discounts->list(\n active: true,\n code: 'code',\n discountType: DiscountType::
|
|
3752
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$page = $client->discounts->list(\n active: true,\n code: 'code',\n discountType: DiscountType::FLAT,\n pageNumber: 0,\n pageSize: 0,\n productID: 'product_id',\n);\n\nvar_dump($page);",
|
|
3752
3753
|
},
|
|
3753
3754
|
csharp: {
|
|
3754
3755
|
method: 'Discounts.List',
|
|
@@ -3766,53 +3767,57 @@ const EMBEDDED_METHODS = [
|
|
|
3766
3767
|
qualified: 'client.discounts.create',
|
|
3767
3768
|
params: [
|
|
3768
3769
|
'amount: number;',
|
|
3769
|
-
"type: 'percentage';",
|
|
3770
|
+
"type: 'flat' | 'percentage';",
|
|
3770
3771
|
'code?: string;',
|
|
3772
|
+
'currency_options?: { currency: string; is_default?: boolean; max_amount_possible?: number; minimum_subtotal?: number; }[];',
|
|
3773
|
+
"customer_eligibility?: 'any' | 'first_time' | 'existing' | 'specific';",
|
|
3771
3774
|
'expires_at?: string;',
|
|
3772
3775
|
'metadata?: object;',
|
|
3773
3776
|
'name?: string;',
|
|
3777
|
+
'per_customer_usage_limit?: number;',
|
|
3774
3778
|
'preserve_on_plan_change?: boolean;',
|
|
3775
3779
|
'restricted_to?: string[];',
|
|
3780
|
+
'starts_at?: string;',
|
|
3776
3781
|
'subscription_cycles?: number;',
|
|
3777
3782
|
'usage_limit?: number;',
|
|
3778
3783
|
],
|
|
3779
|
-
response: "{ amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3780
|
-
markdown: "## create\n\n`client.discounts.create(amount: number, type: 'percentage', code?: string, expires_at?: string, metadata?: object, name?: string, preserve_on_plan_change?: boolean, restricted_to?: string[], subscription_cycles?: number, usage_limit?: number): { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**post** `/discounts`\n\nPOST /discounts\nIf `code` is omitted or empty, a random 16-char uppercase code is generated.\n\n### Parameters\n\n- `amount: number`\n The discount amount in **basis points** (e.g. `540` means `5.4%`, `10000` means `100%`).\n\nMust be at least 1.\n\n- `type: 'percentage'`\n The discount type
|
|
3784
|
+
response: "{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3785
|
+
markdown: "## create\n\n`client.discounts.create(amount: number, type: 'flat' | 'percentage', code?: string, currency_options?: { currency: string; is_default?: boolean; max_amount_possible?: number; minimum_subtotal?: number; }[], customer_eligibility?: 'any' | 'first_time' | 'existing' | 'specific', expires_at?: string, metadata?: object, name?: string, per_customer_usage_limit?: number, preserve_on_plan_change?: boolean, restricted_to?: string[], starts_at?: string, subscription_cycles?: number, usage_limit?: number): { amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; currency_options?: object[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**post** `/discounts`\n\nPOST /discounts\nIf `code` is omitted or empty, a random 16-char uppercase code is generated.\n\n### Parameters\n\n- `amount: number`\n The discount amount in **basis points** (e.g. `540` means `5.4%`, `10000` means `100%`).\n\nMust be at least 1.\n\n- `type: 'flat' | 'percentage'`\n The discount type: `percentage` or `flat` (`flat_per_unit` stays blocked).\n\n- `code?: string`\n Optionally supply a code (will be uppercased).\n- Must be at least 3 characters if provided.\n- If omitted, a random 16-character code is generated.\n\n- `currency_options?: { currency: string; is_default?: boolean; max_amount_possible?: number; minimum_subtotal?: number; }[]`\n Per-currency options (flat deduction / percentage cap + minimum subtotal).\nRequired for `flat` codes (must include a resolvable default); optional\nper-currency caps for `percentage` codes. Per-row invariants are checked\nin `normalize_currency_options`, not via `#[validate(nested)]`.\n\n- `customer_eligibility?: 'any' | 'first_time' | 'existing' | 'specific'`\n Who may redeem this discount code. Defaults to `any` (unrestricted).\n`specific` starts with zero attached customers (fails closed) until\ncustomers are attached via `POST /discounts/{id}/customers`.\n\n- `expires_at?: string`\n When the discount expires, if ever.\n\n- `metadata?: object`\n Additional metadata for the discount\n\n- `name?: string`\n\n- `per_customer_usage_limit?: number`\n Maximum number of times a single customer may redeem this discount.\nMust be `<= usage_limit` when both are set.\n\n- `preserve_on_plan_change?: boolean`\n Whether this discount should be preserved when a subscription changes plans.\nDefault: false (discount is removed on plan change)\n\n- `restricted_to?: string[]`\n List of product IDs to restrict usage (if any).\n\n- `starts_at?: string`\n When the discount becomes active, if scheduled for the future.\nNULL = active immediately. Must be strictly before `expires_at` when both are set.\n\n- `subscription_cycles?: number`\n Number of subscription billing cycles this discount is valid for.\nIf not provided, the discount will be applied indefinitely to\nall recurring payments related to the subscription.\n\n- `usage_limit?: number`\n How many times this discount can be used (if any).\nMust be >= 1 if provided.\n\n### Returns\n\n- `{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n - `amount: number`\n - `business_id: string`\n - `code: string`\n - `created_at: string`\n - `customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'`\n - `discount_id: string`\n - `metadata: object`\n - `preserve_on_plan_change: boolean`\n - `restricted_to: string[]`\n - `times_used: number`\n - `type: 'flat' | 'percentage'`\n - `currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]`\n - `expires_at?: string`\n - `name?: string`\n - `per_customer_usage_limit?: number`\n - `starts_at?: string`\n - `subscription_cycles?: number`\n - `usage_limit?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst discount = await client.discounts.create({ amount: 0, type: 'flat' });\n\nconsole.log(discount);\n```",
|
|
3781
3786
|
perLanguage: {
|
|
3782
3787
|
typescript: {
|
|
3783
3788
|
method: 'client.discounts.create',
|
|
3784
|
-
example: "import DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted\n});\n\nconst discount = await client.discounts.create({ amount: 0, type: '
|
|
3789
|
+
example: "import DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted\n});\n\nconst discount = await client.discounts.create({ amount: 0, type: 'flat' });\n\nconsole.log(discount.business_id);",
|
|
3785
3790
|
},
|
|
3786
3791
|
http: {
|
|
3787
|
-
example: 'curl https://live.dodopayments.com/discounts \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "amount": 0,\n "type": "
|
|
3792
|
+
example: 'curl https://live.dodopayments.com/discounts \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "amount": 0,\n "type": "flat"\n }\'',
|
|
3788
3793
|
},
|
|
3789
3794
|
python: {
|
|
3790
3795
|
method: 'discounts.create',
|
|
3791
|
-
example: 'import os\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments(\n bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted\n)\ndiscount = client.discounts.create(\n amount=0,\n type="
|
|
3796
|
+
example: 'import os\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments(\n bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted\n)\ndiscount = client.discounts.create(\n amount=0,\n type="flat",\n)\nprint(discount.business_id)',
|
|
3792
3797
|
},
|
|
3793
3798
|
java: {
|
|
3794
3799
|
method: 'discounts().create',
|
|
3795
|
-
example: 'package com.dodopayments.api.example;\n\nimport com.dodopayments.api.client.DodoPaymentsClient;\nimport com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;\nimport com.dodopayments.api.models.discounts.Discount;\nimport com.dodopayments.api.models.discounts.DiscountCreateParams;\nimport com.dodopayments.api.models.discounts.DiscountType;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n DiscountCreateParams params = DiscountCreateParams.builder()\n .amount(0)\n .type(DiscountType.
|
|
3800
|
+
example: 'package com.dodopayments.api.example;\n\nimport com.dodopayments.api.client.DodoPaymentsClient;\nimport com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;\nimport com.dodopayments.api.models.discounts.Discount;\nimport com.dodopayments.api.models.discounts.DiscountCreateParams;\nimport com.dodopayments.api.models.discounts.DiscountType;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n DiscountCreateParams params = DiscountCreateParams.builder()\n .amount(0)\n .type(DiscountType.FLAT)\n .build();\n Discount discount = client.discounts().create(params);\n }\n}',
|
|
3796
3801
|
},
|
|
3797
3802
|
kotlin: {
|
|
3798
3803
|
method: 'discounts().create',
|
|
3799
|
-
example: 'package com.dodopayments.api.example\n\nimport com.dodopayments.api.client.DodoPaymentsClient\nimport com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient\nimport com.dodopayments.api.models.discounts.Discount\nimport com.dodopayments.api.models.discounts.DiscountCreateParams\nimport com.dodopayments.api.models.discounts.DiscountType\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: DiscountCreateParams = DiscountCreateParams.builder()\n .amount(0)\n .type(DiscountType.
|
|
3804
|
+
example: 'package com.dodopayments.api.example\n\nimport com.dodopayments.api.client.DodoPaymentsClient\nimport com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient\nimport com.dodopayments.api.models.discounts.Discount\nimport com.dodopayments.api.models.discounts.DiscountCreateParams\nimport com.dodopayments.api.models.discounts.DiscountType\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: DiscountCreateParams = DiscountCreateParams.builder()\n .amount(0)\n .type(DiscountType.FLAT)\n .build()\n val discount: Discount = client.discounts().create(params)\n}',
|
|
3800
3805
|
},
|
|
3801
3806
|
go: {
|
|
3802
3807
|
method: 'client.Discounts.New',
|
|
3803
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/dodopayments/dodopayments-go"\n\t"github.com/dodopayments/dodopayments-go/option"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken("My Bearer Token"),\n\t)\n\tdiscount, err := client.Discounts.New(context.TODO(), dodopayments.DiscountNewParams{\n\t\tAmount: dodopayments.F(int64(0)),\n\t\tType: dodopayments.F(dodopayments.
|
|
3808
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/dodopayments/dodopayments-go"\n\t"github.com/dodopayments/dodopayments-go/option"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken("My Bearer Token"),\n\t)\n\tdiscount, err := client.Discounts.New(context.TODO(), dodopayments.DiscountNewParams{\n\t\tAmount: dodopayments.F(int64(0)),\n\t\tType: dodopayments.F(dodopayments.DiscountTypeFlat),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", discount.BusinessID)\n}\n',
|
|
3804
3809
|
},
|
|
3805
3810
|
ruby: {
|
|
3806
3811
|
method: 'discounts.create',
|
|
3807
|
-
example: 'require "dodopayments"\n\ndodo_payments = Dodopayments::Client.new(\n bearer_token: "My Bearer Token",\n environment: "test_mode" # defaults to "live_mode"\n)\n\ndiscount = dodo_payments.discounts.create(amount: 0, type: :
|
|
3812
|
+
example: 'require "dodopayments"\n\ndodo_payments = Dodopayments::Client.new(\n bearer_token: "My Bearer Token",\n environment: "test_mode" # defaults to "live_mode"\n)\n\ndiscount = dodo_payments.discounts.create(amount: 0, type: :flat)\n\nputs(discount)',
|
|
3808
3813
|
},
|
|
3809
3814
|
php: {
|
|
3810
3815
|
method: 'discounts->create',
|
|
3811
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$discount = $client->discounts->create(\n amount: 0,\n type: DiscountType::
|
|
3816
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$discount = $client->discounts->create(\n amount: 0,\n type: DiscountType::FLAT,\n code: 'code',\n currencyOptions: [\n [\n 'currency' => Currency::AED,\n 'isDefault' => true,\n 'maxAmountPossible' => 0,\n 'minimumSubtotal' => 0,\n ],\n ],\n customerEligibility: 'any',\n expiresAt: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n metadata: ['foo' => 'string'],\n name: 'name',\n perCustomerUsageLimit: 0,\n preserveOnPlanChange: true,\n restrictedTo: ['string'],\n startsAt: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n subscriptionCycles: 0,\n usageLimit: 0,\n);\n\nvar_dump($discount);",
|
|
3812
3817
|
},
|
|
3813
3818
|
csharp: {
|
|
3814
3819
|
method: 'Discounts.Create',
|
|
3815
|
-
example: 'DiscountCreateParams parameters = new()\n{\n Amount = 0,\n Type = DiscountType.
|
|
3820
|
+
example: 'DiscountCreateParams parameters = new()\n{\n Amount = 0,\n Type = DiscountType.Flat,\n};\n\nvar discount = await client.Discounts.Create(parameters);\n\nConsole.WriteLine(discount);',
|
|
3816
3821
|
},
|
|
3817
3822
|
},
|
|
3818
3823
|
},
|
|
@@ -3825,8 +3830,8 @@ const EMBEDDED_METHODS = [
|
|
|
3825
3830
|
stainlessPath: '(resource) discounts > (method) retrieve',
|
|
3826
3831
|
qualified: 'client.discounts.retrieve',
|
|
3827
3832
|
params: ['discount_id: string;'],
|
|
3828
|
-
response: "{ amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3829
|
-
markdown: "## retrieve\n\n`client.discounts.retrieve(discount_id: string): { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**get** `/discounts/{discount_id}`\n\nGET /discounts/{discount_id}\n\n### Parameters\n\n- `discount_id: string`\n\n### Returns\n\n- `{ amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n - `amount: number`\n - `business_id: string`\n - `code: string`\n - `created_at: string`\n - `discount_id: string`\n - `metadata: object`\n - `preserve_on_plan_change: boolean`\n - `restricted_to: string[]`\n - `times_used: number`\n - `type: 'percentage'`\n - `expires_at?: string`\n - `name?: string`\n - `subscription_cycles?: number`\n - `usage_limit?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst discount = await client.discounts.retrieve('dsc_qxxEmg5PuM1uNTE0LgkP9');\n\nconsole.log(discount);\n```",
|
|
3833
|
+
response: "{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3834
|
+
markdown: "## retrieve\n\n`client.discounts.retrieve(discount_id: string): { amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; currency_options?: object[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**get** `/discounts/{discount_id}`\n\nGET /discounts/{discount_id}\n\n### Parameters\n\n- `discount_id: string`\n\n### Returns\n\n- `{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n - `amount: number`\n - `business_id: string`\n - `code: string`\n - `created_at: string`\n - `customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'`\n - `discount_id: string`\n - `metadata: object`\n - `preserve_on_plan_change: boolean`\n - `restricted_to: string[]`\n - `times_used: number`\n - `type: 'flat' | 'percentage'`\n - `currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]`\n - `expires_at?: string`\n - `name?: string`\n - `per_customer_usage_limit?: number`\n - `starts_at?: string`\n - `subscription_cycles?: number`\n - `usage_limit?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst discount = await client.discounts.retrieve('dsc_qxxEmg5PuM1uNTE0LgkP9');\n\nconsole.log(discount);\n```",
|
|
3830
3835
|
perLanguage: {
|
|
3831
3836
|
typescript: {
|
|
3832
3837
|
method: 'client.discounts.retrieve',
|
|
@@ -3925,17 +3930,21 @@ const EMBEDDED_METHODS = [
|
|
|
3925
3930
|
'discount_id: string;',
|
|
3926
3931
|
'amount?: number;',
|
|
3927
3932
|
'code?: string;',
|
|
3933
|
+
'currency_options?: { currency: string; is_default?: boolean; max_amount_possible?: number; minimum_subtotal?: number; }[];',
|
|
3934
|
+
"customer_eligibility?: 'any' | 'first_time' | 'existing' | 'specific';",
|
|
3928
3935
|
'expires_at?: string;',
|
|
3929
3936
|
'metadata?: object;',
|
|
3930
3937
|
'name?: string;',
|
|
3938
|
+
'per_customer_usage_limit?: number;',
|
|
3931
3939
|
'preserve_on_plan_change?: boolean;',
|
|
3932
3940
|
'restricted_to?: string[];',
|
|
3941
|
+
'starts_at?: string;',
|
|
3933
3942
|
'subscription_cycles?: number;',
|
|
3934
|
-
"type?: 'percentage';",
|
|
3943
|
+
"type?: 'flat' | 'percentage';",
|
|
3935
3944
|
'usage_limit?: number;',
|
|
3936
3945
|
],
|
|
3937
|
-
response: "{ amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3938
|
-
markdown: "## update\n\n`client.discounts.update(discount_id: string, amount?: number, code?: string, expires_at?: string, metadata?: object, name?: string, preserve_on_plan_change?: boolean, restricted_to?: string[], subscription_cycles?: number, type?: 'percentage', usage_limit?: number): { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**patch** `/discounts/{discount_id}`\n\nPATCH /discounts/{discount_id}\n\n### Parameters\n\n- `discount_id: string`\n\n- `amount?: number`\n If present, update the discount amount in **basis points** (e.g., `540` = `5.4%`, `10000` = `100%`).\n\nMust be at least 1 if provided.\n\n- `code?: string`\n If present, update the discount code (uppercase).\n\n- `expires_at?: string`\n\n- `metadata?: object`\n Additional metadata for the discount\n\n- `name?: string`\n\n- `preserve_on_plan_change?: boolean`\n Whether this discount should be preserved when a subscription changes plans.\nIf not provided, the existing value is kept.\n\n- `restricted_to?: string[]`\n If present, replaces all restricted product IDs with this new set.\nTo remove all restrictions, send empty array\n\n- `subscription_cycles?: number`\n Number of subscription billing cycles this discount is valid for.\nIf not provided, the discount will be applied indefinitely to\nall recurring payments related to the subscription.\n\n- `type?: 'percentage'`\n If present, update the discount type
|
|
3946
|
+
response: "{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3947
|
+
markdown: "## update\n\n`client.discounts.update(discount_id: string, amount?: number, code?: string, currency_options?: { currency: string; is_default?: boolean; max_amount_possible?: number; minimum_subtotal?: number; }[], customer_eligibility?: 'any' | 'first_time' | 'existing' | 'specific', expires_at?: string, metadata?: object, name?: string, per_customer_usage_limit?: number, preserve_on_plan_change?: boolean, restricted_to?: string[], starts_at?: string, subscription_cycles?: number, type?: 'flat' | 'percentage', usage_limit?: number): { amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; currency_options?: object[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**patch** `/discounts/{discount_id}`\n\nPATCH /discounts/{discount_id}\n\n### Parameters\n\n- `discount_id: string`\n\n- `amount?: number`\n If present, update the discount amount in **basis points** (e.g., `540` = `5.4%`, `10000` = `100%`).\n\nMust be at least 1 if provided.\n\n- `code?: string`\n If present, update the discount code (uppercase).\n\n- `currency_options?: { currency: string; is_default?: boolean; max_amount_possible?: number; minimum_subtotal?: number; }[]`\n If present, fully replaces the discount's currency options (replace-set\nsemantics, like `restricted_to`). Send an empty array to clear them.\n\n- `customer_eligibility?: 'any' | 'first_time' | 'existing' | 'specific'`\n If present, update who may redeem this discount. Plain field (not\ndouble-option): the DB column is `NOT NULL`, so it can never be cleared\nback to unset, only changed to another `CustomerEligibility` value.\n\n- `expires_at?: string`\n\n- `metadata?: object`\n Additional metadata for the discount\n\n- `name?: string`\n\n- `per_customer_usage_limit?: number`\n If present, update the per-customer usage limit (double-option: send\n`null` to clear it back to unlimited). Must be `<= usage_limit` (the\nvalue in effect after this patch) when both are set.\n\n- `preserve_on_plan_change?: boolean`\n Whether this discount should be preserved when a subscription changes plans.\nIf not provided, the existing value is kept.\n\n- `restricted_to?: string[]`\n If present, replaces all restricted product IDs with this new set.\nTo remove all restrictions, send empty array\n\n- `starts_at?: string`\n If present, update `starts_at` (double-option: send `null` to clear it).\n\n- `subscription_cycles?: number`\n Number of subscription billing cycles this discount is valid for.\nIf not provided, the discount will be applied indefinitely to\nall recurring payments related to the subscription.\n\n- `type?: 'flat' | 'percentage'`\n If present, update the discount type (`percentage` or `flat`).\n\n- `usage_limit?: number`\n\n### Returns\n\n- `{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n - `amount: number`\n - `business_id: string`\n - `code: string`\n - `created_at: string`\n - `customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'`\n - `discount_id: string`\n - `metadata: object`\n - `preserve_on_plan_change: boolean`\n - `restricted_to: string[]`\n - `times_used: number`\n - `type: 'flat' | 'percentage'`\n - `currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]`\n - `expires_at?: string`\n - `name?: string`\n - `per_customer_usage_limit?: number`\n - `starts_at?: string`\n - `subscription_cycles?: number`\n - `usage_limit?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst discount = await client.discounts.update('dsc_qxxEmg5PuM1uNTE0LgkP9');\n\nconsole.log(discount);\n```",
|
|
3939
3948
|
perLanguage: {
|
|
3940
3949
|
typescript: {
|
|
3941
3950
|
method: 'client.discounts.update',
|
|
@@ -3966,7 +3975,7 @@ const EMBEDDED_METHODS = [
|
|
|
3966
3975
|
},
|
|
3967
3976
|
php: {
|
|
3968
3977
|
method: 'discounts->update',
|
|
3969
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$discount = $client->discounts->update(\n 'dsc_qxxEmg5PuM1uNTE0LgkP9',\n amount: 0,\n code: 'code',\n expiresAt: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n metadata: ['foo' => 'string'],\n name: 'name',\n preserveOnPlanChange: true,\n restrictedTo: ['string'],\n subscriptionCycles: 0,\n type: DiscountType::
|
|
3978
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$discount = $client->discounts->update(\n 'dsc_qxxEmg5PuM1uNTE0LgkP9',\n amount: 0,\n code: 'code',\n currencyOptions: [\n [\n 'currency' => Currency::AED,\n 'isDefault' => true,\n 'maxAmountPossible' => 0,\n 'minimumSubtotal' => 0,\n ],\n ],\n customerEligibility: 'any',\n expiresAt: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n metadata: ['foo' => 'string'],\n name: 'name',\n perCustomerUsageLimit: 0,\n preserveOnPlanChange: true,\n restrictedTo: ['string'],\n startsAt: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n subscriptionCycles: 0,\n type: DiscountType::FLAT,\n usageLimit: 0,\n);\n\nvar_dump($discount);",
|
|
3970
3979
|
},
|
|
3971
3980
|
csharp: {
|
|
3972
3981
|
method: 'Discounts.Update',
|
|
@@ -3983,8 +3992,8 @@ const EMBEDDED_METHODS = [
|
|
|
3983
3992
|
stainlessPath: '(resource) discounts > (method) retrieve_by_code',
|
|
3984
3993
|
qualified: 'client.discounts.retrieveByCode',
|
|
3985
3994
|
params: ['code: string;'],
|
|
3986
|
-
response: "{ amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3987
|
-
markdown: "## retrieve_by_code\n\n`client.discounts.retrieveByCode(code: string): { amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**get** `/discounts/code/{code}`\n\nValidate and fetch a discount by its code name (e.g., \"SAVE20\").\nThis allows real-time validation directly against the API using the\nhuman-readable discount code instead of requiring the internal discount_id.\n\n### Parameters\n\n- `code: string`\n\n### Returns\n\n- `{ amount: number; business_id: string; code: string; created_at: string; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'percentage'; expires_at?: string; name?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n - `amount: number`\n - `business_id: string`\n - `code: string`\n - `created_at: string`\n - `discount_id: string`\n - `metadata: object`\n - `preserve_on_plan_change: boolean`\n - `restricted_to: string[]`\n - `times_used: number`\n - `type: 'percentage'`\n - `expires_at?: string`\n - `name?: string`\n - `subscription_cycles?: number`\n - `usage_limit?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst discount = await client.discounts.retrieveByCode('code');\n\nconsole.log(discount);\n```",
|
|
3995
|
+
response: "{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }",
|
|
3996
|
+
markdown: "## retrieve_by_code\n\n`client.discounts.retrieveByCode(code: string): { amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: metadata; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: discount_type; currency_options?: object[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n**get** `/discounts/code/{code}`\n\nValidate and fetch a discount by its code name (e.g., \"SAVE20\").\nThis allows real-time validation directly against the API using the\nhuman-readable discount code instead of requiring the internal discount_id.\n\n### Parameters\n\n- `code: string`\n\n### Returns\n\n- `{ amount: number; business_id: string; code: string; created_at: string; customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'; discount_id: string; metadata: object; preserve_on_plan_change: boolean; restricted_to: string[]; times_used: number; type: 'flat' | 'percentage'; currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]; expires_at?: string; name?: string; per_customer_usage_limit?: number; starts_at?: string; subscription_cycles?: number; usage_limit?: number; }`\n\n - `amount: number`\n - `business_id: string`\n - `code: string`\n - `created_at: string`\n - `customer_eligibility: 'any' | 'first_time' | 'existing' | 'specific'`\n - `discount_id: string`\n - `metadata: object`\n - `preserve_on_plan_change: boolean`\n - `restricted_to: string[]`\n - `times_used: number`\n - `type: 'flat' | 'percentage'`\n - `currency_options?: { currency: string; is_default: boolean; minimum_subtotal: number; max_amount_possible?: number; }[]`\n - `expires_at?: string`\n - `name?: string`\n - `per_customer_usage_limit?: number`\n - `starts_at?: string`\n - `subscription_cycles?: number`\n - `usage_limit?: number`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst discount = await client.discounts.retrieveByCode('code');\n\nconsole.log(discount);\n```",
|
|
3988
3997
|
perLanguage: {
|
|
3989
3998
|
typescript: {
|
|
3990
3999
|
method: 'client.discounts.retrieveByCode',
|
|
@@ -6043,7 +6052,7 @@ const EMBEDDED_METHODS = [
|
|
|
6043
6052
|
'reason?: string;',
|
|
6044
6053
|
],
|
|
6045
6054
|
response: "{ id: string; amount: string; balance_after: string; balance_before: string; created_at: string; credit_entitlement_id: string; customer_id: string; entry_type: 'credit' | 'debit'; is_credit: boolean; overage_after: string; overage_before: string; grant_id?: string; reason?: string; }",
|
|
6046
|
-
markdown: "## create_ledger_entry\n\n`client.creditEntitlements.balances.createLedgerEntry(credit_entitlement_id: string, customer_id: string, amount: string, entry_type: 'credit' | 'debit', expires_at?: string, idempotency_key?: string, metadata?: object, reason?: string): { id: string; amount: string; balance_after: string; balance_before: string; created_at: string; credit_entitlement_id: string; customer_id: string; entry_type: ledger_entry_type; is_credit: boolean; overage_after: string; overage_before: string; grant_id?: string; reason?: string; }`\n\n**post** `/credit-entitlements/{credit_entitlement_id}/balances/{customer_id}/ledger-entries`\n\nFor credit entries, a new grant is created. For debit entries, credits are\ndeducted from existing grants using FIFO (oldest first).\n\n# Authentication\nRequires an API key with `Editor` role.\n\n# Path Parameters\n- `credit_entitlement_id` - The unique identifier of the credit entitlement\n- `customer_id` - The unique identifier of the customer\n\n# Request Body\n- `entry_type` - \"credit\" or \"debit\"\n- `amount` - Amount to credit or debit\n- `reason` - Optional human-readable reason\n- `expires_at` - Optional expiration for credited amount (only for credit type)\n- `idempotency_key` - Optional key to prevent duplicate entries\n\n# Responses\n- `201 Created` - Ledger entry created successfully\n- `400 Bad Request` - Invalid request (e.g., debit with insufficient balance)\n- `404 Not Found` - Credit entitlement or customer not found\n- `409 Conflict` - Idempotency key already exists\n- `500 Internal Server Error` - Database or server error\n\n### Parameters\n\n- `credit_entitlement_id: string`\n\n- `customer_id: string`\n\n- `amount: string`\n Amount to credit or debit\n\n- `entry_type: 'credit' | 'debit'`\n Entry type: credit or debit\n\n- `expires_at?: string`\n Expiration for credited amount (only for credit type)\n\n- `idempotency_key?: string`\n Idempotency key to prevent duplicate entries\n\n- `metadata?: object`\n Optional metadata (max 50 key-value pairs, key max 40 chars, value max 500 chars)\n\n- `reason?: string`\n Human-readable reason for the entry\n\n### Returns\n\n- `{ id: string; amount: string; balance_after: string; balance_before: string; created_at: string; credit_entitlement_id: string; customer_id: string; entry_type: 'credit' | 'debit'; is_credit: boolean; overage_after: string; overage_before: string; grant_id?: string; reason?: string; }`\n Response for creating a ledger entry\n\n - `id: string`\n - `amount: string`\n - `balance_after: string`\n - `balance_before: string`\n - `created_at: string`\n - `credit_entitlement_id: string`\n - `customer_id: string`\n - `entry_type: 'credit' | 'debit'`\n - `is_credit: boolean`\n - `overage_after: string`\n - `overage_before: string`\n - `grant_id?: string`\n - `reason?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.creditEntitlements.balances.createLedgerEntry('cus_TV52uJWWXt2yIoBBxpjaa', {\n credit_entitlement_id: 'cde_ztxm5XJsKxWucRWA3rjdM',\n amount: 'amount',\n entry_type: 'credit',\n});\n\nconsole.log(response);\n```",
|
|
6055
|
+
markdown: "## create_ledger_entry\n\n`client.creditEntitlements.balances.createLedgerEntry(credit_entitlement_id: string, customer_id: string, amount: string, entry_type: 'credit' | 'debit', expires_at?: string, idempotency_key?: string, metadata?: object, reason?: string): { id: string; amount: string; balance_after: string; balance_before: string; created_at: string; credit_entitlement_id: string; customer_id: string; entry_type: ledger_entry_type; is_credit: boolean; overage_after: string; overage_before: string; grant_id?: string; reason?: string; }`\n\n**post** `/credit-entitlements/{credit_entitlement_id}/balances/{customer_id}/ledger-entries`\n\nFor credit entries, a new grant is created. For debit entries, credits are\ndeducted from existing grants using FIFO (oldest first).\n\n# Authentication\nRequires an API key with `Editor` role.\n\n# Path Parameters\n- `credit_entitlement_id` - The unique identifier of the credit entitlement\n- `customer_id` - The unique identifier of the customer\n\n# Request Body\n- `entry_type` - \"credit\" or \"debit\"\n- `amount` - Amount to credit or debit\n- `reason` - Optional human-readable reason\n- `expires_at` - Optional expiration for credited amount (only for credit type)\n- `idempotency_key` - Optional key to prevent duplicate entries\n\n# Responses\n- `201 Created` - Ledger entry created successfully\n- `400 Bad Request` - Invalid request (e.g., debit with insufficient balance)\n- `404 Not Found` - Credit entitlement or customer not found\n- `409 Conflict` - Idempotency key already exists\n- `500 Internal Server Error` - Database or server error\n\n### Parameters\n\n- `credit_entitlement_id: string`\n\n- `customer_id: string`\n\n- `amount: string`\n Amount to credit or debit. Bounded to a `NUMERIC(38,28)` column, so the\ninteger part must have fewer than 10 digits (< 10^10); larger values\npreviously reached the DB and failed with a 22003 overflow surfaced as a 500.\n\n- `entry_type: 'credit' | 'debit'`\n Entry type: credit or debit\n\n- `expires_at?: string`\n Expiration for credited amount (only for credit type)\n\n- `idempotency_key?: string`\n Idempotency key to prevent duplicate entries\n\n- `metadata?: object`\n Optional metadata (max 50 key-value pairs, key max 40 chars, value max 500 chars)\n\n- `reason?: string`\n Human-readable reason for the entry\n\n### Returns\n\n- `{ id: string; amount: string; balance_after: string; balance_before: string; created_at: string; credit_entitlement_id: string; customer_id: string; entry_type: 'credit' | 'debit'; is_credit: boolean; overage_after: string; overage_before: string; grant_id?: string; reason?: string; }`\n Response for creating a ledger entry\n\n - `id: string`\n - `amount: string`\n - `balance_after: string`\n - `balance_before: string`\n - `created_at: string`\n - `credit_entitlement_id: string`\n - `customer_id: string`\n - `entry_type: 'credit' | 'debit'`\n - `is_credit: boolean`\n - `overage_after: string`\n - `overage_before: string`\n - `grant_id?: string`\n - `reason?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.creditEntitlements.balances.createLedgerEntry('cus_TV52uJWWXt2yIoBBxpjaa', {\n credit_entitlement_id: 'cde_ztxm5XJsKxWucRWA3rjdM',\n amount: 'amount',\n entry_type: 'credit',\n});\n\nconsole.log(response);\n```",
|
|
6047
6056
|
perLanguage: {
|
|
6048
6057
|
typescript: {
|
|
6049
6058
|
method: 'client.creditEntitlements.balances.createLedgerEntry',
|
|
@@ -6966,7 +6975,7 @@ const EMBEDDED_METHODS = [
|
|
|
6966
6975
|
'status?: boolean;',
|
|
6967
6976
|
],
|
|
6968
6977
|
response: '{ group_id: string; products: { id: string; addons_count: number; files_count: number; has_credit_entitlements: boolean; is_recurring: boolean; license_key_enabled: boolean; meters_count: number; product_id: string; status: boolean; currency?: currency; description?: string; name?: string; price?: number; price_detail?: price; tax_category?: tax_category; tax_inclusive?: boolean; }[]; status: boolean; group_name?: string; }',
|
|
6969
|
-
markdown: "## create\n\n`client.productCollections.groups.create(id: string, products: { product_id: string; status?: boolean; }[], group_name?: string, status?: boolean): { group_id: string; products: product_collection_product[]; status: boolean; group_name?: string; }`\n\n**post** `/product-collections/{id}/groups`\n\n### Parameters\n\n- `id: string`\n\n- `products: { product_id: string; status?: boolean; }[]`\n Products in this group\n\n- `group_name?: string`\n Optional group name. Multiple groups can have null names, but named groups must be unique per collection\n\n- `status?: boolean`\n Status of the group (defaults to true if not provided)\n\n### Returns\n\n- `{ group_id: string; products: { id: string; addons_count: number; files_count: number; has_credit_entitlements: boolean; is_recurring: boolean; license_key_enabled: boolean; meters_count: number; product_id: string; status: boolean; currency?: currency; description?: string; name?: string; price?: number; price_detail?: price; tax_category?: tax_category; tax_inclusive?: boolean; }[]; status: boolean; group_name?: string; }`\n\n - `group_id: string`\n - `products: { id: string; addons_count: number; files_count: number; has_credit_entitlements: boolean; is_recurring: boolean; license_key_enabled: boolean; meters_count: number; product_id: string; status: boolean; currency?: string; description?: string; name?: string; price?: number; price_detail?: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive?: boolean; }[]`\n - `status: boolean`\n - `group_name?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst productCollectionGroupResponse = await client.productCollections.groups.create('pdc_8BWv0hojwUH7iCDabr0NI', { products: [{ product_id: 'product_id' }] });\n\nconsole.log(productCollectionGroupResponse);\n```",
|
|
6978
|
+
markdown: "## create\n\n`client.productCollections.groups.create(id: string, products: { product_id: string; status?: boolean; }[], group_name?: string, status?: boolean): { group_id: string; products: product_collection_product[]; status: boolean; group_name?: string; }`\n\n**post** `/product-collections/{id}/groups`\n\n### Parameters\n\n- `id: string`\n\n- `products: { product_id: string; status?: boolean; }[]`\n Products in this group\n\n- `group_name?: string`\n Optional group name. Multiple groups can have null names, but named groups must be unique per collection\n\n- `status?: boolean`\n Status of the group (defaults to true if not provided)\n\n### Returns\n\n- `{ group_id: string; products: { id: string; addons_count: number; files_count: number; has_credit_entitlements: boolean; is_recurring: boolean; license_key_enabled: boolean; meters_count: number; product_id: string; status: boolean; currency?: currency; description?: string; name?: string; price?: number; price_detail?: price; tax_category?: tax_category; tax_inclusive?: boolean; }[]; status: boolean; group_name?: string; }`\n\n - `group_id: string`\n - `products: { id: string; addons_count: number; files_count: number; has_credit_entitlements: boolean; is_recurring: boolean; license_key_enabled: boolean; meters_count: number; product_id: string; status: boolean; currency?: string; description?: string; name?: string; price?: number; price_detail?: { currency: currency; discount: number; price: number; purchasing_power_parity: boolean; type: 'one_time_price'; pay_what_you_want?: boolean; suggested_price?: number; tax_inclusive?: boolean; } | { currency: currency; discount: number; payment_frequency_count: number; payment_frequency_interval: time_interval; price: number; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'recurring_price'; tax_inclusive?: boolean; trial_amount?: number; trial_apply_discounts?: boolean; trial_period_days?: number; } | { currency: currency; discount: number; fixed_price: number; payment_frequency_count: number; payment_frequency_interval: time_interval; purchasing_power_parity: boolean; subscription_period_count: number; subscription_period_interval: time_interval; type: 'usage_based_price'; meters?: add_meter_to_price[]; tax_inclusive?: boolean; }; tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive?: boolean; }[]`\n - `status: boolean`\n - `group_name?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst productCollectionGroupResponse = await client.productCollections.groups.create('pdc_8BWv0hojwUH7iCDabr0NI', { products: [{ product_id: 'product_id' }] });\n\nconsole.log(productCollectionGroupResponse);\n```",
|
|
6970
6979
|
perLanguage: {
|
|
6971
6980
|
typescript: {
|
|
6972
6981
|
method: 'client.productCollections.groups.create',
|