dodopayments-mcp 2.31.2 → 2.32.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/auth.d.mts.map +1 -1
- package/auth.d.ts.map +1 -1
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool-worker.d.mts.map +1 -1
- package/code-tool-worker.d.ts.map +1 -1
- package/code-tool-worker.js +14 -0
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +14 -0
- package/code-tool-worker.mjs.map +1 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +1 -1
- package/code-tool.mjs +1 -1
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +2 -2
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +2 -2
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.mjs.map +1 -1
- package/index.mjs.map +1 -1
- package/instructions.mjs.map +1 -1
- package/local-docs-search.d.mts.map +1 -1
- package/local-docs-search.d.ts.map +1 -1
- package/local-docs-search.js +827 -62
- package/local-docs-search.js.map +1 -1
- package/local-docs-search.mjs +827 -62
- package/local-docs-search.mjs.map +1 -1
- package/logger.d.mts.map +1 -1
- package/logger.d.ts.map +1 -1
- package/logger.mjs.map +1 -1
- package/methods.d.mts.map +1 -1
- package/methods.d.ts.map +1 -1
- package/methods.js +84 -0
- package/methods.js.map +1 -1
- package/methods.mjs +84 -0
- package/methods.mjs.map +1 -1
- package/options.mjs.map +1 -1
- package/package.json +2 -2
- package/server.d.mts.map +1 -1
- package/server.d.ts.map +1 -1
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/server.mjs.map +1 -1
- package/src/code-tool-worker.ts +14 -0
- package/src/code-tool.ts +1 -1
- package/src/local-docs-search.ts +987 -62
- package/src/methods.ts +84 -0
- package/src/server.ts +1 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.mjs.map +1 -1
- package/types.d.mts.map +1 -1
- package/types.d.ts.map +1 -1
package/local-docs-search.js
CHANGED
|
@@ -60,10 +60,11 @@ const EMBEDDED_METHODS = [
|
|
|
60
60
|
'confirm?: boolean;',
|
|
61
61
|
"custom_fields?: { field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean'; key: string; label: string; options?: string[]; placeholder?: string; required?: boolean; }[];",
|
|
62
62
|
'customer?: { customer_id: string; } | { email: string; name?: string; phone_number?: string; };',
|
|
63
|
+
'customer_business_name?: string;',
|
|
63
64
|
"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; }; };",
|
|
64
65
|
'discount_code?: string;',
|
|
65
66
|
'discount_codes?: string[];',
|
|
66
|
-
'feature_flags?: { allow_currency_selection?: 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; };',
|
|
67
|
+
'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; };',
|
|
67
68
|
'force_3ds?: boolean;',
|
|
68
69
|
'mandate_min_amount_inr_paise?: number;',
|
|
69
70
|
'metadata?: object;',
|
|
@@ -76,8 +77,8 @@ const EMBEDDED_METHODS = [
|
|
|
76
77
|
'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; };',
|
|
77
78
|
'tax_id?: string;',
|
|
78
79
|
],
|
|
79
|
-
response: '{ session_id: string; checkout_url?: string; }',
|
|
80
|
-
markdown: "## create\n\n`client.checkoutSessions.create(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, 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_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): { session_id: string; checkout_url?: string; }`\n\n**post** `/checkouts`\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- `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_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_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- `{ session_id: string; checkout_url?: string; }`\n\n - `session_id: string`\n - `checkout_url?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst checkoutSessionResponse = await client.checkoutSessions.create({ product_cart: [{ product_id: 'product_id', quantity: 0 }] });\n\nconsole.log(checkoutSessionResponse);\n```",
|
|
80
|
+
response: '{ session_id: string; checkout_url?: string; client_secret?: string; payment_id?: string; publishable_key?: string; }',
|
|
81
|
+
markdown: "## create\n\n`client.checkoutSessions.create(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): { session_id: string; checkout_url?: string; client_secret?: string; payment_id?: string; publishable_key?: string; }`\n\n**post** `/checkouts`\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- `{ session_id: string; checkout_url?: string; client_secret?: string; payment_id?: string; publishable_key?: string; }`\n\n - `session_id: string`\n - `checkout_url?: string`\n - `client_secret?: string`\n - `payment_id?: string`\n - `publishable_key?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst checkoutSessionResponse = await client.checkoutSessions.create({ product_cart: [{ product_id: 'product_id', quantity: 0 }] });\n\nconsole.log(checkoutSessionResponse);\n```",
|
|
81
82
|
perLanguage: {
|
|
82
83
|
typescript: {
|
|
83
84
|
method: 'client.checkoutSessions.create',
|
|
@@ -109,7 +110,7 @@ const EMBEDDED_METHODS = [
|
|
|
109
110
|
},
|
|
110
111
|
php: {
|
|
111
112
|
method: 'checkoutSessions->create',
|
|
112
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$checkoutSessionResponse = $client->checkoutSessions->create(\n productCart: [\n [\n 'productID' => 'product_id',\n 'quantity' => 0,\n 'addons' => [['addonID' => 'addon_id', 'quantity' => 0]],\n 'amount' => 0,\n 'creditEntitlements' => [\n [\n 'creditEntitlementID' => 'credit_entitlement_id',\n 'creditsAmount' => 'credits_amount',\n ],\n ],\n ],\n ],\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingAddress: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n billingCurrency: Currency::AED,\n cancelURL: 'cancel_url',\n confirm: true,\n customFields: [\n [\n 'fieldType' => 'text',\n 'key' => 'key',\n 'label' => 'label',\n 'options' => ['string'],\n 'placeholder' => 'placeholder',\n 'required' => true,\n ],\n ],\n customer: ['customerID' => 'customer_id'],\n customization: [\n 'forceLanguage' => 'force_language',\n 'showOnDemandTag' => true,\n 'showOrderDetails' => true,\n 'theme' => 'dark',\n 'themeConfig' => [\n 'dark' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'fontPrimaryURL' => 'font_primary_url',\n 'fontSecondaryURL' => 'font_secondary_url',\n 'fontSize' => 'xs',\n 'fontWeight' => 'normal',\n 'light' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'payButtonText' => 'pay_button_text',\n 'radius' => 'radius',\n ],\n ],\n discountCode: 'discount_code',\n discountCodes: ['string'],\n featureFlags: [\n 'allowCurrencySelection' => true,\n 'allowCustomerEditingCity' => true,\n 'allowCustomerEditingCountry' => true,\n 'allowCustomerEditingEmail' => true,\n 'allowCustomerEditingName' => true,\n 'allowCustomerEditingState' => true,\n 'allowCustomerEditingStreet' => true,\n 'allowCustomerEditingTaxID' => true,\n 'allowCustomerEditingZipcode' => true,\n 'allowDiscountCode' => true,\n 'allowPhoneNumberCollection' => true,\n 'allowTaxID' => true,\n 'alwaysCreateNewCustomer' => true,\n 'redirectImmediately' => true,\n 'requirePhoneNumber' => true,\n ],\n force3DS: true,\n mandateMinAmountInrPaise: 0,\n metadata: ['foo' => 'string'],\n minimalAddress: true,\n paymentMethodID: 'payment_method_id',\n productCollectionID: 'product_collection_id',\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n subscriptionData: [\n 'onDemand' => [\n 'mandateOnly' => true,\n 'adaptiveCurrencyFeesInclusive' => true,\n 'productCurrency' => Currency::AED,\n 'productDescription' => 'product_description',\n 'productPrice' => 0,\n ],\n 'trialPeriodDays' => 0,\n ],\n taxID: 'tax_id',\n);\n\nvar_dump($checkoutSessionResponse);",
|
|
113
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$checkoutSessionResponse = $client->checkoutSessions->create(\n productCart: [\n [\n 'productID' => 'product_id',\n 'quantity' => 0,\n 'addons' => [['addonID' => 'addon_id', 'quantity' => 0]],\n 'amount' => 0,\n 'creditEntitlements' => [\n [\n 'creditEntitlementID' => 'credit_entitlement_id',\n 'creditsAmount' => 'credits_amount',\n ],\n ],\n ],\n ],\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingAddress: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n billingCurrency: Currency::AED,\n cancelURL: 'cancel_url',\n confirm: true,\n customFields: [\n [\n 'fieldType' => 'text',\n 'key' => 'key',\n 'label' => 'label',\n 'options' => ['string'],\n 'placeholder' => 'placeholder',\n 'required' => true,\n ],\n ],\n customer: ['customerID' => 'customer_id'],\n customerBusinessName: 'customer_business_name',\n customization: [\n 'forceLanguage' => 'force_language',\n 'showOnDemandTag' => true,\n 'showOrderDetails' => true,\n 'theme' => 'dark',\n 'themeConfig' => [\n 'dark' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'fontPrimaryURL' => 'font_primary_url',\n 'fontSecondaryURL' => 'font_secondary_url',\n 'fontSize' => 'xs',\n 'fontWeight' => 'normal',\n 'light' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'payButtonText' => 'pay_button_text',\n 'radius' => 'radius',\n ],\n ],\n discountCode: 'discount_code',\n discountCodes: ['string'],\n featureFlags: [\n 'allowCurrencySelection' => true,\n 'allowCustomerEditingBusinessName' => true,\n 'allowCustomerEditingCity' => true,\n 'allowCustomerEditingCountry' => true,\n 'allowCustomerEditingEmail' => true,\n 'allowCustomerEditingName' => true,\n 'allowCustomerEditingState' => true,\n 'allowCustomerEditingStreet' => true,\n 'allowCustomerEditingTaxID' => true,\n 'allowCustomerEditingZipcode' => true,\n 'allowDiscountCode' => true,\n 'allowPhoneNumberCollection' => true,\n 'allowTaxID' => true,\n 'alwaysCreateNewCustomer' => true,\n 'redirectImmediately' => true,\n 'requirePhoneNumber' => true,\n ],\n force3DS: true,\n mandateMinAmountInrPaise: 0,\n metadata: ['foo' => 'string'],\n minimalAddress: true,\n paymentMethodID: 'payment_method_id',\n productCollectionID: 'product_collection_id',\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n subscriptionData: [\n 'onDemand' => [\n 'mandateOnly' => true,\n 'adaptiveCurrencyFeesInclusive' => true,\n 'productCurrency' => Currency::AED,\n 'productDescription' => 'product_description',\n 'productPrice' => 0,\n ],\n 'trialPeriodDays' => 0,\n ],\n taxID: 'tax_id',\n);\n\nvar_dump($checkoutSessionResponse);",
|
|
113
114
|
},
|
|
114
115
|
csharp: {
|
|
115
116
|
method: 'CheckoutSessions.Create',
|
|
@@ -190,10 +191,11 @@ const EMBEDDED_METHODS = [
|
|
|
190
191
|
'confirm?: boolean;',
|
|
191
192
|
"custom_fields?: { field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean'; key: string; label: string; options?: string[]; placeholder?: string; required?: boolean; }[];",
|
|
192
193
|
'customer?: { customer_id: string; } | { email: string; name?: string; phone_number?: string; };',
|
|
194
|
+
'customer_business_name?: string;',
|
|
193
195
|
"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; }; };",
|
|
194
196
|
'discount_code?: string;',
|
|
195
197
|
'discount_codes?: string[];',
|
|
196
|
-
'feature_flags?: { allow_currency_selection?: 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; };',
|
|
198
|
+
'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; };',
|
|
197
199
|
'force_3ds?: boolean;',
|
|
198
200
|
'mandate_min_amount_inr_paise?: number;',
|
|
199
201
|
'metadata?: object;',
|
|
@@ -207,7 +209,7 @@ const EMBEDDED_METHODS = [
|
|
|
207
209
|
'tax_id?: string;',
|
|
208
210
|
],
|
|
209
211
|
response: '{ billing_country: string; currency: string; current_breakup: { discount: number; subtotal: number; total_amount: number; tax?: number; }; 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; }',
|
|
210
|
-
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, 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_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; 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- `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_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_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; }; 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 - `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```",
|
|
212
|
+
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; 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; }; 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 - `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```",
|
|
211
213
|
perLanguage: {
|
|
212
214
|
typescript: {
|
|
213
215
|
method: 'client.checkoutSessions.preview',
|
|
@@ -239,7 +241,7 @@ const EMBEDDED_METHODS = [
|
|
|
239
241
|
},
|
|
240
242
|
php: {
|
|
241
243
|
method: 'checkoutSessions->preview',
|
|
242
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->checkoutSessions->preview(\n productCart: [\n [\n 'productID' => 'product_id',\n 'quantity' => 0,\n 'addons' => [['addonID' => 'addon_id', 'quantity' => 0]],\n 'amount' => 0,\n 'creditEntitlements' => [\n [\n 'creditEntitlementID' => 'credit_entitlement_id',\n 'creditsAmount' => 'credits_amount',\n ],\n ],\n ],\n ],\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingAddress: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n billingCurrency: Currency::AED,\n cancelURL: 'cancel_url',\n confirm: true,\n customFields: [\n [\n 'fieldType' => 'text',\n 'key' => 'key',\n 'label' => 'label',\n 'options' => ['string'],\n 'placeholder' => 'placeholder',\n 'required' => true,\n ],\n ],\n customer: ['customerID' => 'customer_id'],\n customization: [\n 'forceLanguage' => 'force_language',\n 'showOnDemandTag' => true,\n 'showOrderDetails' => true,\n 'theme' => 'dark',\n 'themeConfig' => [\n 'dark' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'fontPrimaryURL' => 'font_primary_url',\n 'fontSecondaryURL' => 'font_secondary_url',\n 'fontSize' => 'xs',\n 'fontWeight' => 'normal',\n 'light' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'payButtonText' => 'pay_button_text',\n 'radius' => 'radius',\n ],\n ],\n discountCode: 'discount_code',\n discountCodes: ['string'],\n featureFlags: [\n 'allowCurrencySelection' => true,\n 'allowCustomerEditingCity' => true,\n 'allowCustomerEditingCountry' => true,\n 'allowCustomerEditingEmail' => true,\n 'allowCustomerEditingName' => true,\n 'allowCustomerEditingState' => true,\n 'allowCustomerEditingStreet' => true,\n 'allowCustomerEditingTaxID' => true,\n 'allowCustomerEditingZipcode' => true,\n 'allowDiscountCode' => true,\n 'allowPhoneNumberCollection' => true,\n 'allowTaxID' => true,\n 'alwaysCreateNewCustomer' => true,\n 'redirectImmediately' => true,\n 'requirePhoneNumber' => true,\n ],\n force3DS: true,\n mandateMinAmountInrPaise: 0,\n metadata: ['foo' => 'string'],\n minimalAddress: true,\n paymentMethodID: 'payment_method_id',\n productCollectionID: 'product_collection_id',\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n subscriptionData: [\n 'onDemand' => [\n 'mandateOnly' => true,\n 'adaptiveCurrencyFeesInclusive' => true,\n 'productCurrency' => Currency::AED,\n 'productDescription' => 'product_description',\n 'productPrice' => 0,\n ],\n 'trialPeriodDays' => 0,\n ],\n taxID: 'tax_id',\n);\n\nvar_dump($response);",
|
|
244
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->checkoutSessions->preview(\n productCart: [\n [\n 'productID' => 'product_id',\n 'quantity' => 0,\n 'addons' => [['addonID' => 'addon_id', 'quantity' => 0]],\n 'amount' => 0,\n 'creditEntitlements' => [\n [\n 'creditEntitlementID' => 'credit_entitlement_id',\n 'creditsAmount' => 'credits_amount',\n ],\n ],\n ],\n ],\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingAddress: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n billingCurrency: Currency::AED,\n cancelURL: 'cancel_url',\n confirm: true,\n customFields: [\n [\n 'fieldType' => 'text',\n 'key' => 'key',\n 'label' => 'label',\n 'options' => ['string'],\n 'placeholder' => 'placeholder',\n 'required' => true,\n ],\n ],\n customer: ['customerID' => 'customer_id'],\n customerBusinessName: 'customer_business_name',\n customization: [\n 'forceLanguage' => 'force_language',\n 'showOnDemandTag' => true,\n 'showOrderDetails' => true,\n 'theme' => 'dark',\n 'themeConfig' => [\n 'dark' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'fontPrimaryURL' => 'font_primary_url',\n 'fontSecondaryURL' => 'font_secondary_url',\n 'fontSize' => 'xs',\n 'fontWeight' => 'normal',\n 'light' => [\n 'bgPrimary' => 'bg_primary',\n 'bgSecondary' => 'bg_secondary',\n 'borderPrimary' => 'border_primary',\n 'borderSecondary' => 'border_secondary',\n 'buttonPrimary' => 'button_primary',\n 'buttonPrimaryHover' => 'button_primary_hover',\n 'buttonSecondary' => 'button_secondary',\n 'buttonSecondaryHover' => 'button_secondary_hover',\n 'buttonTextPrimary' => 'button_text_primary',\n 'buttonTextSecondary' => 'button_text_secondary',\n 'inputFocusBorder' => 'input_focus_border',\n 'textError' => 'text_error',\n 'textPlaceholder' => 'text_placeholder',\n 'textPrimary' => 'text_primary',\n 'textSecondary' => 'text_secondary',\n 'textSuccess' => 'text_success',\n ],\n 'payButtonText' => 'pay_button_text',\n 'radius' => 'radius',\n ],\n ],\n discountCode: 'discount_code',\n discountCodes: ['string'],\n featureFlags: [\n 'allowCurrencySelection' => true,\n 'allowCustomerEditingBusinessName' => true,\n 'allowCustomerEditingCity' => true,\n 'allowCustomerEditingCountry' => true,\n 'allowCustomerEditingEmail' => true,\n 'allowCustomerEditingName' => true,\n 'allowCustomerEditingState' => true,\n 'allowCustomerEditingStreet' => true,\n 'allowCustomerEditingTaxID' => true,\n 'allowCustomerEditingZipcode' => true,\n 'allowDiscountCode' => true,\n 'allowPhoneNumberCollection' => true,\n 'allowTaxID' => true,\n 'alwaysCreateNewCustomer' => true,\n 'redirectImmediately' => true,\n 'requirePhoneNumber' => true,\n ],\n force3DS: true,\n mandateMinAmountInrPaise: 0,\n metadata: ['foo' => 'string'],\n minimalAddress: true,\n paymentMethodID: 'payment_method_id',\n productCollectionID: 'product_collection_id',\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n subscriptionData: [\n 'onDemand' => [\n 'mandateOnly' => true,\n 'adaptiveCurrencyFeesInclusive' => true,\n 'productCurrency' => Currency::AED,\n 'productDescription' => 'product_description',\n 'productPrice' => 0,\n ],\n 'trialPeriodDays' => 0,\n ],\n taxID: 'tax_id',\n);\n\nvar_dump($response);",
|
|
243
245
|
},
|
|
244
246
|
csharp: {
|
|
245
247
|
method: 'CheckoutSessions.Preview',
|
|
@@ -328,6 +330,7 @@ const EMBEDDED_METHODS = [
|
|
|
328
330
|
'adaptive_currency_fees_inclusive?: boolean;',
|
|
329
331
|
'allowed_payment_method_types?: string[];',
|
|
330
332
|
'billing_currency?: string;',
|
|
333
|
+
'customer_business_name?: string;',
|
|
331
334
|
'discount_code?: string;',
|
|
332
335
|
'discount_codes?: string[];',
|
|
333
336
|
'force_3ds?: boolean;',
|
|
@@ -342,7 +345,7 @@ const EMBEDDED_METHODS = [
|
|
|
342
345
|
'tax_id?: string;',
|
|
343
346
|
],
|
|
344
347
|
response: '{ client_secret: string; customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }; metadata: object; payment_id: string; total_amount: number; discount_id?: string; discount_ids?: string[]; expires_on?: string; payment_link?: string; product_cart?: { product_id: string; quantity: number; amount?: number; }[]; }',
|
|
345
|
-
markdown: "## create\n\n`client.payments.create(billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, customer: object | object, product_cart: { product_id: string; quantity: number; amount?: number; }[], adaptive_currency_fees_inclusive?: boolean, allowed_payment_method_types?: string[], billing_currency?: string, discount_code?: string, discount_codes?: string[], force_3ds?: boolean, metadata?: object, 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): { client_secret: string; customer: customer_limited_details; metadata: object; payment_id: string; total_amount: number; discount_id?: string; discount_ids?: string[]; expires_on?: string; payment_link?: string; product_cart?: one_time_product_cart_item[]; }`\n\n**post** `/payments`\n\n### Parameters\n\n- `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n Billing address details for the payment\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 information for the payment\n\n- `product_cart: { product_id: string; quantity: number; amount?: number; }[]`\n List of products in the cart. Must contain at least 1 and at most 100 items.\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, defaults to the business-level setting.\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- `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 payment\n\n- `metadata?: object`\n Additional metadata associated with the payment.\nDefaults to empty if not provided.\n\n- `payment_link?: boolean`\n Whether to generate a payment link. Defaults to false if not specified.\n\n- `payment_method_id?: string`\n Optional payment method ID to use for this payment.\nIf provided, customer_id must also be provided.\nThe payment method will be validated for eligibility with the payment'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 payment.\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 the customer after payment.\nMust be a valid URL if provided.\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### Returns\n\n- `{ client_secret: string; customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }; metadata: object; payment_id: string; total_amount: number; discount_id?: string; discount_ids?: string[]; expires_on?: string; payment_link?: string; product_cart?: { product_id: string; quantity: number; amount?: number; }[]; }`\n\n - `client_secret: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `payment_id: string`\n - `total_amount: number`\n - `discount_id?: string`\n - `discount_ids?: string[]`\n - `expires_on?: string`\n - `payment_link?: string`\n - `product_cart?: { product_id: string; quantity: number; amount?: number; }[]`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst payment = await client.payments.create({\n billing: { country: 'AF' },\n customer: { customer_id: 'customer_id' },\n product_cart: [{ product_id: 'product_id', quantity: 0 }],\n});\n\nconsole.log(payment);\n```",
|
|
348
|
+
markdown: "## create\n\n`client.payments.create(billing: { country: country_code; city?: string; state?: string; street?: string; zipcode?: string; }, customer: object | object, product_cart: { product_id: string; quantity: number; amount?: number; }[], adaptive_currency_fees_inclusive?: boolean, allowed_payment_method_types?: string[], billing_currency?: string, customer_business_name?: string, discount_code?: string, discount_codes?: string[], force_3ds?: boolean, metadata?: object, 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): { client_secret: string; customer: customer_limited_details; metadata: object; payment_id: string; total_amount: number; discount_id?: string; discount_ids?: string[]; expires_on?: string; payment_link?: string; product_cart?: one_time_product_cart_item[]; }`\n\n**post** `/payments`\n\n### Parameters\n\n- `billing: { country: string; city?: string; state?: string; street?: string; zipcode?: string; }`\n Billing address details for the payment\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 information for the payment\n\n- `product_cart: { product_id: string; quantity: number; amount?: number; }[]`\n List of products in the cart. Must contain at least 1 and at most 100 items.\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, defaults to the business-level setting.\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 payment\n\n- `metadata?: object`\n Additional metadata associated with the payment.\nDefaults to empty if not provided.\n\n- `payment_link?: boolean`\n Whether to generate a payment link. Defaults to false if not specified.\n\n- `payment_method_id?: string`\n Optional payment method ID to use for this payment.\nIf provided, customer_id must also be provided.\nThe payment method will be validated for eligibility with the payment'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 payment.\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 the customer after payment.\nMust be a valid URL if provided.\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### Returns\n\n- `{ client_secret: string; customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }; metadata: object; payment_id: string; total_amount: number; discount_id?: string; discount_ids?: string[]; expires_on?: string; payment_link?: string; product_cart?: { product_id: string; quantity: number; amount?: number; }[]; }`\n\n - `client_secret: string`\n - `customer: { customer_id: string; email: string; name: string; metadata?: object; phone_number?: string; }`\n - `metadata: object`\n - `payment_id: string`\n - `total_amount: number`\n - `discount_id?: string`\n - `discount_ids?: string[]`\n - `expires_on?: string`\n - `payment_link?: string`\n - `product_cart?: { product_id: string; quantity: number; amount?: number; }[]`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst payment = await client.payments.create({\n billing: { country: 'AF' },\n customer: { customer_id: 'customer_id' },\n product_cart: [{ product_id: 'product_id', quantity: 0 }],\n});\n\nconsole.log(payment);\n```",
|
|
346
349
|
perLanguage: {
|
|
347
350
|
typescript: {
|
|
348
351
|
method: 'client.payments.create',
|
|
@@ -374,7 +377,7 @@ const EMBEDDED_METHODS = [
|
|
|
374
377
|
},
|
|
375
378
|
php: {
|
|
376
379
|
method: 'payments->create',
|
|
377
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$payment = $client->payments->create(\n billing: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n customer: ['customerID' => 'customer_id'],\n productCart: [['productID' => 'product_id', 'quantity' => 0, 'amount' => 0]],\n adaptiveCurrencyFeesInclusive: true,\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingCurrency: Currency::AED,\n discountCode: 'discount_code',\n discountCodes: ['string'],\n force3DS: true,\n metadata: ['foo' => 'string'],\n paymentLink: true,\n paymentMethodID: 'payment_method_id',\n redirectImmediately: true,\n requirePhoneNumber: true,\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n taxID: 'tax_id',\n);\n\nvar_dump($payment);",
|
|
380
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$payment = $client->payments->create(\n billing: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n customer: ['customerID' => 'customer_id'],\n productCart: [['productID' => 'product_id', 'quantity' => 0, 'amount' => 0]],\n adaptiveCurrencyFeesInclusive: true,\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingCurrency: Currency::AED,\n customerBusinessName: 'customer_business_name',\n discountCode: 'discount_code',\n discountCodes: ['string'],\n force3DS: true,\n metadata: ['foo' => 'string'],\n paymentLink: true,\n paymentMethodID: 'payment_method_id',\n redirectImmediately: true,\n requirePhoneNumber: true,\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n taxID: 'tax_id',\n);\n\nvar_dump($payment);",
|
|
378
381
|
},
|
|
379
382
|
csharp: {
|
|
380
383
|
method: 'Payments.Create',
|
|
@@ -394,8 +397,8 @@ const EMBEDDED_METHODS = [
|
|
|
394
397
|
stainlessPath: '(resource) payments > (method) retrieve',
|
|
395
398
|
qualified: 'client.payments.retrieve',
|
|
396
399
|
params: ['payment_id: string;'],
|
|
397
|
-
response:
|
|
398
|
-
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[]; metadata: object; payment_id: string; refunds: refund_list_item[]; 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?:
|
|
400
|
+
response: "{ billing: object; brand_id: string; business_id: string; created_at: string; currency: string; customer: object; digital_products_delivered: boolean; disputes: object[]; metadata: object; payment_id: string; refunds: object[]; 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_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; }",
|
|
401
|
+
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[]; metadata: object; payment_id: string; refunds: refund_list_item[]; 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_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?: object; 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; }[]; metadata: object; payment_id: string; 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; }[]; 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: object; 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_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 - `metadata: object`\n - `payment_id: string`\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 - `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_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('payment_id');\n\nconsole.log(payment);\n```",
|
|
399
402
|
perLanguage: {
|
|
400
403
|
typescript: {
|
|
401
404
|
method: 'client.payments.retrieve',
|
|
@@ -509,8 +512,8 @@ const EMBEDDED_METHODS = [
|
|
|
509
512
|
'product_id?: string;',
|
|
510
513
|
"status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';",
|
|
511
514
|
],
|
|
512
|
-
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; discount_cycles_remaining?: number; discount_id?: string; payment_method_id?: string; product_name?: string; scheduled_change?: object; tax_id?: string; }",
|
|
513
|
-
markdown: "## list\n\n`client.subscriptions.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?: '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: object; 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; 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- `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?: object; 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; 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 - `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```",
|
|
515
|
+
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; }",
|
|
516
|
+
markdown: "## list\n\n`client.subscriptions.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?: '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: object; 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- `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?: object; 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```",
|
|
514
517
|
perLanguage: {
|
|
515
518
|
typescript: {
|
|
516
519
|
method: 'client.subscriptions.list',
|
|
@@ -569,6 +572,7 @@ const EMBEDDED_METHODS = [
|
|
|
569
572
|
'addons?: { addon_id: string; quantity: number; }[];',
|
|
570
573
|
'allowed_payment_method_types?: string[];',
|
|
571
574
|
'billing_currency?: string;',
|
|
575
|
+
'customer_business_name?: string;',
|
|
572
576
|
'discount_code?: string;',
|
|
573
577
|
'discount_codes?: string[];',
|
|
574
578
|
'force_3ds?: boolean;',
|
|
@@ -587,7 +591,7 @@ const EMBEDDED_METHODS = [
|
|
|
587
591
|
'trial_period_days?: number;',
|
|
588
592
|
],
|
|
589
593
|
response: '{ addons: { addon_id: string; quantity: number; }[]; customer: { customer_id: string; email: string; name: string; metadata?: object; 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; }',
|
|
590
|
-
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, 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: 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?: 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- `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?: object; 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```",
|
|
594
|
+
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: 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?: 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?: object; 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```",
|
|
591
595
|
perLanguage: {
|
|
592
596
|
typescript: {
|
|
593
597
|
method: 'client.subscriptions.create',
|
|
@@ -619,7 +623,7 @@ const EMBEDDED_METHODS = [
|
|
|
619
623
|
},
|
|
620
624
|
php: {
|
|
621
625
|
method: 'subscriptions->create',
|
|
622
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$subscription = $client->subscriptions->create(\n billing: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n customer: ['customerID' => 'customer_id'],\n productID: 'product_id',\n quantity: 0,\n addons: [['addonID' => 'addon_id', 'quantity' => 0]],\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingCurrency: Currency::AED,\n discountCode: 'discount_code',\n discountCodes: ['string'],\n force3DS: true,\n mandateMinAmountInrPaise: 0,\n metadata: ['foo' => 'string'],\n onDemand: [\n 'mandateOnly' => true,\n 'adaptiveCurrencyFeesInclusive' => true,\n 'productCurrency' => Currency::AED,\n 'productDescription' => 'product_description',\n 'productPrice' => 0,\n ],\n oneTimeProductCart: [\n ['productID' => 'product_id', 'quantity' => 0, 'amount' => 0]\n ],\n paymentLink: true,\n paymentMethodID: 'payment_method_id',\n redirectImmediately: true,\n requirePhoneNumber: true,\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n taxID: 'tax_id',\n trialPeriodDays: 0,\n);\n\nvar_dump($subscription);",
|
|
626
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$subscription = $client->subscriptions->create(\n billing: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n customer: ['customerID' => 'customer_id'],\n productID: 'product_id',\n quantity: 0,\n addons: [['addonID' => 'addon_id', 'quantity' => 0]],\n allowedPaymentMethodTypes: [PaymentMethodTypes::ACH],\n billingCurrency: Currency::AED,\n customerBusinessName: 'customer_business_name',\n discountCode: 'discount_code',\n discountCodes: ['string'],\n force3DS: true,\n mandateMinAmountInrPaise: 0,\n metadata: ['foo' => 'string'],\n onDemand: [\n 'mandateOnly' => true,\n 'adaptiveCurrencyFeesInclusive' => true,\n 'productCurrency' => Currency::AED,\n 'productDescription' => 'product_description',\n 'productPrice' => 0,\n ],\n oneTimeProductCart: [\n ['productID' => 'product_id', 'quantity' => 0, 'amount' => 0]\n ],\n paymentLink: true,\n paymentMethodID: 'payment_method_id',\n redirectImmediately: true,\n requirePhoneNumber: true,\n returnURL: 'return_url',\n shortLink: true,\n showSavedPaymentMethods: true,\n taxID: 'tax_id',\n trialPeriodDays: 0,\n);\n\nvar_dump($subscription);",
|
|
623
627
|
},
|
|
624
628
|
csharp: {
|
|
625
629
|
method: 'Subscriptions.Create',
|
|
@@ -639,8 +643,8 @@ const EMBEDDED_METHODS = [
|
|
|
639
643
|
stainlessPath: '(resource) subscriptions > (method) retrieve',
|
|
640
644
|
qualified: 'client.subscriptions.retrieve',
|
|
641
645
|
params: ['subscription_id: string;'],
|
|
642
|
-
response:
|
|
643
|
-
markdown: "## retrieve\n\n`client.subscriptions.retrieve(subscription_id: string): { addons: addon_cart_response_item[]; billing: billing_address; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; metadata: object; 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[]; discount_cycles_remaining?: number; discount_id?: string; discounts?:
|
|
646
|
+
response: "{ addons: object[]; billing: object; 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; }",
|
|
647
|
+
markdown: "## retrieve\n\n`client.subscriptions.retrieve(subscription_id: string): { addons: addon_cart_response_item[]; billing: billing_address; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; metadata: object; 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; }; 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?: object; 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: object; 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 - `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('subscription_id');\n\nconsole.log(subscription);\n```",
|
|
644
648
|
perLanguage: {
|
|
645
649
|
typescript: {
|
|
646
650
|
method: 'client.subscriptions.retrieve',
|
|
@@ -699,6 +703,7 @@ const EMBEDDED_METHODS = [
|
|
|
699
703
|
'cancellation_comment?: string;',
|
|
700
704
|
'cancellation_feedback?: string;',
|
|
701
705
|
"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'; }[];",
|
|
706
|
+
'customer_business_name?: string;',
|
|
702
707
|
'customer_name?: string;',
|
|
703
708
|
'disable_on_demand?: { next_billing_date: string; };',
|
|
704
709
|
'metadata?: object;',
|
|
@@ -706,8 +711,8 @@ const EMBEDDED_METHODS = [
|
|
|
706
711
|
"status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';",
|
|
707
712
|
'tax_id?: string;',
|
|
708
713
|
],
|
|
709
|
-
response:
|
|
710
|
-
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_name?: string, disable_on_demand?: { next_billing_date: string; }, metadata?: object, next_billing_date?: string, status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired', tax_id?: string): { addons: addon_cart_response_item[]; billing: billing_address; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; metadata: object; 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[]; discount_cycles_remaining?: number; discount_id?: string; discounts?:
|
|
714
|
+
response: "{ addons: object[]; billing: object; 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; }",
|
|
715
|
+
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', tax_id?: string): { addons: addon_cart_response_item[]; billing: billing_address; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; metadata: object; 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\n- `next_billing_date?: string`\n\n- `status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired'`\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; }; 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?: object; 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: object; 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 - `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('subscription_id');\n\nconsole.log(subscription);\n```",
|
|
711
716
|
perLanguage: {
|
|
712
717
|
typescript: {
|
|
713
718
|
method: 'client.subscriptions.update',
|
|
@@ -739,7 +744,7 @@ const EMBEDDED_METHODS = [
|
|
|
739
744
|
},
|
|
740
745
|
php: {
|
|
741
746
|
method: 'subscriptions->update',
|
|
742
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$subscription = $client->subscriptions->update(\n 'subscription_id',\n billing: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n cancelAtNextBillingDate: true,\n cancelReason: 'cancelled_by_customer',\n cancellationComment: 'cancellation_comment',\n cancellationFeedback: CancellationFeedback::TOO_EXPENSIVE,\n creditEntitlementCart: [\n [\n 'creditEntitlementID' => 'credit_entitlement_id',\n 'creditsAmount' => 'credits_amount',\n 'expiresAfterDays' => 0,\n 'lowBalanceThresholdPercent' => 0,\n 'maxRolloverCount' => 0,\n 'overageEnabled' => true,\n 'overageLimit' => 'overage_limit',\n 'rolloverEnabled' => true,\n 'rolloverPercentage' => 0,\n 'rolloverTimeframeCount' => 0,\n 'rolloverTimeframeInterval' => TimeInterval::DAY,\n ],\n ],\n customerName: 'customer_name',\n disableOnDemand: [\n 'nextBillingDate' => new \\DateTimeImmutable('2019-12-27T18:11:19.117Z')\n ],\n metadata: ['foo' => 'string'],\n nextBillingDate: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n status: SubscriptionStatus::PENDING,\n taxID: 'tax_id',\n);\n\nvar_dump($subscription);",
|
|
747
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$subscription = $client->subscriptions->update(\n 'subscription_id',\n billing: [\n 'country' => CountryCode::AF,\n 'city' => 'city',\n 'state' => 'state',\n 'street' => 'street',\n 'zipcode' => 'zipcode',\n ],\n cancelAtNextBillingDate: true,\n cancelReason: 'cancelled_by_customer',\n cancellationComment: 'cancellation_comment',\n cancellationFeedback: CancellationFeedback::TOO_EXPENSIVE,\n creditEntitlementCart: [\n [\n 'creditEntitlementID' => 'credit_entitlement_id',\n 'creditsAmount' => 'credits_amount',\n 'expiresAfterDays' => 0,\n 'lowBalanceThresholdPercent' => 0,\n 'maxRolloverCount' => 0,\n 'overageEnabled' => true,\n 'overageLimit' => 'overage_limit',\n 'rolloverEnabled' => true,\n 'rolloverPercentage' => 0,\n 'rolloverTimeframeCount' => 0,\n 'rolloverTimeframeInterval' => TimeInterval::DAY,\n ],\n ],\n customerBusinessName: 'customer_business_name',\n customerName: 'customer_name',\n disableOnDemand: [\n 'nextBillingDate' => new \\DateTimeImmutable('2019-12-27T18:11:19.117Z')\n ],\n metadata: ['foo' => 'string'],\n nextBillingDate: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n status: SubscriptionStatus::PENDING,\n taxID: 'tax_id',\n);\n\nvar_dump($subscription);",
|
|
743
748
|
},
|
|
744
749
|
csharp: {
|
|
745
750
|
method: 'Subscriptions.Update',
|
|
@@ -945,48 +950,49 @@ const EMBEDDED_METHODS = [
|
|
|
945
950
|
qualified: 'client.subscriptions.updatePaymentMethod',
|
|
946
951
|
params: [
|
|
947
952
|
'subscription_id: string;',
|
|
948
|
-
"
|
|
953
|
+
"payment_method: { type: 'new'; return_url?: string; } | { payment_method_id: string; type: 'existing'; };",
|
|
949
954
|
],
|
|
950
955
|
response: '{ client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }',
|
|
956
|
+
markdown: "## update_payment_method\n\n`client.subscriptions.updatePaymentMethod(subscription_id: string, payment_method: { type: 'new'; return_url?: string; } | { payment_method_id: string; type: 'existing'; }): { client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }`\n\n**post** `/subscriptions/{subscription_id}/update-payment-method`\n\n### Parameters\n\n- `subscription_id: string`\n\n- `payment_method: { type: 'new'; return_url?: string; } | { payment_method_id: string; type: 'existing'; }`\n\n### Returns\n\n- `{ client_secret?: string; expires_on?: string; payment_id?: string; payment_link?: string; }`\n\n - `client_secret?: string`\n - `expires_on?: string`\n - `payment_id?: string`\n - `payment_link?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.subscriptions.updatePaymentMethod('subscription_id', { payment_method: { type: 'new' } });\n\nconsole.log(response);\n```",
|
|
951
957
|
perLanguage: {
|
|
952
958
|
typescript: {
|
|
953
959
|
method: 'client.subscriptions.updatePaymentMethod',
|
|
954
|
-
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.subscriptions.updatePaymentMethod('subscription_id', { type: 'new' });\n\nconsole.log(response.payment_id);",
|
|
960
|
+
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.subscriptions.updatePaymentMethod('subscription_id', {\n payment_method: { type: 'new' },\n});\n\nconsole.log(response.payment_id);",
|
|
955
961
|
},
|
|
956
962
|
python: {
|
|
957
963
|
method: 'subscriptions.update_payment_method',
|
|
958
|
-
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.subscriptions.update_payment_method(\n subscription_id="subscription_id",\n
|
|
964
|
+
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.subscriptions.update_payment_method(\n subscription_id="subscription_id",\n payment_method={\n "type": "new"\n },\n)\nprint(response.payment_id)',
|
|
959
965
|
},
|
|
960
966
|
java: {
|
|
961
967
|
method: 'subscriptions().updatePaymentMethod',
|
|
962
|
-
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.subscriptions.SubscriptionUpdatePaymentMethodParams;\nimport com.dodopayments.api.models.subscriptions.SubscriptionUpdatePaymentMethodResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n SubscriptionUpdatePaymentMethodParams params = SubscriptionUpdatePaymentMethodParams.builder()\n .subscriptionId("subscription_id")\n .
|
|
968
|
+
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.subscriptions.SubscriptionUpdatePaymentMethodParams;\nimport com.dodopayments.api.models.subscriptions.SubscriptionUpdatePaymentMethodResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n SubscriptionUpdatePaymentMethodParams params = SubscriptionUpdatePaymentMethodParams.builder()\n .subscriptionId("subscription_id")\n .paymentMethod(SubscriptionUpdatePaymentMethodParams.PaymentMethod.New.builder().build())\n .build();\n SubscriptionUpdatePaymentMethodResponse response = client.subscriptions().updatePaymentMethod(params);\n }\n}',
|
|
963
969
|
},
|
|
964
970
|
kotlin: {
|
|
965
971
|
method: 'subscriptions().updatePaymentMethod',
|
|
966
|
-
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.subscriptions.SubscriptionUpdatePaymentMethodParams\nimport com.dodopayments.api.models.subscriptions.SubscriptionUpdatePaymentMethodResponse\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: SubscriptionUpdatePaymentMethodParams = SubscriptionUpdatePaymentMethodParams.builder()\n .subscriptionId("subscription_id")\n .
|
|
972
|
+
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.subscriptions.SubscriptionUpdatePaymentMethodParams\nimport com.dodopayments.api.models.subscriptions.SubscriptionUpdatePaymentMethodResponse\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: SubscriptionUpdatePaymentMethodParams = SubscriptionUpdatePaymentMethodParams.builder()\n .subscriptionId("subscription_id")\n .paymentMethod(SubscriptionUpdatePaymentMethodParams.PaymentMethod.New.builder().build())\n .build()\n val response: SubscriptionUpdatePaymentMethodResponse = client.subscriptions().updatePaymentMethod(params)\n}',
|
|
967
973
|
},
|
|
968
974
|
go: {
|
|
969
975
|
method: 'client.Subscriptions.UpdatePaymentMethod',
|
|
970
|
-
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.Subscriptions.UpdatePaymentMethod(\n\t\tcontext.TODO(),\n\t\t"subscription_id",\n\t\tdodopayments.SubscriptionUpdatePaymentMethodParams{\n\t\t\
|
|
976
|
+
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.Subscriptions.UpdatePaymentMethod(\n\t\tcontext.TODO(),\n\t\t"subscription_id",\n\t\tdodopayments.SubscriptionUpdatePaymentMethodParams{\n\t\t\tPaymentMethod: dodopayments.SubscriptionUpdatePaymentMethodParamsPaymentMethodNew{\n\t\t\t\tType: dodopayments.F(dodopayments.SubscriptionUpdatePaymentMethodParamsPaymentMethodNewTypeNew),\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.PaymentID)\n}\n',
|
|
971
977
|
},
|
|
972
978
|
ruby: {
|
|
973
979
|
method: 'subscriptions.update_payment_method',
|
|
974
|
-
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\nresponse = dodo_payments.subscriptions.update_payment_method("subscription_id",
|
|
980
|
+
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\nresponse = dodo_payments.subscriptions.update_payment_method("subscription_id", payment_method: {type: :new})\n\nputs(response)',
|
|
975
981
|
},
|
|
976
982
|
cli: {
|
|
977
983
|
method: 'subscriptions update_payment_method',
|
|
978
|
-
example: "dodo-payments-cli subscriptions update-payment-method \\\n --bearer-token 'My Bearer Token' \\\n --subscription-id subscription_id \\\n --
|
|
984
|
+
example: "dodo-payments-cli subscriptions update-payment-method \\\n --bearer-token 'My Bearer Token' \\\n --subscription-id subscription_id \\\n --payment-method '{type: new}'",
|
|
979
985
|
},
|
|
980
986
|
php: {
|
|
981
987
|
method: 'subscriptions->updatePaymentMethod',
|
|
982
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->subscriptions->updatePaymentMethod(\n 'subscription_id',\n
|
|
988
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->subscriptions->updatePaymentMethod(\n 'subscription_id',\n paymentMethod: ['type' => 'new', 'returnURL' => 'return_url'],\n);\n\nvar_dump($response);",
|
|
983
989
|
},
|
|
984
990
|
csharp: {
|
|
985
991
|
method: 'Subscriptions.UpdatePaymentMethod',
|
|
986
|
-
example: 'SubscriptionUpdatePaymentMethodParams parameters = new()\n{\n SubscriptionID = "subscription_id",\n
|
|
992
|
+
example: 'SubscriptionUpdatePaymentMethodParams parameters = new()\n{\n SubscriptionID = "subscription_id",\n PaymentMethod = new New() { ReturnUrl = "return_url" },\n};\n\nvar response = await client.Subscriptions.UpdatePaymentMethod(parameters);\n\nConsole.WriteLine(response);',
|
|
987
993
|
},
|
|
988
994
|
http: {
|
|
989
|
-
example: 'curl https://live.dodopayments.com/subscriptions/$SUBSCRIPTION_ID/update-payment-method \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "type": "new"\n }\'',
|
|
995
|
+
example: 'curl https://live.dodopayments.com/subscriptions/$SUBSCRIPTION_ID/update-payment-method \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "type": "new",\n "return_url": "return_url"\n }\'',
|
|
990
996
|
},
|
|
991
997
|
},
|
|
992
998
|
},
|
|
@@ -1012,7 +1018,7 @@ const EMBEDDED_METHODS = [
|
|
|
1012
1018
|
"on_payment_failure?: 'prevent_change' | 'apply_change';",
|
|
1013
1019
|
],
|
|
1014
1020
|
response: '{ immediate_charge: { effective_at: string; line_items: object | object | object[]; summary: object; }; new_plan: object; }',
|
|
1015
|
-
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; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; metadata: object; 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[]; discount_cycles_remaining?: number; discount_id?: string; discounts?:
|
|
1021
|
+
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; cancel_at_next_billing_date: boolean; created_at: string; credit_entitlement_cart: credit_entitlement_cart_response[]; currency: currency; customer: customer_limited_details; metadata: object; 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; }; 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?: object; 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: object; 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('subscription_id', {\n product_id: 'product_id',\n proration_billing_mode: 'prorated_immediately',\n quantity: 0,\n});\n\nconsole.log(response);\n```",
|
|
1016
1022
|
perLanguage: {
|
|
1017
1023
|
typescript: {
|
|
1018
1024
|
method: 'client.subscriptions.previewChangePlan',
|
|
@@ -1266,6 +1272,59 @@ const EMBEDDED_METHODS = [
|
|
|
1266
1272
|
},
|
|
1267
1273
|
},
|
|
1268
1274
|
},
|
|
1275
|
+
{
|
|
1276
|
+
name: 'retrieve_payout',
|
|
1277
|
+
endpoint: '/invoices/payouts/{payout_id}',
|
|
1278
|
+
httpMethod: 'get',
|
|
1279
|
+
summary: '',
|
|
1280
|
+
description: '',
|
|
1281
|
+
stainlessPath: '(resource) invoices.payments > (method) retrieve_payout',
|
|
1282
|
+
qualified: 'client.invoices.payments.retrievePayout',
|
|
1283
|
+
params: ['payout_id: string;'],
|
|
1284
|
+
response: 'string',
|
|
1285
|
+
markdown: "## retrieve_payout\n\n`client.invoices.payments.retrievePayout(payout_id: string): string`\n\n**get** `/invoices/payouts/{payout_id}`\n\n### Parameters\n\n- `payout_id: string`\n\n### Returns\n\n- `string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.invoices.payments.retrievePayout('payout_id');\n\nconsole.log(response);\n\nconst content = await response.blob()\nconsole.log(content)\n```",
|
|
1286
|
+
perLanguage: {
|
|
1287
|
+
typescript: {
|
|
1288
|
+
method: 'client.invoices.payments.retrievePayout',
|
|
1289
|
+
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.invoices.payments.retrievePayout('payout_id');\n\nconsole.log(response);\n\nconst content = await response.blob();\nconsole.log(content);",
|
|
1290
|
+
},
|
|
1291
|
+
python: {
|
|
1292
|
+
method: 'invoices.payments.retrieve_payout',
|
|
1293
|
+
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.invoices.payments.retrieve_payout(\n "payout_id",\n)\nprint(response)\ncontent = response.read()\nprint(content)',
|
|
1294
|
+
},
|
|
1295
|
+
java: {
|
|
1296
|
+
method: 'invoices().payments().retrievePayout',
|
|
1297
|
+
example: 'package com.dodopayments.api.example;\n\nimport com.dodopayments.api.client.DodoPaymentsClient;\nimport com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;\nimport com.dodopayments.api.core.http.HttpResponse;\nimport com.dodopayments.api.models.invoices.payments.PaymentRetrievePayoutParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n HttpResponse response = client.invoices().payments().retrievePayout("payout_id");\n }\n}',
|
|
1298
|
+
},
|
|
1299
|
+
kotlin: {
|
|
1300
|
+
method: 'invoices().payments().retrievePayout',
|
|
1301
|
+
example: 'package com.dodopayments.api.example\n\nimport com.dodopayments.api.client.DodoPaymentsClient\nimport com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient\nimport com.dodopayments.api.core.http.HttpResponse\nimport com.dodopayments.api.models.invoices.payments.PaymentRetrievePayoutParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val response: HttpResponse = client.invoices().payments().retrievePayout("payout_id")\n}',
|
|
1302
|
+
},
|
|
1303
|
+
go: {
|
|
1304
|
+
method: 'client.Invoices.Payments.GetPayout',
|
|
1305
|
+
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.Invoices.Payments.GetPayout(context.TODO(), "payout_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
1306
|
+
},
|
|
1307
|
+
ruby: {
|
|
1308
|
+
method: 'invoices.payments.retrieve_payout',
|
|
1309
|
+
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\nresponse = dodo_payments.invoices.payments.retrieve_payout("payout_id")\n\nputs(response)',
|
|
1310
|
+
},
|
|
1311
|
+
cli: {
|
|
1312
|
+
method: 'payments retrieve_payout',
|
|
1313
|
+
example: "dodo-payments-cli invoices:payments retrieve-payout \\\n --bearer-token 'My Bearer Token' \\\n --payout-id payout_id",
|
|
1314
|
+
},
|
|
1315
|
+
php: {
|
|
1316
|
+
method: 'invoices->payments->retrievePayout',
|
|
1317
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->invoices->payments->retrievePayout('payout_id');\n\nvar_dump($response);",
|
|
1318
|
+
},
|
|
1319
|
+
csharp: {
|
|
1320
|
+
method: 'Invoices.Payments.RetrievePayout',
|
|
1321
|
+
example: 'PaymentRetrievePayoutParams parameters = new() { PayoutID = "payout_id" };\n\nvar response = await client.Invoices.Payments.RetrievePayout(parameters);\n\nConsole.WriteLine(response);',
|
|
1322
|
+
},
|
|
1323
|
+
http: {
|
|
1324
|
+
example: 'curl https://live.dodopayments.com/invoices/payouts/$PAYOUT_ID \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
1325
|
+
},
|
|
1326
|
+
},
|
|
1327
|
+
},
|
|
1269
1328
|
{
|
|
1270
1329
|
name: 'activate',
|
|
1271
1330
|
endpoint: '/licenses/activate',
|
|
@@ -2988,7 +3047,7 @@ const EMBEDDED_METHODS = [
|
|
|
2988
3047
|
'recurring?: boolean;',
|
|
2989
3048
|
],
|
|
2990
3049
|
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; tax_inclusive?: boolean; }",
|
|
2991
|
-
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: object; product_id: string; tax_category: tax_category; updated_at: string; currency?: currency; description?: string; image?: string; name?: string; price?: number; price_detail?: price; 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; }; tax_inclusive?: boolean; }`\n\n - `business_id: string`\n - `created_at: string`\n - `entitlements: { id: string; integration_config: { permission:
|
|
3050
|
+
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: object; product_id: string; tax_category: tax_category; updated_at: string; currency?: currency; description?: string; image?: string; name?: string; price?: number; price_detail?: price; 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; }; tax_inclusive?: boolean; }`\n\n - `business_id: string`\n - `created_at: string`\n - `entitlements: { id: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; 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 - `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```",
|
|
2992
3051
|
perLanguage: {
|
|
2993
3052
|
typescript: {
|
|
2994
3053
|
method: 'client.products.list',
|
|
@@ -3056,7 +3115,7 @@ const EMBEDDED_METHODS = [
|
|
|
3056
3115
|
'metadata?: object;',
|
|
3057
3116
|
],
|
|
3058
3117
|
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; product_collection_id?: string; }",
|
|
3059
|
-
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): { 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: object; 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; 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 3)\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 20)\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\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### 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; 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: { permission: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; 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 - `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```",
|
|
3118
|
+
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): { 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: object; 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; 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 3)\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 20)\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\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### 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; 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: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; 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 - `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```",
|
|
3060
3119
|
perLanguage: {
|
|
3061
3120
|
typescript: {
|
|
3062
3121
|
method: 'client.products.create',
|
|
@@ -3109,7 +3168,7 @@ const EMBEDDED_METHODS = [
|
|
|
3109
3168
|
qualified: 'client.products.retrieve',
|
|
3110
3169
|
params: ['id: string;'],
|
|
3111
3170
|
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; product_collection_id?: string; }",
|
|
3112
|
-
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: object; 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; 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; 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: { permission:
|
|
3171
|
+
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: object; 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; 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; 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: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; 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 - `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('id');\n\nconsole.log(product);\n```",
|
|
3113
3172
|
perLanguage: {
|
|
3114
3173
|
typescript: {
|
|
3115
3174
|
method: 'client.products.retrieve',
|
|
@@ -5196,8 +5255,8 @@ const EMBEDDED_METHODS = [
|
|
|
5196
5255
|
stainlessPath: '(resource) meters > (method) list',
|
|
5197
5256
|
qualified: 'client.meters.list',
|
|
5198
5257
|
params: ['archived?: boolean;', 'page_number?: number;', 'page_size?: number;'],
|
|
5199
|
-
response: "{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses:
|
|
5200
|
-
markdown: "## list\n\n`client.meters.list(archived?: boolean, page_number?: number, page_size?: number): { id: string; aggregation: meter_aggregation; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: meter_filter; }`\n\n**get** `/meters`\n\n### Parameters\n\n- `archived?: boolean`\n List archived meters\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### Returns\n\n- `{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses:
|
|
5258
|
+
response: "{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses: filter_type; conjunction: conjunction; }; }",
|
|
5259
|
+
markdown: "## list\n\n`client.meters.list(archived?: boolean, page_number?: number, page_size?: number): { id: string; aggregation: meter_aggregation; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: meter_filter; }`\n\n**get** `/meters`\n\n### Parameters\n\n- `archived?: boolean`\n List archived meters\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### Returns\n\n- `{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses: filter_type; conjunction: conjunction; }; }`\n\n - `id: string`\n - `aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }`\n - `business_id: string`\n - `created_at: string`\n - `event_name: string`\n - `measurement_unit: string`\n - `name: string`\n - `updated_at: string`\n - `description?: string`\n - `filter?: { clauses: { key: string; operator: filter_operator; value: string | number | boolean; }[] | object[]; conjunction: 'and' | 'or'; }`\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 meter of client.meters.list()) {\n console.log(meter);\n}\n```",
|
|
5201
5260
|
perLanguage: {
|
|
5202
5261
|
typescript: {
|
|
5203
5262
|
method: 'client.meters.list',
|
|
@@ -5254,10 +5313,10 @@ const EMBEDDED_METHODS = [
|
|
|
5254
5313
|
'measurement_unit: string;',
|
|
5255
5314
|
'name: string;',
|
|
5256
5315
|
'description?: string;',
|
|
5257
|
-
"filter?: { clauses: { key: string; operator:
|
|
5316
|
+
"filter?: { clauses: { key: string; operator: filter_operator; value: string | number | boolean; }[] | object[]; conjunction: 'and' | 'or'; };",
|
|
5258
5317
|
],
|
|
5259
|
-
response: "{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses:
|
|
5260
|
-
markdown: "## create\n\n`client.meters.create(aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }, event_name: string, measurement_unit: string, name: string, description?: string, filter?: { clauses:
|
|
5318
|
+
response: "{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses: filter_type; conjunction: conjunction; }; }",
|
|
5319
|
+
markdown: "## create\n\n`client.meters.create(aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }, event_name: string, measurement_unit: string, name: string, description?: string, filter?: { clauses: filter_type; conjunction: conjunction; }): { id: string; aggregation: meter_aggregation; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: meter_filter; }`\n\n**post** `/meters`\n\n### Parameters\n\n- `aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }`\n Aggregation configuration for the meter\n - `type: 'count' | 'sum' | 'max' | 'last'`\n Aggregation type for the meter\n - `key?: string`\n Required when type is not COUNT\n\n- `event_name: string`\n Event name to track\n\n- `measurement_unit: string`\n measurement unit\n\n- `name: string`\n Name of the meter\n\n- `description?: string`\n Optional description of the meter\n\n- `filter?: { clauses: { key: string; operator: filter_operator; value: string | number | boolean; }[] | object[]; conjunction: 'and' | 'or'; }`\n Optional filter to apply to the meter\n - `clauses: { key: string; operator: string; value: string | number | boolean; }[] | { clauses: object[] | meter_filter[]; conjunction: 'and' | 'or'; }[]`\n Filter clauses - can be direct conditions or nested filters (up to 3 levels deep)\n - `conjunction: 'and' | 'or'`\n Logical conjunction to apply between clauses (and/or)\n\n### Returns\n\n- `{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses: filter_type; conjunction: conjunction; }; }`\n\n - `id: string`\n - `aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }`\n - `business_id: string`\n - `created_at: string`\n - `event_name: string`\n - `measurement_unit: string`\n - `name: string`\n - `updated_at: string`\n - `description?: string`\n - `filter?: { clauses: { key: string; operator: filter_operator; value: string | number | boolean; }[] | object[]; conjunction: 'and' | 'or'; }`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst meter = await client.meters.create({\n aggregation: { type: 'count' },\n event_name: 'event_name',\n measurement_unit: 'measurement_unit',\n name: 'name',\n});\n\nconsole.log(meter);\n```",
|
|
5261
5320
|
perLanguage: {
|
|
5262
5321
|
typescript: {
|
|
5263
5322
|
method: 'client.meters.create',
|
|
@@ -5309,8 +5368,8 @@ const EMBEDDED_METHODS = [
|
|
|
5309
5368
|
stainlessPath: '(resource) meters > (method) retrieve',
|
|
5310
5369
|
qualified: 'client.meters.retrieve',
|
|
5311
5370
|
params: ['id: string;'],
|
|
5312
|
-
response: "{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses:
|
|
5313
|
-
markdown: "## retrieve\n\n`client.meters.retrieve(id: string): { id: string; aggregation: meter_aggregation; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: meter_filter; }`\n\n**get** `/meters/{id}`\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses:
|
|
5371
|
+
response: "{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses: filter_type; conjunction: conjunction; }; }",
|
|
5372
|
+
markdown: "## retrieve\n\n`client.meters.retrieve(id: string): { id: string; aggregation: meter_aggregation; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: meter_filter; }`\n\n**get** `/meters/{id}`\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }; business_id: string; created_at: string; event_name: string; measurement_unit: string; name: string; updated_at: string; description?: string; filter?: { clauses: filter_type; conjunction: conjunction; }; }`\n\n - `id: string`\n - `aggregation: { type: 'count' | 'sum' | 'max' | 'last'; key?: string; }`\n - `business_id: string`\n - `created_at: string`\n - `event_name: string`\n - `measurement_unit: string`\n - `name: string`\n - `updated_at: string`\n - `description?: string`\n - `filter?: { clauses: { key: string; operator: filter_operator; value: string | number | boolean; }[] | object[]; conjunction: 'and' | 'or'; }`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst meter = await client.meters.retrieve('id');\n\nconsole.log(meter);\n```",
|
|
5314
5373
|
perLanguage: {
|
|
5315
5374
|
typescript: {
|
|
5316
5375
|
method: 'client.meters.retrieve',
|
|
@@ -6172,8 +6231,8 @@ const EMBEDDED_METHODS = [
|
|
|
6172
6231
|
'page_number?: number;',
|
|
6173
6232
|
'page_size?: number;',
|
|
6174
6233
|
],
|
|
6175
|
-
response: "{ id: string; business_id: string; created_at: string; integration_config: { permission:
|
|
6176
|
-
markdown: "## list\n\n`client.entitlements.list(integration_type?: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key', page_number?: number, page_size?: number): { id: string; business_id: string; created_at: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n\n**get** `/entitlements`\n\nGET /entitlements\n\n### Parameters\n\n- `integration_type?: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'`\n Filter by integration 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### Returns\n\n- `{ id: string; business_id: string; created_at: string; integration_config: { permission:
|
|
6234
|
+
response: "{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }",
|
|
6235
|
+
markdown: "## list\n\n`client.entitlements.list(integration_type?: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key', page_number?: number, page_size?: number): { id: string; business_id: string; created_at: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n\n**get** `/entitlements`\n\nGET /entitlements\n\n### Parameters\n\n- `integration_type?: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'`\n Filter by integration 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### Returns\n\n- `{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n Detailed view of a single entitlement: identity, integration type,\nintegration-specific configuration, and metadata.\n\n - `id: string`\n - `business_id: string`\n - `created_at: string`\n - `integration_config: { permission: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; 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: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'`\n - `is_active: boolean`\n - `metadata: object`\n - `name: string`\n - `updated_at: string`\n - `description?: 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 entitlement of client.entitlements.list()) {\n console.log(entitlement);\n}\n```",
|
|
6177
6236
|
perLanguage: {
|
|
6178
6237
|
typescript: {
|
|
6179
6238
|
method: 'client.entitlements.list',
|
|
@@ -6231,8 +6290,8 @@ const EMBEDDED_METHODS = [
|
|
|
6231
6290
|
'description?: string;',
|
|
6232
6291
|
'metadata?: object;',
|
|
6233
6292
|
],
|
|
6234
|
-
response: "{ id: string; business_id: string; created_at: string; integration_config: { permission:
|
|
6235
|
-
markdown: "## create\n\n`client.entitlements.create(integration_config: { permission:
|
|
6293
|
+
response: "{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }",
|
|
6294
|
+
markdown: "## create\n\n`client.entitlements.create(integration_config: { 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_file_ids: string[]; external_url?: string; instructions?: string; legacy_file_ids?: string[]; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; }, integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key', name: string, description?: string, metadata?: object): { id: string; business_id: string; created_at: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n\n**post** `/entitlements`\n\nPOST /entitlements\n\n### Parameters\n\n- `integration_config: { permission: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; 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_file_ids: string[]; external_url?: string; instructions?: string; legacy_file_ids?: string[]; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }`\n Platform-specific configuration (validated per integration_type)\n\n- `integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'`\n Which platform integration this entitlement uses\n\n- `name: string`\n Display name for this entitlement\n\n- `description?: string`\n Optional description\n\n- `metadata?: object`\n Additional metadata for the entitlement\n\n### Returns\n\n- `{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n Detailed view of a single entitlement: identity, integration type,\nintegration-specific configuration, and metadata.\n\n - `id: string`\n - `business_id: string`\n - `created_at: string`\n - `integration_config: { permission: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; 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: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'`\n - `is_active: boolean`\n - `metadata: object`\n - `name: string`\n - `updated_at: string`\n - `description?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst entitlement = await client.entitlements.create({\n integration_config: { permission: 'pull', target_id: 'target_id' },\n integration_type: 'discord',\n name: 'name',\n});\n\nconsole.log(entitlement);\n```",
|
|
6236
6295
|
perLanguage: {
|
|
6237
6296
|
typescript: {
|
|
6238
6297
|
method: 'client.entitlements.create',
|
|
@@ -6244,15 +6303,15 @@ const EMBEDDED_METHODS = [
|
|
|
6244
6303
|
},
|
|
6245
6304
|
java: {
|
|
6246
6305
|
method: 'entitlements().create',
|
|
6247
|
-
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.entitlements.Entitlement;\nimport com.dodopayments.api.models.entitlements.EntitlementCreateParams;\nimport com.dodopayments.api.models.entitlements.EntitlementIntegrationType;\nimport com.dodopayments.api.models.entitlements.IntegrationConfig;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n EntitlementCreateParams params = EntitlementCreateParams.builder()\n .integrationConfig(IntegrationConfig.GitHubConfig.builder()\n .permission(
|
|
6306
|
+
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.entitlements.Entitlement;\nimport com.dodopayments.api.models.entitlements.EntitlementCreateParams;\nimport com.dodopayments.api.models.entitlements.EntitlementIntegrationType;\nimport com.dodopayments.api.models.entitlements.GitHubPermission;\nimport com.dodopayments.api.models.entitlements.IntegrationConfig;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n EntitlementCreateParams params = EntitlementCreateParams.builder()\n .integrationConfig(IntegrationConfig.GitHubConfig.builder()\n .permission(GitHubPermission.PULL)\n .targetId("target_id")\n .build())\n .integrationType(EntitlementIntegrationType.DISCORD)\n .name("name")\n .build();\n Entitlement entitlement = client.entitlements().create(params);\n }\n}',
|
|
6248
6307
|
},
|
|
6249
6308
|
kotlin: {
|
|
6250
6309
|
method: 'entitlements().create',
|
|
6251
|
-
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.entitlements.Entitlement\nimport com.dodopayments.api.models.entitlements.EntitlementCreateParams\nimport com.dodopayments.api.models.entitlements.EntitlementIntegrationType\nimport com.dodopayments.api.models.entitlements.IntegrationConfig\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: EntitlementCreateParams = EntitlementCreateParams.builder()\n .integrationConfig(IntegrationConfig.GitHubConfig.builder()\n .permission(
|
|
6310
|
+
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.entitlements.Entitlement\nimport com.dodopayments.api.models.entitlements.EntitlementCreateParams\nimport com.dodopayments.api.models.entitlements.EntitlementIntegrationType\nimport com.dodopayments.api.models.entitlements.GitHubPermission\nimport com.dodopayments.api.models.entitlements.IntegrationConfig\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: EntitlementCreateParams = EntitlementCreateParams.builder()\n .integrationConfig(IntegrationConfig.GitHubConfig.builder()\n .permission(GitHubPermission.PULL)\n .targetId("target_id")\n .build())\n .integrationType(EntitlementIntegrationType.DISCORD)\n .name("name")\n .build()\n val entitlement: Entitlement = client.entitlements().create(params)\n}',
|
|
6252
6311
|
},
|
|
6253
6312
|
go: {
|
|
6254
6313
|
method: 'client.Entitlements.New',
|
|
6255
|
-
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\tentitlement, err := client.Entitlements.New(context.TODO(), dodopayments.EntitlementNewParams{\n\t\tIntegrationConfig: dodopayments.F[dodopayments.IntegrationConfigUnionParam](dodopayments.IntegrationConfigGitHubConfigParam{\n\t\t\tPermission: dodopayments.F(dodopayments.
|
|
6314
|
+
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\tentitlement, err := client.Entitlements.New(context.TODO(), dodopayments.EntitlementNewParams{\n\t\tIntegrationConfig: dodopayments.F[dodopayments.IntegrationConfigUnionParam](dodopayments.IntegrationConfigGitHubConfigParam{\n\t\t\tPermission: dodopayments.F(dodopayments.GitHubPermissionPull),\n\t\t\tTargetID: dodopayments.F("target_id"),\n\t\t}),\n\t\tIntegrationType: dodopayments.F(dodopayments.EntitlementIntegrationTypeDiscord),\n\t\tName: dodopayments.F("name"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", entitlement.ID)\n}\n',
|
|
6256
6315
|
},
|
|
6257
6316
|
ruby: {
|
|
6258
6317
|
method: 'entitlements.create',
|
|
@@ -6264,11 +6323,11 @@ const EMBEDDED_METHODS = [
|
|
|
6264
6323
|
},
|
|
6265
6324
|
php: {
|
|
6266
6325
|
method: 'entitlements->create',
|
|
6267
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$entitlement = $client->entitlements->create(\n integrationConfig: ['permission' =>
|
|
6326
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$entitlement = $client->entitlements->create(\n integrationConfig: [\n 'permission' => GitHubPermission::PULL, 'targetID' => 'target_id'\n ],\n integrationType: EntitlementIntegrationType::DISCORD,\n name: 'name',\n description: 'description',\n metadata: ['foo' => 'string'],\n);\n\nvar_dump($entitlement);",
|
|
6268
6327
|
},
|
|
6269
6328
|
csharp: {
|
|
6270
6329
|
method: 'Entitlements.Create',
|
|
6271
|
-
example: 'EntitlementCreateParams parameters = new()\n{\n IntegrationConfig = new GitHubConfig()\n {\n Permission =
|
|
6330
|
+
example: 'EntitlementCreateParams parameters = new()\n{\n IntegrationConfig = new GitHubConfig()\n {\n Permission = GitHubPermission.Pull,\n TargetID = "target_id",\n },\n IntegrationType = EntitlementIntegrationType.Discord,\n Name = "name",\n};\n\nvar entitlement = await client.Entitlements.Create(parameters);\n\nConsole.WriteLine(entitlement);',
|
|
6272
6331
|
},
|
|
6273
6332
|
http: {
|
|
6274
6333
|
example: 'curl https://live.dodopayments.com/entitlements \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "integration_config": {\n "permission": "pull",\n "target_id": "target_id"\n },\n "integration_type": "discord",\n "name": "name"\n }\'',
|
|
@@ -6284,8 +6343,8 @@ const EMBEDDED_METHODS = [
|
|
|
6284
6343
|
stainlessPath: '(resource) entitlements > (method) retrieve',
|
|
6285
6344
|
qualified: 'client.entitlements.retrieve',
|
|
6286
6345
|
params: ['id: string;'],
|
|
6287
|
-
response: "{ id: string; business_id: string; created_at: string; integration_config: { permission:
|
|
6288
|
-
markdown: "## retrieve\n\n`client.entitlements.retrieve(id: string): { id: string; business_id: string; created_at: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n\n**get** `/entitlements/{id}`\n\nGET /entitlements/{id}\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; business_id: string; created_at: string; integration_config: { permission:
|
|
6346
|
+
response: "{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }",
|
|
6347
|
+
markdown: "## retrieve\n\n`client.entitlements.retrieve(id: string): { id: string; business_id: string; created_at: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n\n**get** `/entitlements/{id}`\n\nGET /entitlements/{id}\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n Detailed view of a single entitlement: identity, integration type,\nintegration-specific configuration, and metadata.\n\n - `id: string`\n - `business_id: string`\n - `created_at: string`\n - `integration_config: { permission: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; 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: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'`\n - `is_active: boolean`\n - `metadata: object`\n - `name: string`\n - `updated_at: string`\n - `description?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst entitlement = await client.entitlements.retrieve('id');\n\nconsole.log(entitlement);\n```",
|
|
6289
6348
|
perLanguage: {
|
|
6290
6349
|
typescript: {
|
|
6291
6350
|
method: 'client.entitlements.retrieve',
|
|
@@ -6395,8 +6454,8 @@ const EMBEDDED_METHODS = [
|
|
|
6395
6454
|
'metadata?: object;',
|
|
6396
6455
|
'name?: string;',
|
|
6397
6456
|
],
|
|
6398
|
-
response: "{ id: string; business_id: string; created_at: string; integration_config: { permission:
|
|
6399
|
-
markdown: "## update\n\n`client.entitlements.update(id: string, description?: string, integration_config?: { permission:
|
|
6457
|
+
response: "{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }",
|
|
6458
|
+
markdown: "## update\n\n`client.entitlements.update(id: string, description?: string, integration_config?: { 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_file_ids: string[]; external_url?: string; instructions?: string; legacy_file_ids?: string[]; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: time_interval; }, metadata?: object, name?: string): { id: string; business_id: string; created_at: string; integration_config: integration_config_response; integration_type: entitlement_integration_type; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n\n**patch** `/entitlements/{id}`\n\nPATCH /entitlements/{id}\n\n### Parameters\n\n- `id: string`\n\n- `description?: string`\n\n- `integration_config?: { permission: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; 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_file_ids: string[]; external_url?: string; instructions?: string; legacy_file_ids?: string[]; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }`\n Integration-specific configuration supplied when creating or updating\nan entitlement. The shape required matches the entitlement's\n`integration_type`.\n\n- `metadata?: object`\n\n- `name?: string`\n\n### Returns\n\n- `{ id: string; business_id: string; created_at: string; integration_config: { 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; }; integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'; is_active: boolean; metadata: object; name: string; updated_at: string; description?: string; }`\n Detailed view of a single entitlement: identity, integration type,\nintegration-specific configuration, and metadata.\n\n - `id: string`\n - `business_id: string`\n - `created_at: string`\n - `integration_config: { permission: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; 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: { files: { download_url: string; expires_in: number; file_id: string; filename: string; content_type?: string; file_size?: number; }[]; external_url?: string; instructions?: string; }; } | { activation_message?: string; activations_limit?: number; duration_count?: number; duration_interval?: 'Day' | 'Week' | 'Month' | 'Year'; }`\n - `integration_type: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key'`\n - `is_active: boolean`\n - `metadata: object`\n - `name: string`\n - `updated_at: string`\n - `description?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst entitlement = await client.entitlements.update('id');\n\nconsole.log(entitlement);\n```",
|
|
6400
6459
|
perLanguage: {
|
|
6401
6460
|
typescript: {
|
|
6402
6461
|
method: 'client.entitlements.update',
|
|
@@ -6428,7 +6487,7 @@ const EMBEDDED_METHODS = [
|
|
|
6428
6487
|
},
|
|
6429
6488
|
php: {
|
|
6430
6489
|
method: 'entitlements->update',
|
|
6431
|
-
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$entitlement = $client->entitlements->update(\n 'id',\n description: 'description',\n integrationConfig: ['permission' =>
|
|
6490
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$entitlement = $client->entitlements->update(\n 'id',\n description: 'description',\n integrationConfig: [\n 'permission' => GitHubPermission::PULL, 'targetID' => 'target_id'\n ],\n metadata: ['foo' => 'string'],\n name: 'name',\n);\n\nvar_dump($entitlement);",
|
|
6432
6491
|
},
|
|
6433
6492
|
csharp: {
|
|
6434
6493
|
method: 'Entitlements.Update',
|
|
@@ -6656,15 +6715,721 @@ const EMBEDDED_METHODS = [
|
|
|
6656
6715
|
},
|
|
6657
6716
|
},
|
|
6658
6717
|
},
|
|
6718
|
+
{
|
|
6719
|
+
name: 'list',
|
|
6720
|
+
endpoint: '/product-collections',
|
|
6721
|
+
httpMethod: 'get',
|
|
6722
|
+
summary: '',
|
|
6723
|
+
description: '',
|
|
6724
|
+
stainlessPath: '(resource) product_collections > (method) list',
|
|
6725
|
+
qualified: 'client.productCollections.list',
|
|
6726
|
+
params: ['archived?: boolean;', 'brand_id?: string;', 'page_number?: number;', 'page_size?: number;'],
|
|
6727
|
+
response: '{ id: string; created_at: string; name: string; products_count: number; updated_at: string; description?: string; image?: string; }',
|
|
6728
|
+
markdown: "## list\n\n`client.productCollections.list(archived?: boolean, brand_id?: string, page_number?: number, page_size?: number): { id: string; created_at: string; name: string; products_count: number; updated_at: string; description?: string; image?: string; }`\n\n**get** `/product-collections`\n\n### Parameters\n\n- `archived?: boolean`\n List archived collections\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### Returns\n\n- `{ id: string; created_at: string; name: string; products_count: number; updated_at: string; description?: string; image?: string; }`\n\n - `id: string`\n - `created_at: string`\n - `name: string`\n - `products_count: number`\n - `updated_at: string`\n - `description?: string`\n - `image?: 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 productCollectionListResponse of client.productCollections.list()) {\n console.log(productCollectionListResponse);\n}\n```",
|
|
6729
|
+
perLanguage: {
|
|
6730
|
+
typescript: {
|
|
6731
|
+
method: 'client.productCollections.list',
|
|
6732
|
+
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\n// Automatically fetches more pages as needed.\nfor await (const productCollectionListResponse of client.productCollections.list()) {\n console.log(productCollectionListResponse.id);\n}",
|
|
6733
|
+
},
|
|
6734
|
+
python: {
|
|
6735
|
+
method: 'product_collections.list',
|
|
6736
|
+
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)\npage = client.product_collections.list()\npage = page.items[0]\nprint(page.id)',
|
|
6737
|
+
},
|
|
6738
|
+
java: {
|
|
6739
|
+
method: 'productCollections().list',
|
|
6740
|
+
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.productcollections.ProductCollectionListPage;\nimport com.dodopayments.api.models.productcollections.ProductCollectionListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ProductCollectionListPage page = client.productCollections().list();\n }\n}',
|
|
6741
|
+
},
|
|
6742
|
+
kotlin: {
|
|
6743
|
+
method: 'productCollections().list',
|
|
6744
|
+
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.productcollections.ProductCollectionListPage\nimport com.dodopayments.api.models.productcollections.ProductCollectionListParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val page: ProductCollectionListPage = client.productCollections().list()\n}',
|
|
6745
|
+
},
|
|
6746
|
+
go: {
|
|
6747
|
+
method: 'client.ProductCollections.List',
|
|
6748
|
+
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\tpage, err := client.ProductCollections.List(context.TODO(), dodopayments.ProductCollectionListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
6749
|
+
},
|
|
6750
|
+
ruby: {
|
|
6751
|
+
method: 'product_collections.list',
|
|
6752
|
+
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\npage = dodo_payments.product_collections.list\n\nputs(page)',
|
|
6753
|
+
},
|
|
6754
|
+
cli: {
|
|
6755
|
+
method: 'product_collections list',
|
|
6756
|
+
example: "dodo-payments-cli product-collections list \\\n --bearer-token 'My Bearer Token'",
|
|
6757
|
+
},
|
|
6758
|
+
php: {
|
|
6759
|
+
method: 'productCollections->list',
|
|
6760
|
+
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->productCollections->list(\n archived: true, brandID: 'brand_id', pageNumber: 0, pageSize: 0\n);\n\nvar_dump($page);",
|
|
6761
|
+
},
|
|
6762
|
+
csharp: {
|
|
6763
|
+
method: 'ProductCollections.List',
|
|
6764
|
+
example: 'ProductCollectionListParams parameters = new();\n\nvar page = await client.ProductCollections.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
6765
|
+
},
|
|
6766
|
+
http: {
|
|
6767
|
+
example: 'curl https://live.dodopayments.com/product-collections \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
6768
|
+
},
|
|
6769
|
+
},
|
|
6770
|
+
},
|
|
6771
|
+
{
|
|
6772
|
+
name: 'create',
|
|
6773
|
+
endpoint: '/product-collections',
|
|
6774
|
+
httpMethod: 'post',
|
|
6775
|
+
summary: '',
|
|
6776
|
+
description: '',
|
|
6777
|
+
stainlessPath: '(resource) product_collections > (method) create',
|
|
6778
|
+
qualified: 'client.productCollections.create',
|
|
6779
|
+
params: [
|
|
6780
|
+
'groups: { products: { product_id: string; status?: boolean; }[]; group_name?: string; status?: boolean; }[];',
|
|
6781
|
+
'name: string;',
|
|
6782
|
+
'brand_id?: string;',
|
|
6783
|
+
'description?: string;',
|
|
6784
|
+
],
|
|
6785
|
+
response: '{ id: string; brand_id: string; created_at: string; groups: { group_id: string; products: product_collection_product[]; status: boolean; group_name?: string; }[]; name: string; updated_at: string; description?: string; image?: string; }',
|
|
6786
|
+
markdown: "## create\n\n`client.productCollections.create(groups: { products: group_product[]; group_name?: string; status?: boolean; }[], name: string, brand_id?: string, description?: string): { id: string; brand_id: string; created_at: string; groups: product_collection_group_response[]; name: string; updated_at: string; description?: string; image?: string; }`\n\n**post** `/product-collections`\n\n### Parameters\n\n- `groups: { products: { product_id: string; status?: boolean; }[]; group_name?: string; status?: boolean; }[]`\n Groups of products in this collection\n\n- `name: string`\n Name of the product collection\n\n- `brand_id?: string`\n Brand id for the collection, if not provided will default to primary brand\n\n- `description?: string`\n Optional description of the product collection\n\n### Returns\n\n- `{ id: string; brand_id: string; created_at: string; groups: { group_id: string; products: product_collection_product[]; status: boolean; group_name?: string; }[]; name: string; updated_at: string; description?: string; image?: string; }`\n\n - `id: string`\n - `brand_id: string`\n - `created_at: string`\n - `groups: { 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 - `name: string`\n - `updated_at: string`\n - `description?: string`\n - `image?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst productCollection = await client.productCollections.create({ groups: [{ products: [{ product_id: 'product_id' }] }], name: 'name' });\n\nconsole.log(productCollection);\n```",
|
|
6787
|
+
perLanguage: {
|
|
6788
|
+
typescript: {
|
|
6789
|
+
method: 'client.productCollections.create',
|
|
6790
|
+
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 productCollection = await client.productCollections.create({\n groups: [{ products: [{ product_id: 'product_id' }] }],\n name: 'name',\n});\n\nconsole.log(productCollection.id);",
|
|
6791
|
+
},
|
|
6792
|
+
python: {
|
|
6793
|
+
method: 'product_collections.create',
|
|
6794
|
+
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)\nproduct_collection = client.product_collections.create(\n groups=[{\n "products": [{\n "product_id": "product_id"\n }]\n }],\n name="name",\n)\nprint(product_collection.id)',
|
|
6795
|
+
},
|
|
6796
|
+
java: {
|
|
6797
|
+
method: 'productCollections().create',
|
|
6798
|
+
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.productcollections.ProductCollection;\nimport com.dodopayments.api.models.productcollections.ProductCollectionCreateParams;\nimport com.dodopayments.api.models.productcollections.groups.GroupProduct;\nimport com.dodopayments.api.models.productcollections.groups.ProductCollectionGroupDetails;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ProductCollectionCreateParams params = ProductCollectionCreateParams.builder()\n .addGroup(ProductCollectionGroupDetails.builder()\n .addProduct(GroupProduct.builder()\n .productId("product_id")\n .build())\n .build())\n .name("name")\n .build();\n ProductCollection productCollection = client.productCollections().create(params);\n }\n}',
|
|
6799
|
+
},
|
|
6800
|
+
kotlin: {
|
|
6801
|
+
method: 'productCollections().create',
|
|
6802
|
+
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.productcollections.ProductCollection\nimport com.dodopayments.api.models.productcollections.ProductCollectionCreateParams\nimport com.dodopayments.api.models.productcollections.groups.GroupProduct\nimport com.dodopayments.api.models.productcollections.groups.ProductCollectionGroupDetails\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: ProductCollectionCreateParams = ProductCollectionCreateParams.builder()\n .addGroup(ProductCollectionGroupDetails.builder()\n .addProduct(GroupProduct.builder()\n .productId("product_id")\n .build())\n .build())\n .name("name")\n .build()\n val productCollection: ProductCollection = client.productCollections().create(params)\n}',
|
|
6803
|
+
},
|
|
6804
|
+
go: {
|
|
6805
|
+
method: 'client.ProductCollections.New',
|
|
6806
|
+
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\tproductCollection, err := client.ProductCollections.New(context.TODO(), dodopayments.ProductCollectionNewParams{\n\t\tGroups: dodopayments.F([]dodopayments.ProductCollectionGroupDetailsParam{{\n\t\t\tProducts: dodopayments.F([]dodopayments.GroupProductParam{{\n\t\t\t\tProductID: dodopayments.F("product_id"),\n\t\t\t}}),\n\t\t}}),\n\t\tName: dodopayments.F("name"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", productCollection.ID)\n}\n',
|
|
6807
|
+
},
|
|
6808
|
+
ruby: {
|
|
6809
|
+
method: 'product_collections.create',
|
|
6810
|
+
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\nproduct_collection = dodo_payments.product_collections.create(groups: [{products: [{product_id: "product_id"}]}], name: "name")\n\nputs(product_collection)',
|
|
6811
|
+
},
|
|
6812
|
+
cli: {
|
|
6813
|
+
method: 'product_collections create',
|
|
6814
|
+
example: "dodo-payments-cli product-collections create \\\n --bearer-token 'My Bearer Token' \\\n --group '{products: [{product_id: product_id}]}' \\\n --name name",
|
|
6815
|
+
},
|
|
6816
|
+
php: {
|
|
6817
|
+
method: 'productCollections->create',
|
|
6818
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$productCollection = $client->productCollections->create(\n groups: [\n [\n 'products' => [['productID' => 'product_id', 'status' => true]],\n 'groupName' => 'group_name',\n 'status' => true,\n ],\n ],\n name: 'name',\n brandID: 'brand_id',\n description: 'description',\n);\n\nvar_dump($productCollection);",
|
|
6819
|
+
},
|
|
6820
|
+
csharp: {
|
|
6821
|
+
method: 'ProductCollections.Create',
|
|
6822
|
+
example: 'ProductCollectionCreateParams parameters = new()\n{\n Groups =\n [\n new()\n {\n Products =\n [\n new()\n {\n ProductID = "product_id",\n Status = true,\n },\n ],\n GroupName = "group_name",\n Status = true,\n },\n ],\n Name = "name",\n};\n\nvar productCollection = await client.ProductCollections.Create(parameters);\n\nConsole.WriteLine(productCollection);',
|
|
6823
|
+
},
|
|
6824
|
+
http: {
|
|
6825
|
+
example: 'curl https://live.dodopayments.com/product-collections \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "groups": [\n {\n "products": [\n {\n "product_id": "product_id"\n }\n ]\n }\n ],\n "name": "name"\n }\'',
|
|
6826
|
+
},
|
|
6827
|
+
},
|
|
6828
|
+
},
|
|
6829
|
+
{
|
|
6830
|
+
name: 'retrieve',
|
|
6831
|
+
endpoint: '/product-collections/{id}',
|
|
6832
|
+
httpMethod: 'get',
|
|
6833
|
+
summary: '',
|
|
6834
|
+
description: '',
|
|
6835
|
+
stainlessPath: '(resource) product_collections > (method) retrieve',
|
|
6836
|
+
qualified: 'client.productCollections.retrieve',
|
|
6837
|
+
params: ['id: string;'],
|
|
6838
|
+
response: '{ id: string; brand_id: string; created_at: string; groups: { group_id: string; products: product_collection_product[]; status: boolean; group_name?: string; }[]; name: string; updated_at: string; description?: string; image?: string; }',
|
|
6839
|
+
markdown: "## retrieve\n\n`client.productCollections.retrieve(id: string): { id: string; brand_id: string; created_at: string; groups: product_collection_group_response[]; name: string; updated_at: string; description?: string; image?: string; }`\n\n**get** `/product-collections/{id}`\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; brand_id: string; created_at: string; groups: { group_id: string; products: product_collection_product[]; status: boolean; group_name?: string; }[]; name: string; updated_at: string; description?: string; image?: string; }`\n\n - `id: string`\n - `brand_id: string`\n - `created_at: string`\n - `groups: { 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 - `name: string`\n - `updated_at: string`\n - `description?: string`\n - `image?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst productCollection = await client.productCollections.retrieve('id');\n\nconsole.log(productCollection);\n```",
|
|
6840
|
+
perLanguage: {
|
|
6841
|
+
typescript: {
|
|
6842
|
+
method: 'client.productCollections.retrieve',
|
|
6843
|
+
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 productCollection = await client.productCollections.retrieve('id');\n\nconsole.log(productCollection.id);",
|
|
6844
|
+
},
|
|
6845
|
+
python: {
|
|
6846
|
+
method: 'product_collections.retrieve',
|
|
6847
|
+
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)\nproduct_collection = client.product_collections.retrieve(\n "id",\n)\nprint(product_collection.id)',
|
|
6848
|
+
},
|
|
6849
|
+
java: {
|
|
6850
|
+
method: 'productCollections().retrieve',
|
|
6851
|
+
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.productcollections.ProductCollection;\nimport com.dodopayments.api.models.productcollections.ProductCollectionRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ProductCollection productCollection = client.productCollections().retrieve("id");\n }\n}',
|
|
6852
|
+
},
|
|
6853
|
+
kotlin: {
|
|
6854
|
+
method: 'productCollections().retrieve',
|
|
6855
|
+
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.productcollections.ProductCollection\nimport com.dodopayments.api.models.productcollections.ProductCollectionRetrieveParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val productCollection: ProductCollection = client.productCollections().retrieve("id")\n}',
|
|
6856
|
+
},
|
|
6857
|
+
go: {
|
|
6858
|
+
method: 'client.ProductCollections.Get',
|
|
6859
|
+
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\tproductCollection, err := client.ProductCollections.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", productCollection.ID)\n}\n',
|
|
6860
|
+
},
|
|
6861
|
+
ruby: {
|
|
6862
|
+
method: 'product_collections.retrieve',
|
|
6863
|
+
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\nproduct_collection = dodo_payments.product_collections.retrieve("id")\n\nputs(product_collection)',
|
|
6864
|
+
},
|
|
6865
|
+
cli: {
|
|
6866
|
+
method: 'product_collections retrieve',
|
|
6867
|
+
example: "dodo-payments-cli product-collections retrieve \\\n --bearer-token 'My Bearer Token' \\\n --id id",
|
|
6868
|
+
},
|
|
6869
|
+
php: {
|
|
6870
|
+
method: 'productCollections->retrieve',
|
|
6871
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$productCollection = $client->productCollections->retrieve('id');\n\nvar_dump($productCollection);",
|
|
6872
|
+
},
|
|
6873
|
+
csharp: {
|
|
6874
|
+
method: 'ProductCollections.Retrieve',
|
|
6875
|
+
example: 'ProductCollectionRetrieveParams parameters = new() { ID = "id" };\n\nvar productCollection = await client.ProductCollections.Retrieve(parameters);\n\nConsole.WriteLine(productCollection);',
|
|
6876
|
+
},
|
|
6877
|
+
http: {
|
|
6878
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
6879
|
+
},
|
|
6880
|
+
},
|
|
6881
|
+
},
|
|
6882
|
+
{
|
|
6883
|
+
name: 'delete',
|
|
6884
|
+
endpoint: '/product-collections/{id}',
|
|
6885
|
+
httpMethod: 'delete',
|
|
6886
|
+
summary: '',
|
|
6887
|
+
description: '',
|
|
6888
|
+
stainlessPath: '(resource) product_collections > (method) delete',
|
|
6889
|
+
qualified: 'client.productCollections.delete',
|
|
6890
|
+
params: ['id: string;'],
|
|
6891
|
+
markdown: "## delete\n\n`client.productCollections.delete(id: string): void`\n\n**delete** `/product-collections/{id}`\n\n### Parameters\n\n- `id: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.productCollections.delete('id')\n```",
|
|
6892
|
+
perLanguage: {
|
|
6893
|
+
typescript: {
|
|
6894
|
+
method: 'client.productCollections.delete',
|
|
6895
|
+
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\nawait client.productCollections.delete('id');",
|
|
6896
|
+
},
|
|
6897
|
+
python: {
|
|
6898
|
+
method: 'product_collections.delete',
|
|
6899
|
+
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)\nclient.product_collections.delete(\n "id",\n)',
|
|
6900
|
+
},
|
|
6901
|
+
java: {
|
|
6902
|
+
method: 'productCollections().delete',
|
|
6903
|
+
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.productcollections.ProductCollectionDeleteParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n client.productCollections().delete("id");\n }\n}',
|
|
6904
|
+
},
|
|
6905
|
+
kotlin: {
|
|
6906
|
+
method: 'productCollections().delete',
|
|
6907
|
+
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.productcollections.ProductCollectionDeleteParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n client.productCollections().delete("id")\n}',
|
|
6908
|
+
},
|
|
6909
|
+
go: {
|
|
6910
|
+
method: 'client.ProductCollections.Delete',
|
|
6911
|
+
example: 'package main\n\nimport (\n\t"context"\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\terr := client.ProductCollections.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
6912
|
+
},
|
|
6913
|
+
ruby: {
|
|
6914
|
+
method: 'product_collections.delete',
|
|
6915
|
+
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\nresult = dodo_payments.product_collections.delete("id")\n\nputs(result)',
|
|
6916
|
+
},
|
|
6917
|
+
cli: {
|
|
6918
|
+
method: 'product_collections delete',
|
|
6919
|
+
example: "dodo-payments-cli product-collections delete \\\n --bearer-token 'My Bearer Token' \\\n --id id",
|
|
6920
|
+
},
|
|
6921
|
+
php: {
|
|
6922
|
+
method: 'productCollections->delete',
|
|
6923
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$result = $client->productCollections->delete('id');\n\nvar_dump($result);",
|
|
6924
|
+
},
|
|
6925
|
+
csharp: {
|
|
6926
|
+
method: 'ProductCollections.Delete',
|
|
6927
|
+
example: 'ProductCollectionDeleteParams parameters = new() { ID = "id" };\n\nawait client.ProductCollections.Delete(parameters);',
|
|
6928
|
+
},
|
|
6929
|
+
http: {
|
|
6930
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID \\\n -X DELETE \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
6931
|
+
},
|
|
6932
|
+
},
|
|
6933
|
+
},
|
|
6934
|
+
{
|
|
6935
|
+
name: 'update',
|
|
6936
|
+
endpoint: '/product-collections/{id}',
|
|
6937
|
+
httpMethod: 'patch',
|
|
6938
|
+
summary: '',
|
|
6939
|
+
description: '',
|
|
6940
|
+
stainlessPath: '(resource) product_collections > (method) update',
|
|
6941
|
+
qualified: 'client.productCollections.update',
|
|
6942
|
+
params: [
|
|
6943
|
+
'id: string;',
|
|
6944
|
+
'brand_id?: string;',
|
|
6945
|
+
'description?: string;',
|
|
6946
|
+
'group_order?: string[];',
|
|
6947
|
+
'image_id?: string;',
|
|
6948
|
+
'name?: string;',
|
|
6949
|
+
],
|
|
6950
|
+
markdown: "## update\n\n`client.productCollections.update(id: string, brand_id?: string, description?: string, group_order?: string[], image_id?: string, name?: string): void`\n\n**patch** `/product-collections/{id}`\n\n### Parameters\n\n- `id: string`\n\n- `brand_id?: string`\n Optional brand_id update\n\n- `description?: string`\n Optional description update - pass null to remove, omit to keep unchanged\n\n- `group_order?: string[]`\n Optional new order for groups (array of group UUIDs in desired order)\n\n- `image_id?: string`\n Optional image update - pass null to remove, omit to keep unchanged\n\n- `name?: string`\n Optional new name for the collection\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.productCollections.update('id')\n```",
|
|
6951
|
+
perLanguage: {
|
|
6952
|
+
typescript: {
|
|
6953
|
+
method: 'client.productCollections.update',
|
|
6954
|
+
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\nawait client.productCollections.update('id');",
|
|
6955
|
+
},
|
|
6956
|
+
python: {
|
|
6957
|
+
method: 'product_collections.update',
|
|
6958
|
+
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)\nclient.product_collections.update(\n id="id",\n)',
|
|
6959
|
+
},
|
|
6960
|
+
java: {
|
|
6961
|
+
method: 'productCollections().update',
|
|
6962
|
+
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.productcollections.ProductCollectionUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n client.productCollections().update("id");\n }\n}',
|
|
6963
|
+
},
|
|
6964
|
+
kotlin: {
|
|
6965
|
+
method: 'productCollections().update',
|
|
6966
|
+
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.productcollections.ProductCollectionUpdateParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n client.productCollections().update("id")\n}',
|
|
6967
|
+
},
|
|
6968
|
+
go: {
|
|
6969
|
+
method: 'client.ProductCollections.Update',
|
|
6970
|
+
example: 'package main\n\nimport (\n\t"context"\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\terr := client.ProductCollections.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\tdodopayments.ProductCollectionUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
6971
|
+
},
|
|
6972
|
+
ruby: {
|
|
6973
|
+
method: 'product_collections.update',
|
|
6974
|
+
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\nresult = dodo_payments.product_collections.update("id")\n\nputs(result)',
|
|
6975
|
+
},
|
|
6976
|
+
cli: {
|
|
6977
|
+
method: 'product_collections update',
|
|
6978
|
+
example: "dodo-payments-cli product-collections update \\\n --bearer-token 'My Bearer Token' \\\n --id id",
|
|
6979
|
+
},
|
|
6980
|
+
php: {
|
|
6981
|
+
method: 'productCollections->update',
|
|
6982
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$result = $client->productCollections->update(\n 'id',\n brandID: 'brand_id',\n description: 'description',\n groupOrder: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],\n imageID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n name: 'name',\n);\n\nvar_dump($result);",
|
|
6983
|
+
},
|
|
6984
|
+
csharp: {
|
|
6985
|
+
method: 'ProductCollections.Update',
|
|
6986
|
+
example: 'ProductCollectionUpdateParams parameters = new() { ID = "id" };\n\nawait client.ProductCollections.Update(parameters);',
|
|
6987
|
+
},
|
|
6988
|
+
http: {
|
|
6989
|
+
example: "curl https://live.dodopayments.com/product-collections/$ID \\\n -X PATCH \\\n -H 'Content-Type: application/json' \\\n -H \"Authorization: Bearer $DODO_PAYMENTS_API_KEY\" \\\n -d '{}'",
|
|
6990
|
+
},
|
|
6991
|
+
},
|
|
6992
|
+
},
|
|
6993
|
+
{
|
|
6994
|
+
name: 'update_images',
|
|
6995
|
+
endpoint: '/product-collections/{id}/images',
|
|
6996
|
+
httpMethod: 'put',
|
|
6997
|
+
summary: '',
|
|
6998
|
+
description: '',
|
|
6999
|
+
stainlessPath: '(resource) product_collections > (method) update_images',
|
|
7000
|
+
qualified: 'client.productCollections.updateImages',
|
|
7001
|
+
params: ['id: string;', 'force_update?: boolean;'],
|
|
7002
|
+
response: '{ url: string; image_id?: string; }',
|
|
7003
|
+
markdown: "## update_images\n\n`client.productCollections.updateImages(id: string, force_update?: boolean): { url: string; image_id?: string; }`\n\n**put** `/product-collections/{id}/images`\n\n### Parameters\n\n- `id: string`\n\n- `force_update?: boolean`\n If true, generates a new image ID to force cache invalidation\n\n### Returns\n\n- `{ url: string; image_id?: string; }`\n\n - `url: string`\n - `image_id?: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.productCollections.updateImages('id');\n\nconsole.log(response);\n```",
|
|
7004
|
+
perLanguage: {
|
|
7005
|
+
typescript: {
|
|
7006
|
+
method: 'client.productCollections.updateImages',
|
|
7007
|
+
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.productCollections.updateImages('id');\n\nconsole.log(response.image_id);",
|
|
7008
|
+
},
|
|
7009
|
+
python: {
|
|
7010
|
+
method: 'product_collections.update_images',
|
|
7011
|
+
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.product_collections.update_images(\n id="id",\n)\nprint(response.image_id)',
|
|
7012
|
+
},
|
|
7013
|
+
java: {
|
|
7014
|
+
method: 'productCollections().updateImages',
|
|
7015
|
+
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.productcollections.ProductCollectionUpdateImagesParams;\nimport com.dodopayments.api.models.productcollections.ProductCollectionUpdateImagesResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ProductCollectionUpdateImagesResponse response = client.productCollections().updateImages("id");\n }\n}',
|
|
7016
|
+
},
|
|
7017
|
+
kotlin: {
|
|
7018
|
+
method: 'productCollections().updateImages',
|
|
7019
|
+
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.productcollections.ProductCollectionUpdateImagesParams\nimport com.dodopayments.api.models.productcollections.ProductCollectionUpdateImagesResponse\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val response: ProductCollectionUpdateImagesResponse = client.productCollections().updateImages("id")\n}',
|
|
7020
|
+
},
|
|
7021
|
+
go: {
|
|
7022
|
+
method: 'client.ProductCollections.UpdateImages',
|
|
7023
|
+
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.ProductCollections.UpdateImages(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\tdodopayments.ProductCollectionUpdateImagesParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ImageID)\n}\n',
|
|
7024
|
+
},
|
|
7025
|
+
ruby: {
|
|
7026
|
+
method: 'product_collections.update_images',
|
|
7027
|
+
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\nresponse = dodo_payments.product_collections.update_images("id")\n\nputs(response)',
|
|
7028
|
+
},
|
|
7029
|
+
cli: {
|
|
7030
|
+
method: 'product_collections update_images',
|
|
7031
|
+
example: "dodo-payments-cli product-collections update-images \\\n --bearer-token 'My Bearer Token' \\\n --id id",
|
|
7032
|
+
},
|
|
7033
|
+
php: {
|
|
7034
|
+
method: 'productCollections->updateImages',
|
|
7035
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->productCollections->updateImages('id', forceUpdate: true);\n\nvar_dump($response);",
|
|
7036
|
+
},
|
|
7037
|
+
csharp: {
|
|
7038
|
+
method: 'ProductCollections.UpdateImages',
|
|
7039
|
+
example: 'ProductCollectionUpdateImagesParams parameters = new() { ID = "id" };\n\nvar response = await client.ProductCollections.UpdateImages(parameters);\n\nConsole.WriteLine(response);',
|
|
7040
|
+
},
|
|
7041
|
+
http: {
|
|
7042
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID/images \\\n -X PUT \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
7043
|
+
},
|
|
7044
|
+
},
|
|
7045
|
+
},
|
|
7046
|
+
{
|
|
7047
|
+
name: 'unarchive',
|
|
7048
|
+
endpoint: '/product-collections/{id}/unarchive',
|
|
7049
|
+
httpMethod: 'post',
|
|
7050
|
+
summary: '',
|
|
7051
|
+
description: '',
|
|
7052
|
+
stainlessPath: '(resource) product_collections > (method) unarchive',
|
|
7053
|
+
qualified: 'client.productCollections.unarchive',
|
|
7054
|
+
params: ['id: string;'],
|
|
7055
|
+
response: '{ collection_id: string; excluded_product_ids: string[]; message: string; }',
|
|
7056
|
+
markdown: "## unarchive\n\n`client.productCollections.unarchive(id: string): { collection_id: string; excluded_product_ids: string[]; message: string; }`\n\n**post** `/product-collections/{id}/unarchive`\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ collection_id: string; excluded_product_ids: string[]; message: string; }`\n\n - `collection_id: string`\n - `excluded_product_ids: string[]`\n - `message: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst response = await client.productCollections.unarchive('id');\n\nconsole.log(response);\n```",
|
|
7057
|
+
perLanguage: {
|
|
7058
|
+
typescript: {
|
|
7059
|
+
method: 'client.productCollections.unarchive',
|
|
7060
|
+
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.productCollections.unarchive('id');\n\nconsole.log(response.collection_id);",
|
|
7061
|
+
},
|
|
7062
|
+
python: {
|
|
7063
|
+
method: 'product_collections.unarchive',
|
|
7064
|
+
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.product_collections.unarchive(\n "id",\n)\nprint(response.collection_id)',
|
|
7065
|
+
},
|
|
7066
|
+
java: {
|
|
7067
|
+
method: 'productCollections().unarchive',
|
|
7068
|
+
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.productcollections.ProductCollectionUnarchiveParams;\nimport com.dodopayments.api.models.productcollections.ProductCollectionUnarchiveResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ProductCollectionUnarchiveResponse response = client.productCollections().unarchive("id");\n }\n}',
|
|
7069
|
+
},
|
|
7070
|
+
kotlin: {
|
|
7071
|
+
method: 'productCollections().unarchive',
|
|
7072
|
+
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.productcollections.ProductCollectionUnarchiveParams\nimport com.dodopayments.api.models.productcollections.ProductCollectionUnarchiveResponse\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val response: ProductCollectionUnarchiveResponse = client.productCollections().unarchive("id")\n}',
|
|
7073
|
+
},
|
|
7074
|
+
go: {
|
|
7075
|
+
method: 'client.ProductCollections.Unarchive',
|
|
7076
|
+
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.ProductCollections.Unarchive(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.CollectionID)\n}\n',
|
|
7077
|
+
},
|
|
7078
|
+
ruby: {
|
|
7079
|
+
method: 'product_collections.unarchive',
|
|
7080
|
+
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\nresponse = dodo_payments.product_collections.unarchive("id")\n\nputs(response)',
|
|
7081
|
+
},
|
|
7082
|
+
cli: {
|
|
7083
|
+
method: 'product_collections unarchive',
|
|
7084
|
+
example: "dodo-payments-cli product-collections unarchive \\\n --bearer-token 'My Bearer Token' \\\n --id id",
|
|
7085
|
+
},
|
|
7086
|
+
php: {
|
|
7087
|
+
method: 'productCollections->unarchive',
|
|
7088
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$response = $client->productCollections->unarchive('id');\n\nvar_dump($response);",
|
|
7089
|
+
},
|
|
7090
|
+
csharp: {
|
|
7091
|
+
method: 'ProductCollections.Unarchive',
|
|
7092
|
+
example: 'ProductCollectionUnarchiveParams parameters = new() { ID = "id" };\n\nvar response = await client.ProductCollections.Unarchive(parameters);\n\nConsole.WriteLine(response);',
|
|
7093
|
+
},
|
|
7094
|
+
http: {
|
|
7095
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID/unarchive \\\n -X POST \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
7096
|
+
},
|
|
7097
|
+
},
|
|
7098
|
+
},
|
|
7099
|
+
{
|
|
7100
|
+
name: 'create',
|
|
7101
|
+
endpoint: '/product-collections/{id}/groups',
|
|
7102
|
+
httpMethod: 'post',
|
|
7103
|
+
summary: '',
|
|
7104
|
+
description: '',
|
|
7105
|
+
stainlessPath: '(resource) product_collections.groups > (method) create',
|
|
7106
|
+
qualified: 'client.productCollections.groups.create',
|
|
7107
|
+
params: [
|
|
7108
|
+
'id: string;',
|
|
7109
|
+
'products: { product_id: string; status?: boolean; }[];',
|
|
7110
|
+
'group_name?: string;',
|
|
7111
|
+
'status?: boolean;',
|
|
7112
|
+
],
|
|
7113
|
+
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; }',
|
|
7114
|
+
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('id', { products: [{ product_id: 'product_id' }] });\n\nconsole.log(productCollectionGroupResponse);\n```",
|
|
7115
|
+
perLanguage: {
|
|
7116
|
+
typescript: {
|
|
7117
|
+
method: 'client.productCollections.groups.create',
|
|
7118
|
+
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 productCollectionGroupResponse = await client.productCollections.groups.create('id', {\n products: [{ product_id: 'product_id' }],\n});\n\nconsole.log(productCollectionGroupResponse.group_id);",
|
|
7119
|
+
},
|
|
7120
|
+
python: {
|
|
7121
|
+
method: 'product_collections.groups.create',
|
|
7122
|
+
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)\nproduct_collection_group_response = client.product_collections.groups.create(\n id="id",\n products=[{\n "product_id": "product_id"\n }],\n)\nprint(product_collection_group_response.group_id)',
|
|
7123
|
+
},
|
|
7124
|
+
java: {
|
|
7125
|
+
method: 'productCollections().groups().create',
|
|
7126
|
+
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.productcollections.groups.GroupCreateParams;\nimport com.dodopayments.api.models.productcollections.groups.GroupProduct;\nimport com.dodopayments.api.models.productcollections.groups.ProductCollectionGroupDetails;\nimport com.dodopayments.api.models.productcollections.groups.ProductCollectionGroupResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n GroupCreateParams params = GroupCreateParams.builder()\n .id("id")\n .productCollectionGroupDetails(ProductCollectionGroupDetails.builder()\n .addProduct(GroupProduct.builder()\n .productId("product_id")\n .build())\n .build())\n .build();\n ProductCollectionGroupResponse productCollectionGroupResponse = client.productCollections().groups().create(params);\n }\n}',
|
|
7127
|
+
},
|
|
7128
|
+
kotlin: {
|
|
7129
|
+
method: 'productCollections().groups().create',
|
|
7130
|
+
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.productcollections.groups.GroupCreateParams\nimport com.dodopayments.api.models.productcollections.groups.GroupProduct\nimport com.dodopayments.api.models.productcollections.groups.ProductCollectionGroupDetails\nimport com.dodopayments.api.models.productcollections.groups.ProductCollectionGroupResponse\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: GroupCreateParams = GroupCreateParams.builder()\n .id("id")\n .productCollectionGroupDetails(ProductCollectionGroupDetails.builder()\n .addProduct(GroupProduct.builder()\n .productId("product_id")\n .build())\n .build())\n .build()\n val productCollectionGroupResponse: ProductCollectionGroupResponse = client.productCollections().groups().create(params)\n}',
|
|
7131
|
+
},
|
|
7132
|
+
go: {
|
|
7133
|
+
method: 'client.ProductCollections.Groups.New',
|
|
7134
|
+
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\tproductCollectionGroupResponse, err := client.ProductCollections.Groups.New(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\tdodopayments.ProductCollectionGroupNewParams{\n\t\t\tProductCollectionGroupDetails: dodopayments.ProductCollectionGroupDetailsParam{\n\t\t\t\tProducts: dodopayments.F([]dodopayments.GroupProductParam{{\n\t\t\t\t\tProductID: dodopayments.F("product_id"),\n\t\t\t\t}}),\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", productCollectionGroupResponse.GroupID)\n}\n',
|
|
7135
|
+
},
|
|
7136
|
+
ruby: {
|
|
7137
|
+
method: 'product_collections.groups.create',
|
|
7138
|
+
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\nproduct_collection_group_response = dodo_payments.product_collections.groups.create("id", products: [{product_id: "product_id"}])\n\nputs(product_collection_group_response)',
|
|
7139
|
+
},
|
|
7140
|
+
cli: {
|
|
7141
|
+
method: 'groups create',
|
|
7142
|
+
example: "dodo-payments-cli product-collections:groups create \\\n --bearer-token 'My Bearer Token' \\\n --id id \\\n --product '{product_id: product_id}'",
|
|
7143
|
+
},
|
|
7144
|
+
php: {
|
|
7145
|
+
method: 'productCollections->groups->create',
|
|
7146
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$productCollectionGroupResponse = $client->productCollections->groups->create(\n 'id',\n products: [['productID' => 'product_id', 'status' => true]],\n groupName: 'group_name',\n status: true,\n);\n\nvar_dump($productCollectionGroupResponse);",
|
|
7147
|
+
},
|
|
7148
|
+
csharp: {
|
|
7149
|
+
method: 'ProductCollections.Groups.Create',
|
|
7150
|
+
example: 'GroupCreateParams parameters = new()\n{\n ID = "id",\n Products =\n [\n new()\n {\n ProductID = "product_id",\n Status = true,\n },\n ],\n};\n\nvar productCollectionGroupResponse = await client.ProductCollections.Groups.Create(parameters);\n\nConsole.WriteLine(productCollectionGroupResponse);',
|
|
7151
|
+
},
|
|
7152
|
+
http: {
|
|
7153
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID/groups \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "products": [\n {\n "product_id": "product_id"\n }\n ]\n }\'',
|
|
7154
|
+
},
|
|
7155
|
+
},
|
|
7156
|
+
},
|
|
7157
|
+
{
|
|
7158
|
+
name: 'delete',
|
|
7159
|
+
endpoint: '/product-collections/{id}/groups/{group_id}',
|
|
7160
|
+
httpMethod: 'delete',
|
|
7161
|
+
summary: '',
|
|
7162
|
+
description: '',
|
|
7163
|
+
stainlessPath: '(resource) product_collections.groups > (method) delete',
|
|
7164
|
+
qualified: 'client.productCollections.groups.delete',
|
|
7165
|
+
params: ['id: string;', 'group_id: string;'],
|
|
7166
|
+
markdown: "## delete\n\n`client.productCollections.groups.delete(id: string, group_id: string): void`\n\n**delete** `/product-collections/{id}/groups/{group_id}`\n\n### Parameters\n\n- `id: string`\n\n- `group_id: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.productCollections.groups.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { id: 'id' })\n```",
|
|
7167
|
+
perLanguage: {
|
|
7168
|
+
typescript: {
|
|
7169
|
+
method: 'client.productCollections.groups.delete',
|
|
7170
|
+
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\nawait client.productCollections.groups.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { id: 'id' });",
|
|
7171
|
+
},
|
|
7172
|
+
python: {
|
|
7173
|
+
method: 'product_collections.groups.delete',
|
|
7174
|
+
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)\nclient.product_collections.groups.delete(\n group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id="id",\n)',
|
|
7175
|
+
},
|
|
7176
|
+
java: {
|
|
7177
|
+
method: 'productCollections().groups().delete',
|
|
7178
|
+
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.productcollections.groups.GroupDeleteParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n GroupDeleteParams params = GroupDeleteParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build();\n client.productCollections().groups().delete(params);\n }\n}',
|
|
7179
|
+
},
|
|
7180
|
+
kotlin: {
|
|
7181
|
+
method: 'productCollections().groups().delete',
|
|
7182
|
+
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.productcollections.groups.GroupDeleteParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: GroupDeleteParams = GroupDeleteParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build()\n client.productCollections().groups().delete(params)\n}',
|
|
7183
|
+
},
|
|
7184
|
+
go: {
|
|
7185
|
+
method: 'client.ProductCollections.Groups.Delete',
|
|
7186
|
+
example: 'package main\n\nimport (\n\t"context"\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\terr := client.ProductCollections.Groups.Delete(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
7187
|
+
},
|
|
7188
|
+
ruby: {
|
|
7189
|
+
method: 'product_collections.groups.delete',
|
|
7190
|
+
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\nresult = dodo_payments.product_collections.groups.delete("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", id: "id")\n\nputs(result)',
|
|
7191
|
+
},
|
|
7192
|
+
cli: {
|
|
7193
|
+
method: 'groups delete',
|
|
7194
|
+
example: "dodo-payments-cli product-collections:groups delete \\\n --bearer-token 'My Bearer Token' \\\n --id id \\\n --group-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
|
|
7195
|
+
},
|
|
7196
|
+
php: {
|
|
7197
|
+
method: 'productCollections->groups->delete',
|
|
7198
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$result = $client->productCollections->groups->delete(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', id: 'id'\n);\n\nvar_dump($result);",
|
|
7199
|
+
},
|
|
7200
|
+
csharp: {
|
|
7201
|
+
method: 'ProductCollections.Groups.Delete',
|
|
7202
|
+
example: 'GroupDeleteParams parameters = new()\n{\n ID = "id",\n GroupID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n};\n\nawait client.ProductCollections.Groups.Delete(parameters);',
|
|
7203
|
+
},
|
|
7204
|
+
http: {
|
|
7205
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID/groups/$GROUP_ID \\\n -X DELETE \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
7206
|
+
},
|
|
7207
|
+
},
|
|
7208
|
+
},
|
|
7209
|
+
{
|
|
7210
|
+
name: 'update',
|
|
7211
|
+
endpoint: '/product-collections/{id}/groups/{group_id}',
|
|
7212
|
+
httpMethod: 'patch',
|
|
7213
|
+
summary: '',
|
|
7214
|
+
description: '',
|
|
7215
|
+
stainlessPath: '(resource) product_collections.groups > (method) update',
|
|
7216
|
+
qualified: 'client.productCollections.groups.update',
|
|
7217
|
+
params: [
|
|
7218
|
+
'id: string;',
|
|
7219
|
+
'group_id: string;',
|
|
7220
|
+
'group_name?: string;',
|
|
7221
|
+
'product_order?: string[];',
|
|
7222
|
+
'status?: boolean;',
|
|
7223
|
+
],
|
|
7224
|
+
markdown: "## update\n\n`client.productCollections.groups.update(id: string, group_id: string, group_name?: string, product_order?: string[], status?: boolean): void`\n\n**patch** `/product-collections/{id}/groups/{group_id}`\n\n### Parameters\n\n- `id: string`\n\n- `group_id: string`\n\n- `group_name?: string`\n Optional group name update: Some(Some(name)) = set name, Some(None) = clear name, None = no change\n\n- `product_order?: string[]`\n Optional new order for products in this group (array of product_collection_group_pdts UUIDs)\n\n- `status?: boolean`\n Optional status update\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.productCollections.groups.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { id: 'id' })\n```",
|
|
7225
|
+
perLanguage: {
|
|
7226
|
+
typescript: {
|
|
7227
|
+
method: 'client.productCollections.groups.update',
|
|
7228
|
+
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\nawait client.productCollections.groups.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { id: 'id' });",
|
|
7229
|
+
},
|
|
7230
|
+
python: {
|
|
7231
|
+
method: 'product_collections.groups.update',
|
|
7232
|
+
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)\nclient.product_collections.groups.update(\n group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id="id",\n)',
|
|
7233
|
+
},
|
|
7234
|
+
java: {
|
|
7235
|
+
method: 'productCollections().groups().update',
|
|
7236
|
+
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.productcollections.groups.GroupUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n GroupUpdateParams params = GroupUpdateParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build();\n client.productCollections().groups().update(params);\n }\n}',
|
|
7237
|
+
},
|
|
7238
|
+
kotlin: {
|
|
7239
|
+
method: 'productCollections().groups().update',
|
|
7240
|
+
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.productcollections.groups.GroupUpdateParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: GroupUpdateParams = GroupUpdateParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build()\n client.productCollections().groups().update(params)\n}',
|
|
7241
|
+
},
|
|
7242
|
+
go: {
|
|
7243
|
+
method: 'client.ProductCollections.Groups.Update',
|
|
7244
|
+
example: 'package main\n\nimport (\n\t"context"\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\terr := client.ProductCollections.Groups.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tdodopayments.ProductCollectionGroupUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
7245
|
+
},
|
|
7246
|
+
ruby: {
|
|
7247
|
+
method: 'product_collections.groups.update',
|
|
7248
|
+
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\nresult = dodo_payments.product_collections.groups.update("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", id: "id")\n\nputs(result)',
|
|
7249
|
+
},
|
|
7250
|
+
cli: {
|
|
7251
|
+
method: 'groups update',
|
|
7252
|
+
example: "dodo-payments-cli product-collections:groups update \\\n --bearer-token 'My Bearer Token' \\\n --id id \\\n --group-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
|
|
7253
|
+
},
|
|
7254
|
+
php: {
|
|
7255
|
+
method: 'productCollections->groups->update',
|
|
7256
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$result = $client->productCollections->groups->update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n id: 'id',\n groupName: 'group_name',\n productOrder: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],\n status: true,\n);\n\nvar_dump($result);",
|
|
7257
|
+
},
|
|
7258
|
+
csharp: {
|
|
7259
|
+
method: 'ProductCollections.Groups.Update',
|
|
7260
|
+
example: 'GroupUpdateParams parameters = new()\n{\n ID = "id",\n GroupID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n};\n\nawait client.ProductCollections.Groups.Update(parameters);',
|
|
7261
|
+
},
|
|
7262
|
+
http: {
|
|
7263
|
+
example: "curl https://live.dodopayments.com/product-collections/$ID/groups/$GROUP_ID \\\n -X PATCH \\\n -H 'Content-Type: application/json' \\\n -H \"Authorization: Bearer $DODO_PAYMENTS_API_KEY\" \\\n -d '{}'",
|
|
7264
|
+
},
|
|
7265
|
+
},
|
|
7266
|
+
},
|
|
7267
|
+
{
|
|
7268
|
+
name: 'create',
|
|
7269
|
+
endpoint: '/product-collections/{id}/groups/{group_id}/items',
|
|
7270
|
+
httpMethod: 'post',
|
|
7271
|
+
summary: '',
|
|
7272
|
+
description: '',
|
|
7273
|
+
stainlessPath: '(resource) product_collections.groups.items > (method) create',
|
|
7274
|
+
qualified: 'client.productCollections.groups.items.create',
|
|
7275
|
+
params: ['id: string;', 'group_id: string;', 'products: { product_id: string; status?: boolean; }[];'],
|
|
7276
|
+
response: "{ 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?: object | object | object; tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive?: boolean; }[]",
|
|
7277
|
+
markdown: "## create\n\n`client.productCollections.groups.items.create(id: string, group_id: string, products: { product_id: string; status?: boolean; }[]): object[]`\n\n**post** `/product-collections/{id}/groups/{group_id}/items`\n\n### Parameters\n\n- `id: string`\n\n- `group_id: string`\n\n- `products: { product_id: string; status?: boolean; }[]`\n Products to add to the group\n\n### Returns\n\n- `{ 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?: object | object | object; tax_category?: 'digital_products' | 'saas' | 'e_book' | 'edtech'; tax_inclusive?: boolean; }[]`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nconst productCollectionProducts = await client.productCollections.groups.items.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { id: 'id', products: [{ product_id: 'product_id' }] });\n\nconsole.log(productCollectionProducts);\n```",
|
|
7278
|
+
perLanguage: {
|
|
7279
|
+
typescript: {
|
|
7280
|
+
method: 'client.productCollections.groups.items.create',
|
|
7281
|
+
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 productCollectionProducts = await client.productCollections.groups.items.create(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { id: 'id', products: [{ product_id: 'product_id' }] },\n);\n\nconsole.log(productCollectionProducts);",
|
|
7282
|
+
},
|
|
7283
|
+
python: {
|
|
7284
|
+
method: 'product_collections.groups.items.create',
|
|
7285
|
+
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)\nproduct_collection_products = client.product_collections.groups.items.create(\n group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id="id",\n products=[{\n "product_id": "product_id"\n }],\n)\nprint(product_collection_products)',
|
|
7286
|
+
},
|
|
7287
|
+
java: {
|
|
7288
|
+
method: 'productCollections().groups().items().create',
|
|
7289
|
+
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.productcollections.groups.GroupProduct;\nimport com.dodopayments.api.models.productcollections.groups.items.ItemCreateParams;\nimport com.dodopayments.api.models.productcollections.groups.items.ProductCollectionProduct;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ItemCreateParams params = ItemCreateParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .addProduct(GroupProduct.builder()\n .productId("product_id")\n .build())\n .build();\n List<ProductCollectionProduct> productCollectionProducts = client.productCollections().groups().items().create(params);\n }\n}',
|
|
7290
|
+
},
|
|
7291
|
+
kotlin: {
|
|
7292
|
+
method: 'productCollections().groups().items().create',
|
|
7293
|
+
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.productcollections.groups.GroupProduct\nimport com.dodopayments.api.models.productcollections.groups.items.ItemCreateParams\nimport com.dodopayments.api.models.productcollections.groups.items.ProductCollectionProduct\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: ItemCreateParams = ItemCreateParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .addProduct(GroupProduct.builder()\n .productId("product_id")\n .build())\n .build()\n val productCollectionProducts: List<ProductCollectionProduct> = client.productCollections().groups().items().create(params)\n}',
|
|
7294
|
+
},
|
|
7295
|
+
go: {
|
|
7296
|
+
method: 'client.ProductCollections.Groups.Items.New',
|
|
7297
|
+
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\tproductCollectionProducts, err := client.ProductCollections.Groups.Items.New(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tdodopayments.ProductCollectionGroupItemNewParams{\n\t\t\tProducts: dodopayments.F([]dodopayments.GroupProductParam{{\n\t\t\t\tProductID: dodopayments.F("product_id"),\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", productCollectionProducts)\n}\n',
|
|
7298
|
+
},
|
|
7299
|
+
ruby: {
|
|
7300
|
+
method: 'product_collections.groups.items.create',
|
|
7301
|
+
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\nproduct_collection_products = dodo_payments.product_collections.groups.items.create(\n "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id: "id",\n products: [{product_id: "product_id"}]\n)\n\nputs(product_collection_products)',
|
|
7302
|
+
},
|
|
7303
|
+
cli: {
|
|
7304
|
+
method: 'items create',
|
|
7305
|
+
example: "dodo-payments-cli product-collections:groups:items create \\\n --bearer-token 'My Bearer Token' \\\n --id id \\\n --group-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \\\n --product '{product_id: product_id}'",
|
|
7306
|
+
},
|
|
7307
|
+
php: {
|
|
7308
|
+
method: 'productCollections->groups->items->create',
|
|
7309
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$productCollectionProducts = $client->productCollections->groups->items->create(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n id: 'id',\n products: [['productID' => 'product_id', 'status' => true]],\n);\n\nvar_dump($productCollectionProducts);",
|
|
7310
|
+
},
|
|
7311
|
+
csharp: {
|
|
7312
|
+
method: 'ProductCollections.Groups.Items.Create',
|
|
7313
|
+
example: 'ItemCreateParams parameters = new()\n{\n ID = "id",\n GroupID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n Products =\n [\n new()\n {\n ProductID = "product_id",\n Status = true,\n },\n ],\n};\n\nvar productCollectionProducts = await client.ProductCollections.Groups.Items.Create(parameters);\n\nConsole.WriteLine(productCollectionProducts);',
|
|
7314
|
+
},
|
|
7315
|
+
http: {
|
|
7316
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID/groups/$GROUP_ID/items \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "products": [\n {\n "product_id": "product_id"\n }\n ]\n }\'',
|
|
7317
|
+
},
|
|
7318
|
+
},
|
|
7319
|
+
},
|
|
7320
|
+
{
|
|
7321
|
+
name: 'delete',
|
|
7322
|
+
endpoint: '/product-collections/{id}/groups/{group_id}/items/{item_id}',
|
|
7323
|
+
httpMethod: 'delete',
|
|
7324
|
+
summary: '',
|
|
7325
|
+
description: '',
|
|
7326
|
+
stainlessPath: '(resource) product_collections.groups.items > (method) delete',
|
|
7327
|
+
qualified: 'client.productCollections.groups.items.delete',
|
|
7328
|
+
params: ['id: string;', 'group_id: string;', 'item_id: string;'],
|
|
7329
|
+
markdown: "## delete\n\n`client.productCollections.groups.items.delete(id: string, group_id: string, item_id: string): void`\n\n**delete** `/product-collections/{id}/groups/{group_id}/items/{item_id}`\n\n### Parameters\n\n- `id: string`\n\n- `group_id: string`\n\n- `item_id: string`\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.productCollections.groups.items.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { id: 'id', group_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' })\n```",
|
|
7330
|
+
perLanguage: {
|
|
7331
|
+
typescript: {
|
|
7332
|
+
method: 'client.productCollections.groups.items.delete',
|
|
7333
|
+
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\nawait client.productCollections.groups.items.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n id: 'id',\n group_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n});",
|
|
7334
|
+
},
|
|
7335
|
+
python: {
|
|
7336
|
+
method: 'product_collections.groups.items.delete',
|
|
7337
|
+
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)\nclient.product_collections.groups.items.delete(\n item_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id="id",\n group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n)',
|
|
7338
|
+
},
|
|
7339
|
+
java: {
|
|
7340
|
+
method: 'productCollections().groups().items().delete',
|
|
7341
|
+
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.productcollections.groups.items.ItemDeleteParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ItemDeleteParams params = ItemDeleteParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .itemId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build();\n client.productCollections().groups().items().delete(params);\n }\n}',
|
|
7342
|
+
},
|
|
7343
|
+
kotlin: {
|
|
7344
|
+
method: 'productCollections().groups().items().delete',
|
|
7345
|
+
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.productcollections.groups.items.ItemDeleteParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: ItemDeleteParams = ItemDeleteParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .itemId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build()\n client.productCollections().groups().items().delete(params)\n}',
|
|
7346
|
+
},
|
|
7347
|
+
go: {
|
|
7348
|
+
method: 'client.ProductCollections.Groups.Items.Delete',
|
|
7349
|
+
example: 'package main\n\nimport (\n\t"context"\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\terr := client.ProductCollections.Groups.Items.Delete(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
7350
|
+
},
|
|
7351
|
+
ruby: {
|
|
7352
|
+
method: 'product_collections.groups.items.delete',
|
|
7353
|
+
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\nresult = dodo_payments.product_collections.groups.items.delete(\n "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id: "id",\n group_id: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"\n)\n\nputs(result)',
|
|
7354
|
+
},
|
|
7355
|
+
cli: {
|
|
7356
|
+
method: 'items delete',
|
|
7357
|
+
example: "dodo-payments-cli product-collections:groups:items delete \\\n --bearer-token 'My Bearer Token' \\\n --id id \\\n --group-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \\\n --item-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
|
|
7358
|
+
},
|
|
7359
|
+
php: {
|
|
7360
|
+
method: 'productCollections->groups->items->delete',
|
|
7361
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$result = $client->productCollections->groups->items->delete(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n id: 'id',\n groupID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n);\n\nvar_dump($result);",
|
|
7362
|
+
},
|
|
7363
|
+
csharp: {
|
|
7364
|
+
method: 'ProductCollections.Groups.Items.Delete',
|
|
7365
|
+
example: 'ItemDeleteParams parameters = new()\n{\n ID = "id",\n GroupID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n ItemID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n};\n\nawait client.ProductCollections.Groups.Items.Delete(parameters);',
|
|
7366
|
+
},
|
|
7367
|
+
http: {
|
|
7368
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID/groups/$GROUP_ID/items/$ITEM_ID \\\n -X DELETE \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY"',
|
|
7369
|
+
},
|
|
7370
|
+
},
|
|
7371
|
+
},
|
|
7372
|
+
{
|
|
7373
|
+
name: 'update',
|
|
7374
|
+
endpoint: '/product-collections/{id}/groups/{group_id}/items/{item_id}',
|
|
7375
|
+
httpMethod: 'patch',
|
|
7376
|
+
summary: '',
|
|
7377
|
+
description: '',
|
|
7378
|
+
stainlessPath: '(resource) product_collections.groups.items > (method) update',
|
|
7379
|
+
qualified: 'client.productCollections.groups.items.update',
|
|
7380
|
+
params: ['id: string;', 'group_id: string;', 'item_id: string;', 'status: boolean;'],
|
|
7381
|
+
markdown: "## update\n\n`client.productCollections.groups.items.update(id: string, group_id: string, item_id: string, status: boolean): void`\n\n**patch** `/product-collections/{id}/groups/{group_id}/items/{item_id}`\n\n### Parameters\n\n- `id: string`\n\n- `group_id: string`\n\n- `item_id: string`\n\n- `status: boolean`\n Status of the product in the group\n\n### Example\n\n```typescript\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments();\n\nawait client.productCollections.groups.items.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n id: 'id',\n group_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n status: true,\n})\n```",
|
|
7382
|
+
perLanguage: {
|
|
7383
|
+
typescript: {
|
|
7384
|
+
method: 'client.productCollections.groups.items.update',
|
|
7385
|
+
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\nawait client.productCollections.groups.items.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n id: 'id',\n group_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n status: true,\n});",
|
|
7386
|
+
},
|
|
7387
|
+
python: {
|
|
7388
|
+
method: 'product_collections.groups.items.update',
|
|
7389
|
+
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)\nclient.product_collections.groups.items.update(\n item_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id="id",\n group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n status=True,\n)',
|
|
7390
|
+
},
|
|
7391
|
+
java: {
|
|
7392
|
+
method: 'productCollections().groups().items().update',
|
|
7393
|
+
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.productcollections.groups.items.ItemUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();\n\n ItemUpdateParams params = ItemUpdateParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .itemId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .status(true)\n .build();\n client.productCollections().groups().items().update(params);\n }\n}',
|
|
7394
|
+
},
|
|
7395
|
+
kotlin: {
|
|
7396
|
+
method: 'productCollections().groups().items().update',
|
|
7397
|
+
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.productcollections.groups.items.ItemUpdateParams\n\nfun main() {\n val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()\n\n val params: ItemUpdateParams = ItemUpdateParams.builder()\n .id("id")\n .groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .itemId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .status(true)\n .build()\n client.productCollections().groups().items().update(params)\n}',
|
|
7398
|
+
},
|
|
7399
|
+
go: {
|
|
7400
|
+
method: 'client.ProductCollections.Groups.Items.Update',
|
|
7401
|
+
example: 'package main\n\nimport (\n\t"context"\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\terr := client.ProductCollections.Groups.Items.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tdodopayments.ProductCollectionGroupItemUpdateParams{\n\t\t\tStatus: dodopayments.F(true),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
7402
|
+
},
|
|
7403
|
+
ruby: {
|
|
7404
|
+
method: 'product_collections.groups.items.update',
|
|
7405
|
+
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\nresult = dodo_payments.product_collections.groups.items.update(\n "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n id: "id",\n group_id: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n status: true\n)\n\nputs(result)',
|
|
7406
|
+
},
|
|
7407
|
+
cli: {
|
|
7408
|
+
method: 'items update',
|
|
7409
|
+
example: "dodo-payments-cli product-collections:groups:items update \\\n --bearer-token 'My Bearer Token' \\\n --id id \\\n --group-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \\\n --item-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \\\n --status",
|
|
7410
|
+
},
|
|
7411
|
+
php: {
|
|
7412
|
+
method: 'productCollections->groups->items->update',
|
|
7413
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(bearerToken: 'My Bearer Token', environment: 'test_mode');\n\n$result = $client->productCollections->groups->items->update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n id: 'id',\n groupID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n status: true,\n);\n\nvar_dump($result);",
|
|
7414
|
+
},
|
|
7415
|
+
csharp: {
|
|
7416
|
+
method: 'ProductCollections.Groups.Items.Update',
|
|
7417
|
+
example: 'ItemUpdateParams parameters = new()\n{\n ID = "id",\n GroupID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n ItemID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n Status = true,\n};\n\nawait client.ProductCollections.Groups.Items.Update(parameters);',
|
|
7418
|
+
},
|
|
7419
|
+
http: {
|
|
7420
|
+
example: 'curl https://live.dodopayments.com/product-collections/$ID/groups/$GROUP_ID/items/$ITEM_ID \\\n -X PATCH \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $DODO_PAYMENTS_API_KEY" \\\n -d \'{\n "status": true\n }\'',
|
|
7421
|
+
},
|
|
7422
|
+
},
|
|
7423
|
+
},
|
|
6659
7424
|
];
|
|
6660
7425
|
const EMBEDDED_READMES = [
|
|
6661
7426
|
{
|
|
6662
7427
|
language: 'cli',
|
|
6663
|
-
content: "# Dodo Payments CLI\n\nThe official CLI for the [Dodo Payments REST API](https://docs.dodopayments.com/api-reference/introduction).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## Installation\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https://go.dev/doc/install) version 1.22 or later installed.\n\n~~~sh\ngo install 'github.com/stainless-sdks/dodo-payments-cli/cmd/dodo-payments-cli@latest'\n~~~\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME/go/bin` (or `$GOPATH/bin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n~~~sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)/bin\"\n~~~\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts/run` script to run the tool locally:\n\n~~~sh\n./scripts/run args...\n~~~\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n~~~sh\ndodo-payments-cli [resource] <command> [flags...]\n~~~\n\n~~~sh\ndodo-payments-cli checkout-sessions create \\\n --bearer-token 'My Bearer Token' \\\n --product-cart '{product_id:
|
|
7428
|
+
content: "# Dodo Payments CLI\n\nThe official CLI for the [Dodo Payments REST API](https://docs.dodopayments.com/api-reference/introduction).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## Installation\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https://go.dev/doc/install) version 1.22 or later installed.\n\n~~~sh\ngo install 'github.com/stainless-sdks/dodo-payments-cli/cmd/dodo-payments-cli@latest'\n~~~\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME/go/bin` (or `$GOPATH/bin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n~~~sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)/bin\"\n~~~\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts/run` script to run the tool locally:\n\n~~~sh\n./scripts/run args...\n~~~\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n~~~sh\ndodo-payments-cli [resource] <command> [flags...]\n~~~\n\n~~~sh\ndodo-payments-cli checkout-sessions create \\\n --bearer-token 'My Bearer Token' \\\n --product-cart '{product_id: pdt_example, quantity: 1}'\n~~~\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable | Description | Required | Default value |\n| --------------------------- | ----------------------------------- | -------- | ------------- |\n| `DODO_PAYMENTS_API_KEY` | Bearer Token for API authentication | yes | |\n| `DODO_PAYMENTS_WEBHOOK_KEY` | | no | `null` |\n\n### Global flags\n\n- `--bearer-token` - Bearer Token for API authentication (can also be set with `DODO_PAYMENTS_API_KEY` env var)\n- `--webhook-key` (can also be set with `DODO_PAYMENTS_WEBHOOK_KEY` env var)\n- `--help` - Show command line usage\n- `--debug` - Enable debug logging (includes HTTP request/response details)\n- `--version`, `-v` - Show the CLI version\n- `--base-url` - Use a custom API backend URL\n- `--format` - Change the output format (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--format-error` - Change the output format for errors (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--transform` - Transform the data output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n- `--transform-error` - Transform the error output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n\n### Passing files as arguments\n\nTo pass files to your API, you can use the `@myfile.ext` syntax:\n\n~~~bash\ndodo-payments-cli <command> --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\ndodo-payments-cli <command> --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\ndodo-payments-cli <command> <<YAML\narg:\n image: \"@abe.jpg\"\nYAML\n~~~\n\nIf you need to pass a string literal that begins with an `@` sign, you can\nescape the `@` sign to avoid accidentally passing a file.\n\n~~~bash\ndodo-payments-cli <command> --username '\\@abe'\n~~~\n\n#### Explicit encoding\n\nFor JSON endpoints, the CLI tool does filetype sniffing to determine whether the\nfile contents should be sent as a string literal (for plain text files) or as a\nbase64-encoded string literal (for binary files). If you need to explicitly send\nthe file as either plain text or base64-encoded data, you can use\n`@file://myfile.txt` (for string encoding) or `@data://myfile.dat` (for\nbase64-encoding). Note that absolute paths will begin with `@file://` or\n`@data://`, followed by a third `/` (for example, `@file:///tmp/file.txt`).\n\n~~~bash\ndodo-payments-cli <command> --arg @data://file.txt\n~~~\n\n## Linking different Go SDK versions\n\nYou can link the CLI against a different version of the Dodo Payments Go SDK\nfor development purposes using the `./scripts/link` script.\n\nTo link to a specific version from a repository (version can be a branch,\ngit tag, or commit hash):\n\n~~~bash\n./scripts/link github.com/org/repo@version\n~~~\n\nTo link to a local copy of the SDK:\n\n~~~bash\n./scripts/link ../path/to/dodopayments-go\n~~~\n\nIf you run the link script without any arguments, it will default to `../dodopayments-go`.\n",
|
|
6664
7429
|
},
|
|
6665
7430
|
{
|
|
6666
7431
|
language: 'csharp',
|
|
6667
|
-
content: '# Dodo Payments C# API Library\n\nThe Dodo Payments C# SDK provides convenient access to the [Dodo Payments REST API](https://docs.dodopayments.com/api-reference/introduction) from applications written in C#.\n\n## Installation\n\nInstall the package from [NuGet](https://www.nuget.org/packages/DodoPayments.Client):\n\n```bash\ndotnet add package DodoPayments.Client\n```\n\n## Requirements\n\nThis library requires .NET Standard 2.0 or later.\n\n## Usage\n\nSee the [`examples`](examples) directory for complete and runnable examples.\n\n```csharp\nDodoPaymentsClient client = new();\n\nCheckoutSessionCreateParams parameters = new()\n{\n ProductCart =\n [\n new()\n {\n ProductID = "
|
|
7432
|
+
content: '# Dodo Payments C# API Library\n\nThe Dodo Payments C# SDK provides convenient access to the [Dodo Payments REST API](https://docs.dodopayments.com/api-reference/introduction) from applications written in C#.\n\n## Installation\n\nInstall the package from [NuGet](https://www.nuget.org/packages/DodoPayments.Client):\n\n```bash\ndotnet add package DodoPayments.Client\n```\n\n## Requirements\n\nThis library requires .NET Standard 2.0 or later.\n\n## Usage\n\nSee the [`examples`](examples) directory for complete and runnable examples.\n\n```csharp\nDodoPaymentsClient client = new();\n\nCheckoutSessionCreateParams parameters = new()\n{\n ProductCart =\n [\n new()\n {\n ProductID = "pdt_example",\n Quantity = 1,\n },\n ],\n};\n\nvar checkoutSessionResponse = await client.CheckoutSessions.Create(parameters);\n\nConsole.WriteLine(checkoutSessionResponse);\n```',
|
|
6668
7433
|
},
|
|
6669
7434
|
{
|
|
6670
7435
|
language: 'go',
|
|
@@ -6680,19 +7445,19 @@ const EMBEDDED_READMES = [
|
|
|
6680
7445
|
},
|
|
6681
7446
|
{
|
|
6682
7447
|
language: 'php',
|
|
6683
|
-
content: "# Dodo Payments PHP API Library\n\nThe Dodo Payments PHP library provides convenient access to the Dodo Payments REST API from any PHP 8.1.0+ application.\n\n## Installation\n\n<!-- x-release-please-start-version -->\n```\ncomposer require \"dodopayments/client 0.0.1\"\n```\n<!-- x-release-please-end -->\n\n## Usage\n\n```php\n<?php\n\n$client = new Client(\n bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',\n environment: 'test_mode',\n);\n\n$checkoutSessionResponse = $client->checkoutSessions->create(\n productCart: [['productID' => '
|
|
7448
|
+
content: "# Dodo Payments PHP API Library\n\nThe Dodo Payments PHP library provides convenient access to the Dodo Payments REST API from any PHP 8.1.0+ application.\n\n## Installation\n\n<!-- x-release-please-start-version -->\n```\ncomposer require \"dodopayments/client 0.0.1\"\n```\n<!-- x-release-please-end -->\n\n## Usage\n\n```php\n<?php\n\n$client = new Client(\n bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',\n environment: 'test_mode',\n);\n\n$checkoutSessionResponse = $client->checkoutSessions->create(\n productCart: [['productID' => 'pdt_example', 'quantity' => 1]]\n);\n\nvar_dump($checkoutSessionResponse->session_id);\n```",
|
|
6684
7449
|
},
|
|
6685
7450
|
{
|
|
6686
7451
|
language: 'python',
|
|
6687
|
-
content: '# Dodo Payments Python API library\n\n<!-- prettier-ignore -->\n[)](https://pypi.org/project/dodopayments/)\n\nThe Dodo Payments Python library provides convenient access to the Dodo Payments REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Dodo Payments MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRvZG9wYXltZW50cy1tY3AiXSwiZW52Ijp7IkRPRE9fUEFZTUVOVFNfQVBJX0tFWSI6Ik15IEJlYXJlciBUb2tlbiIsIkRPRE9fUEFZTUVOVFNfV0VCSE9PS19LRVkiOiJNeSBXZWJob29rIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dodopayments-mcp%22%5D%2C%22env%22%3A%7B%22DODO_PAYMENTS_API_KEY%22%3A%22My%20Bearer%20Token%22%2C%22DODO_PAYMENTS_WEBHOOK_KEY%22%3A%22My%20Webhook%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [docs.dodopayments.com](https://docs.dodopayments.com/api-reference/introduction). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install dodopayments\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport 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 # defaults to "live_mode".\n environment="test_mode",\n)\n\ncheckout_session_response = client.checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n)\nprint(checkout_session_response.session_id)\n```\n\nWhile you can provide a `bearer_token` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `DODO_PAYMENTS_API_KEY="My Bearer Token"` to your `.env` file\nso that your Bearer Token is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncDodoPayments` instead of `DodoPayments` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom dodopayments import AsyncDodoPayments\n\nclient = AsyncDodoPayments(\n bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted\n # defaults to "live_mode".\n environment="test_mode",\n)\n\nasync def main() -> None:\n checkout_session_response = await client.checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n )\n print(checkout_session_response.session_id)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install dodopayments[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom dodopayments import DefaultAioHttpClient\nfrom dodopayments import AsyncDodoPayments\n\nasync def main() -> None:\n async with AsyncDodoPayments(\n bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n checkout_session_response = await client.checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n )\n print(checkout_session_response.session_id)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Dodo Payments API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\n\nall_payments = []\n# Automatically fetches more pages as needed.\nfor payment in client.payments.list():\n # Do something with payment here\n all_payments.append(payment)\nprint(all_payments)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom dodopayments import AsyncDodoPayments\n\nclient = AsyncDodoPayments()\n\nasync def main() -> None:\n all_payments = []\n # Iterate through items across all pages, issuing requests as needed.\n async for payment in client.payments.list():\n all_payments.append(payment)\n print(all_payments)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.payments.list()\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.items)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.payments.list()\nfor payment in first_page.items:\n print(payment.brand_id)\n\n# Remove `await` for non-async usage.\n```\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\n\ncheckout_session_response = client.checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n billing_address={\n "country": "AF"\n },\n)\nprint(checkout_session_response.billing_address)\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `dodopayments.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `dodopayments.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `dodopayments.APIError`.\n\n```python\nimport dodopayments\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\n\ntry:\n client.checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n )\nexcept dodopayments.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept dodopayments.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept dodopayments.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom dodopayments import DodoPayments\n\n# Configure the default for all requests:\nclient = DodoPayments(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom dodopayments import DodoPayments\n\n# Configure the default for all requests:\nclient = DodoPayments(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = DodoPayments(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `DODO_PAYMENTS_LOG` to `info`.\n\n```shell\n$ export DODO_PAYMENTS_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\nresponse = client.checkout_sessions.with_raw_response.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n)\nprint(response.headers.get(\'X-My-Header\'))\n\ncheckout_session = response.parse() # get the object that `checkout_sessions.create()` would have returned\nprint(checkout_session.session_id)\n```\n\nThese methods return an [`APIResponse`](https://github.com/dodopayments/dodopayments-python/tree/main/src/dodopayments/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/dodopayments/dodopayments-python/tree/main/src/dodopayments/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.checkout_sessions.with_streaming_response.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom dodopayments import DodoPayments, DefaultHttpxClient\n\nclient = DodoPayments(\n # Or use the `DODO_PAYMENTS_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom dodopayments import DodoPayments\n\nwith DodoPayments() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/dodopayments/dodopayments-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport dodopayments\nprint(dodopayments.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
7452
|
+
content: '# Dodo Payments Python API library\n\n<!-- prettier-ignore -->\n[)](https://pypi.org/project/dodopayments/)\n\nThe Dodo Payments Python library provides convenient access to the Dodo Payments REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Dodo Payments MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRvZG9wYXltZW50cy1tY3AiXSwiZW52Ijp7IkRPRE9fUEFZTUVOVFNfQVBJX0tFWSI6Ik15IEJlYXJlciBUb2tlbiIsIkRPRE9fUEFZTUVOVFNfV0VCSE9PS19LRVkiOiJNeSBXZWJob29rIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dodopayments-mcp%22%5D%2C%22env%22%3A%7B%22DODO_PAYMENTS_API_KEY%22%3A%22My%20Bearer%20Token%22%2C%22DODO_PAYMENTS_WEBHOOK_KEY%22%3A%22My%20Webhook%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [docs.dodopayments.com](https://docs.dodopayments.com/api-reference/introduction). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install dodopayments\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport 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 # defaults to "live_mode".\n environment="test_mode",\n)\n\ncheckout_session_response = client.checkout_sessions.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n)\nprint(checkout_session_response.session_id)\n```\n\nWhile you can provide a `bearer_token` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `DODO_PAYMENTS_API_KEY="My Bearer Token"` to your `.env` file\nso that your Bearer Token is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncDodoPayments` instead of `DodoPayments` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom dodopayments import AsyncDodoPayments\n\nclient = AsyncDodoPayments(\n bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted\n # defaults to "live_mode".\n environment="test_mode",\n)\n\nasync def main() -> None:\n checkout_session_response = await client.checkout_sessions.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n )\n print(checkout_session_response.session_id)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install dodopayments[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom dodopayments import DefaultAioHttpClient\nfrom dodopayments import AsyncDodoPayments\n\nasync def main() -> None:\n async with AsyncDodoPayments(\n bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n checkout_session_response = await client.checkout_sessions.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n )\n print(checkout_session_response.session_id)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Dodo Payments API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\n\nall_payments = []\n# Automatically fetches more pages as needed.\nfor payment in client.payments.list():\n # Do something with payment here\n all_payments.append(payment)\nprint(all_payments)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom dodopayments import AsyncDodoPayments\n\nclient = AsyncDodoPayments()\n\nasync def main() -> None:\n all_payments = []\n # Iterate through items across all pages, issuing requests as needed.\n async for payment in client.payments.list():\n all_payments.append(payment)\n print(all_payments)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.payments.list()\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.items)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.payments.list()\nfor payment in first_page.items:\n print(payment.brand_id)\n\n# Remove `await` for non-async usage.\n```\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\n\ncheckout_session_response = client.checkout_sessions.create(\n product_cart=[{\n "product_id": "product_id",\n "quantity": 0,\n }],\n billing_address={\n "country": "AF"\n },\n)\nprint(checkout_session_response.billing_address)\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `dodopayments.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `dodopayments.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `dodopayments.APIError`.\n\n```python\nimport dodopayments\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\n\ntry:\n client.checkout_sessions.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n )\nexcept dodopayments.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept dodopayments.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept dodopayments.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom dodopayments import DodoPayments\n\n# Configure the default for all requests:\nclient = DodoPayments(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).checkout_sessions.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom dodopayments import DodoPayments\n\n# Configure the default for all requests:\nclient = DodoPayments(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = DodoPayments(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).checkout_sessions.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `DODO_PAYMENTS_LOG` to `info`.\n\n```shell\n$ export DODO_PAYMENTS_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom dodopayments import DodoPayments\n\nclient = DodoPayments()\nresponse = client.checkout_sessions.with_raw_response.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n)\nprint(response.headers.get(\'X-My-Header\'))\n\ncheckout_session = response.parse() # get the object that `checkout_sessions.create()` would have returned\nprint(checkout_session.session_id)\n```\n\nThese methods return an [`APIResponse`](https://github.com/dodopayments/dodopayments-python/tree/main/src/dodopayments/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/dodopayments/dodopayments-python/tree/main/src/dodopayments/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.checkout_sessions.with_streaming_response.create(\n product_cart=[{\n "product_id": "pdt_example",\n "quantity": 1,\n }],\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom dodopayments import DodoPayments, DefaultHttpxClient\n\nclient = DodoPayments(\n # Or use the `DODO_PAYMENTS_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom dodopayments import DodoPayments\n\nwith DodoPayments() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/dodopayments/dodopayments-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport dodopayments\nprint(dodopayments.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
6688
7453
|
},
|
|
6689
7454
|
{
|
|
6690
7455
|
language: 'ruby',
|
|
6691
|
-
content: '# Dodo Payments Ruby API library\n\nThe Dodo Payments Ruby library provides convenient access to the Dodo Payments REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/dodopayments/dodopayments-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Dodo Payments MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRvZG9wYXltZW50cy1tY3AiXSwiZW52Ijp7IkRPRE9fUEFZTUVOVFNfQVBJX0tFWSI6Ik15IEJlYXJlciBUb2tlbiIsIkRPRE9fUEFZTUVOVFNfV0VCSE9PS19LRVkiOiJNeSBXZWJob29rIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dodopayments-mcp%22%5D%2C%22env%22%3A%7B%22DODO_PAYMENTS_API_KEY%22%3A%22My%20Bearer%20Token%22%2C%22DODO_PAYMENTS_WEBHOOK_KEY%22%3A%22My%20Webhook%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/dodopayments).\n\nThe REST API documentation can be found on [docs.dodopayments.com](https://docs.dodopayments.com/api-reference/introduction).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n<!-- x-release-please-start-version -->\n\n```ruby\ngem "dodopayments", "~> 0.0.1"\n```\n\n<!-- x-release-please-end -->\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "dodopayments"\n\ndodo_payments = Dodopayments::Client.new(\n bearer_token: ENV["DODO_PAYMENTS_API_KEY"], # This is the default and can be omitted\n environment: "test_mode" # defaults to "live_mode"\n)\n\ncheckout_session_response = dodo_payments.checkout_sessions.create(product_cart: [{product_id: "product_id", quantity: 0}])\n\nputs(checkout_session_response.session_id)\n```\n\n\n\n### Pagination\n\nList methods in the Dodo Payments API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```ruby\npage = dodo_payments.payments.list\n\n# Fetch single item from page.\npayment = page.items[0]\nputs(payment.brand_id)\n\n# Automatically fetches more pages as needed.\npage.auto_paging_each do |payment|\n puts(payment.brand_id)\nend\n```\n\nAlternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.\n\n```ruby\nif page.next_page?\n new_page = page.next_page\n puts(new_page.items[0].brand_id)\nend\n```\n\n\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Dodopayments::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n checkout_session = dodo_payments.checkout_sessions.create(product_cart: [{product_id: "product_id", quantity: 0}])\nrescue Dodopayments::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue Dodopayments::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue Dodopayments::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\ndodo_payments = Dodopayments::Client.new(\n max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\ndodo_payments.checkout_sessions.create(\n product_cart: [{product_id: "product_id", quantity: 0}],\n request_options: {max_retries: 5}\n)\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\ndodo_payments = Dodopayments::Client.new(\n timeout: nil # default is 60\n)\n\n# Or, configure per-request:\ndodo_payments.checkout_sessions.create(\n product_cart: [{product_id: "product_id", quantity: 0}],\n request_options: {timeout: 5}\n)\n```\n\nOn timeout, `Dodopayments::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `Dodopayments::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\ncheckout_session_response =\n dodo_payments.checkout_sessions.create(\n product_cart: [{product_id: "product_id", quantity: 0}],\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(checkout_session_response[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `Dodopayments::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `Dodopayments::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\ndodo_payments.checkout_sessions.create(\n product_cart: [Dodopayments::ProductItemReq.new(product_id: "product_id", quantity: 0)]\n)\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\ndodo_payments.checkout_sessions.create(product_cart: [{product_id: "product_id", quantity: 0}])\n\n# You can also splat a full Params class:\nparams = Dodopayments::CheckoutSessionCreateParams.new(\n product_cart: [Dodopayments::ProductItemReq.new(product_id: "product_id", quantity: 0)]\n)\ndodo_payments.checkout_sessions.create(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :AED\nputs(Dodopayments::Currency::AED)\n\n# Revealed type: `T.all(Dodopayments::Currency, Symbol)`\nT.reveal_type(Dodopayments::Currency::AED)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\ndodo_payments.checkout_sessions.create(\n billing_currency: Dodopayments::Currency::AED,\n # …\n)\n\n# Literal values are also permissible:\ndodo_payments.checkout_sessions.create(\n billing_currency: :AED,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/dodopayments/dodopayments-ruby/tree/main/CONTRIBUTING.md).\n',
|
|
7456
|
+
content: '# Dodo Payments Ruby API library\n\nThe Dodo Payments Ruby library provides convenient access to the Dodo Payments REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/dodopayments/dodopayments-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Dodo Payments MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRvZG9wYXltZW50cy1tY3AiXSwiZW52Ijp7IkRPRE9fUEFZTUVOVFNfQVBJX0tFWSI6Ik15IEJlYXJlciBUb2tlbiIsIkRPRE9fUEFZTUVOVFNfV0VCSE9PS19LRVkiOiJNeSBXZWJob29rIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dodopayments-mcp%22%5D%2C%22env%22%3A%7B%22DODO_PAYMENTS_API_KEY%22%3A%22My%20Bearer%20Token%22%2C%22DODO_PAYMENTS_WEBHOOK_KEY%22%3A%22My%20Webhook%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/dodopayments).\n\nThe REST API documentation can be found on [docs.dodopayments.com](https://docs.dodopayments.com/api-reference/introduction).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n<!-- x-release-please-start-version -->\n\n```ruby\ngem "dodopayments", "~> 0.0.1"\n```\n\n<!-- x-release-please-end -->\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "dodopayments"\n\ndodo_payments = Dodopayments::Client.new(\n bearer_token: ENV["DODO_PAYMENTS_API_KEY"], # This is the default and can be omitted\n environment: "test_mode" # defaults to "live_mode"\n)\n\ncheckout_session_response = dodo_payments.checkout_sessions.create(product_cart: [{product_id: "pdt_example", quantity: 1}])\n\nputs(checkout_session_response.session_id)\n```\n\n\n\n### Pagination\n\nList methods in the Dodo Payments API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```ruby\npage = dodo_payments.payments.list\n\n# Fetch single item from page.\npayment = page.items[0]\nputs(payment.brand_id)\n\n# Automatically fetches more pages as needed.\npage.auto_paging_each do |payment|\n puts(payment.brand_id)\nend\n```\n\nAlternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.\n\n```ruby\nif page.next_page?\n new_page = page.next_page\n puts(new_page.items[0].brand_id)\nend\n```\n\n\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Dodopayments::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n checkout_session = dodo_payments.checkout_sessions.create(product_cart: [{product_id: "pdt_example", quantity: 1}])\nrescue Dodopayments::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue Dodopayments::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue Dodopayments::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\ndodo_payments = Dodopayments::Client.new(\n max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\ndodo_payments.checkout_sessions.create(\n product_cart: [{product_id: "pdt_example", quantity: 1}],\n request_options: {max_retries: 5}\n)\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\ndodo_payments = Dodopayments::Client.new(\n timeout: nil # default is 60\n)\n\n# Or, configure per-request:\ndodo_payments.checkout_sessions.create(\n product_cart: [{product_id: "pdt_example", quantity: 1}],\n request_options: {timeout: 5}\n)\n```\n\nOn timeout, `Dodopayments::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `Dodopayments::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\ncheckout_session_response =\n dodo_payments.checkout_sessions.create(\n product_cart: [{product_id: "pdt_example", quantity: 1}],\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(checkout_session_response[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `Dodopayments::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `Dodopayments::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\ndodo_payments.checkout_sessions.create(\n product_cart: [Dodopayments::ProductItemReq.new(product_id: "pdt_example", quantity: 1)]\n)\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\ndodo_payments.checkout_sessions.create(product_cart: [{product_id: "pdt_example", quantity: 1}])\n\n# You can also splat a full Params class:\nparams = Dodopayments::CheckoutSessionCreateParams.new(\n product_cart: [Dodopayments::ProductItemReq.new(product_id: "pdt_example", quantity: 1)]\n)\ndodo_payments.checkout_sessions.create(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :AED\nputs(Dodopayments::Currency::AED)\n\n# Revealed type: `T.all(Dodopayments::Currency, Symbol)`\nT.reveal_type(Dodopayments::Currency::AED)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\ndodo_payments.checkout_sessions.create(\n billing_currency: Dodopayments::Currency::AED,\n # …\n)\n\n# Literal values are also permissible:\ndodo_payments.checkout_sessions.create(\n billing_currency: :AED,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/dodopayments/dodopayments-ruby/tree/main/CONTRIBUTING.md).\n',
|
|
6692
7457
|
},
|
|
6693
7458
|
{
|
|
6694
7459
|
language: 'typescript',
|
|
6695
|
-
content: "# Dodo Payments TypeScript API Library\n\n[)](https://npmjs.org/package/dodopayments) \n\nThis library provides convenient access to the Dodo Payments REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [docs.dodopayments.com](https://docs.dodopayments.com/api-reference/introduction). The full API of this library can be found in [api.md](api.md).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Dodo Payments MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRvZG9wYXltZW50cy1tY3AiXSwiZW52Ijp7IkRPRE9fUEFZTUVOVFNfQVBJX0tFWSI6Ik15IEJlYXJlciBUb2tlbiIsIkRPRE9fUEFZTUVOVFNfV0VCSE9PS19LRVkiOiJNeSBXZWJob29rIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dodopayments-mcp%22%5D%2C%22env%22%3A%7B%22DODO_PAYMENTS_API_KEY%22%3A%22My%20Bearer%20Token%22%2C%22DODO_PAYMENTS_WEBHOOK_KEY%22%3A%22My%20Webhook%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install dodopayments\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n<!-- prettier-ignore -->\n```js\nimport 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 environment: 'test_mode', // defaults to 'live_mode'\n});\n\nconst checkoutSessionResponse = await client.checkoutSessions.create({\n product_cart: [{ product_id: 'product_id', quantity: 0 }],\n});\n\nconsole.log(checkoutSessionResponse.session_id);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n<!-- prettier-ignore -->\n```ts\nimport 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 environment: 'test_mode', // defaults to 'live_mode'\n});\n\nconst params: DodoPayments.CheckoutSessionCreateParams = {\n product_cart: [{ product_id: 'product_id', quantity: 0 }],\n};\nconst checkoutSessionResponse: DodoPayments.CheckoutSessionResponse =\n await client.checkoutSessions.create(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n<!-- prettier-ignore -->\n```ts\nconst checkoutSessionResponse = await client.checkoutSessions\n .create({ product_cart: [{ product_id: 'product_id', quantity: 0 }] })\n .catch(async (err) => {\n if (err instanceof DodoPayments.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n<!-- prettier-ignore -->\n```js\n// Configure the default for all requests:\nconst client = new DodoPayments({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.checkoutSessions.create({ product_cart: [{ product_id: 'product_id', quantity: 0 }] }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n<!-- prettier-ignore -->\n```ts\n// Configure the default for all requests:\nconst client = new DodoPayments({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.checkoutSessions.create({ product_cart: [{ product_id: 'product_id', quantity: 0 }] }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the DodoPayments API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllPaymentListResponses(params) {\n const allPaymentListResponses = [];\n // Automatically fetches more pages as needed.\n for await (const paymentListResponse of client.payments.list()) {\n allPaymentListResponses.push(paymentListResponse);\n }\n return allPaymentListResponses;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.payments.list();\nfor (const paymentListResponse of page.items) {\n console.log(paymentListResponse);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n page = await page.getNextPage();\n // ...\n}\n```\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n<!-- prettier-ignore -->\n```ts\nconst client = new DodoPayments();\n\nconst response = await client.checkoutSessions\n .create({ product_cart: [{ product_id: 'product_id', quantity: 0 }] })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: checkoutSessionResponse, response: raw } = await client.checkoutSessions\n .create({ product_cart: [{ product_id: 'product_id', quantity: 0 }] })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(checkoutSessionResponse.session_id);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `DODO_PAYMENTS_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport DodoPayments from 'dodopayments';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new DodoPayments({\n logger: logger.child({ name: 'DodoPayments' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.checkoutSessions.create({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport DodoPayments from 'dodopayments';\nimport fetch from 'my-fetch';\n\nconst client = new DodoPayments({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>\n\n```ts\nimport DodoPayments from 'dodopayments';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new DodoPayments({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>\n\n```ts\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>\n\n```ts\nimport DodoPayments from 'npm:dodopayments';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new DodoPayments({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/dodopayments/dodopayments-typescript/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n",
|
|
7460
|
+
content: "# Dodo Payments TypeScript API Library\n\n[)](https://npmjs.org/package/dodopayments) \n\nThis library provides convenient access to the Dodo Payments REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [docs.dodopayments.com](https://docs.dodopayments.com/api-reference/introduction). The full API of this library can be found in [api.md](api.md).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Dodo Payments MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRvZG9wYXltZW50cy1tY3AiXSwiZW52Ijp7IkRPRE9fUEFZTUVOVFNfQVBJX0tFWSI6Ik15IEJlYXJlciBUb2tlbiIsIkRPRE9fUEFZTUVOVFNfV0VCSE9PS19LRVkiOiJNeSBXZWJob29rIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dodopayments-mcp%22%5D%2C%22env%22%3A%7B%22DODO_PAYMENTS_API_KEY%22%3A%22My%20Bearer%20Token%22%2C%22DODO_PAYMENTS_WEBHOOK_KEY%22%3A%22My%20Webhook%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install dodopayments\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n<!-- prettier-ignore -->\n```js\nimport 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 environment: 'test_mode', // defaults to 'live_mode'\n});\n\nconst checkoutSessionResponse = await client.checkoutSessions.create({\n product_cart: [{ product_id: 'pdt_example', quantity: 1 }],\n});\n\nconsole.log(checkoutSessionResponse.session_id);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n<!-- prettier-ignore -->\n```ts\nimport 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 environment: 'test_mode', // defaults to 'live_mode'\n});\n\nconst params: DodoPayments.CheckoutSessionCreateParams = {\n product_cart: [{ product_id: 'pdt_example', quantity: 1 }],\n};\nconst checkoutSessionResponse: DodoPayments.CheckoutSessionResponse =\n await client.checkoutSessions.create(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n<!-- prettier-ignore -->\n```ts\nconst checkoutSessionResponse = await client.checkoutSessions\n .create({ product_cart: [{ product_id: 'pdt_example', quantity: 1 }] })\n .catch(async (err) => {\n if (err instanceof DodoPayments.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n<!-- prettier-ignore -->\n```js\n// Configure the default for all requests:\nconst client = new DodoPayments({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.checkoutSessions.create({ product_cart: [{ product_id: 'pdt_example', quantity: 1 }] }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n<!-- prettier-ignore -->\n```ts\n// Configure the default for all requests:\nconst client = new DodoPayments({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.checkoutSessions.create({ product_cart: [{ product_id: 'pdt_example', quantity: 1 }] }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the DodoPayments API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllPaymentListResponses(params) {\n const allPaymentListResponses = [];\n // Automatically fetches more pages as needed.\n for await (const paymentListResponse of client.payments.list()) {\n allPaymentListResponses.push(paymentListResponse);\n }\n return allPaymentListResponses;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.payments.list();\nfor (const paymentListResponse of page.items) {\n console.log(paymentListResponse);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n page = await page.getNextPage();\n // ...\n}\n```\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n<!-- prettier-ignore -->\n```ts\nconst client = new DodoPayments();\n\nconst response = await client.checkoutSessions\n .create({ product_cart: [{ product_id: 'pdt_example', quantity: 1 }] })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: checkoutSessionResponse, response: raw } = await client.checkoutSessions\n .create({ product_cart: [{ product_id: 'pdt_example', quantity: 1 }] })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(checkoutSessionResponse.session_id);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `DODO_PAYMENTS_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport DodoPayments from 'dodopayments';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new DodoPayments({\n logger: logger.child({ name: 'DodoPayments' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.checkoutSessions.create({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport DodoPayments from 'dodopayments';\nimport fetch from 'my-fetch';\n\nconst client = new DodoPayments({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>\n\n```ts\nimport DodoPayments from 'dodopayments';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new DodoPayments({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>\n\n```ts\nimport DodoPayments from 'dodopayments';\n\nconst client = new DodoPayments({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>\n\n```ts\nimport DodoPayments from 'npm:dodopayments';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new DodoPayments({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/dodopayments/dodopayments-typescript/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n",
|
|
6696
7461
|
},
|
|
6697
7462
|
];
|
|
6698
7463
|
const INDEX_OPTIONS = {
|