dodopayments-mcp 2.38.0 → 2.39.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.
@@ -200,19 +200,19 @@ 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; recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }; tax_id_err_msg?: 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_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; recurring_breakup?: object; tax_id_err_msg?: 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_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_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; recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }; tax_id_err_msg?: 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 - `recurring_breakup?: { discount: number; subtotal: number; total_amount: number; tax?: number; }`\n - `tax_id_err_msg?: 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; 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_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; 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_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_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; 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 - `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```",
205
205
  perLanguage: {
206
206
  typescript: {
207
207
  method: 'client.checkoutSessions.preview',
208
- 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 response = await client.checkoutSessions.preview({\n product_cart: [{ product_id: 'product_id', quantity: 0 }],\n});\n\nconsole.log(response.tax_id_err_msg);",
208
+ 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 response = await client.checkoutSessions.preview({\n product_cart: [{ product_id: 'product_id', quantity: 0 }],\n});\n\nconsole.log(response.tax_id_business_name);",
209
209
  },
210
210
  http: {
211
211
  example: 'curl https://live.dodopayments.com/checkouts/preview \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "product_cart": [\n {\n "product_id": "product_id",\n "quantity": 0\n }\n ]\n }\'',
212
212
  },
213
213
  python: {
214
214
  method: 'checkout_sessions.preview',
215
- 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)\nresponse = client.checkout_sessions.preview(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n)\nprint(response.tax_id_err_msg)',
215
+ 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)\nresponse = client.checkout_sessions.preview(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n)\nprint(response.tax_id_business_name)',
216
216
  },
217
217
  java: {
218
218
  method: 'checkoutSessions().preview',
@@ -224,7 +224,7 @@ const EMBEDDED_METHODS = [
224
224
  },
225
225
  go: {
226
226
  method: 'client.CheckoutSessions.Preview',
227
- 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\tresponse, err := client.CheckoutSessions.Preview(context.TODO(), dodopayments.CheckoutSessionPreviewParams{\n\t\tCheckoutSessionRequest: dodopayments.CheckoutSessionRequestParam{\n\t\t\tProductCart: dodopayments.F([]dodopayments.ProductItemReqParam{{\n\t\t\t\tProductID: dodopayments.F("product_id"),\n\t\t\t\tQuantity: dodopayments.F(int64(0)),\n\t\t\t}}),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.TaxIDErrMsg)\n}\n',
227
+ 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\tresponse, err := client.CheckoutSessions.Preview(context.TODO(), dodopayments.CheckoutSessionPreviewParams{\n\t\tCheckoutSessionRequest: dodopayments.CheckoutSessionRequestParam{\n\t\t\tProductCart: dodopayments.F([]dodopayments.ProductItemReqParam{{\n\t\t\t\tProductID: dodopayments.F("product_id"),\n\t\t\t\tQuantity: dodopayments.F(int64(0)),\n\t\t\t}}),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.TaxIDBusinessName)\n}\n',
228
228
  },
229
229
  ruby: {
230
230
  method: 'checkout_sessions.preview',