Discount lifecycle and code lookup operations.
Summary
Types
Parameters for discount_customers_attach. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: Dodo OpenAPI schema (the upstream TypeScript endpoint is schema-first).
Parameters for discounts_create. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: locked upstream resources/discounts.ts declaration DiscountCreateParams.
Parameters for discount_customers_list. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: Dodo OpenAPI schema (the upstream TypeScript endpoint is schema-first).
Parameters for discounts_list. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: locked upstream resources/discounts.ts declaration DiscountListParams.
Parameters for discounts_update. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: locked upstream resources/discounts.ts declaration DiscountUpdateParams.
Functions
Calls Dodo operation discount_customers_attach (POST /discounts/{discount_id}/customers). Required parameters: :customer_ids.
Calls Dodo operation discount_customers_attach (POST /discounts/{discount_id}/customers). Required parameters: :customer_ids.
Calls Dodo operation discounts_create (POST /discounts). Required parameters: :type, :amount.
Calls Dodo operation discounts_create (POST /discounts). Required parameters: :type, :amount.
Calls Dodo operation discounts_delete (DELETE /discounts/{discount_id}). Required parameters: none.
Calls Dodo operation discount_customers_detach (DELETE /discounts/{discount_id}/customers/{customer_id}). Required parameters: none.
Calls Dodo operation discounts_list (GET /discounts). Required parameters: none. Numbered pagination is zero-based.
Calls Dodo operation discounts_list (GET /discounts). Required parameters: none. Numbered pagination is zero-based.
Calls Dodo operation discounts_list (GET /discounts). Required parameters: none. Numbered pagination is zero-based.
Calls Dodo operation discount_customers_list (GET /discounts/{discount_id}/customers). Required parameters: none. Numbered pagination is zero-based.
Calls Dodo operation discount_customers_list (GET /discounts/{discount_id}/customers). Required parameters: none. Numbered pagination is zero-based.
Calls Dodo operation discount_customers_list (GET /discounts/{discount_id}/customers). Required parameters: none. Numbered pagination is zero-based.
Calls Dodo operation discounts_retrieve (GET /discounts/{discount_id}). Required parameters: none.
Calls Dodo operation discounts_retrieve_by_code (GET /discounts/code/{code}). Required parameters: none.
Calls Dodo operation discounts_update (PATCH /discounts/{discount_id}). Required parameters: none.
Calls Dodo operation discounts_update (PATCH /discounts/{discount_id}). Required parameters: none.
Calls Dodo operation discounts_update (PATCH /discounts/{discount_id}). Required parameters: none.
Types
@type attach_customers_params() :: %{ :customer_ids => [String.t()], optional(String.t()) => DodoPayments.RequestTypes.input_value() } | DodoPayments.RequestTypes.compatibility_params()
Parameters for discount_customers_attach. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: Dodo OpenAPI schema (the upstream TypeScript endpoint is schema-first).
@type create_params() :: %{ :amount => number(), :type => DodoPayments.Enums.discount_type(), optional(:code) => String.t(), optional(:currency_options) => [ DodoPayments.RequestTypes.discount_currency_option() ], optional(:customer_eligibility) => DodoPayments.Enums.customer_eligibility(), optional(:expires_at) => String.t(), optional(:metadata) => DodoPayments.RequestTypes.flat_metadata(), optional(:name) => String.t(), optional(:per_customer_usage_limit) => number(), optional(:preserve_on_plan_change) => boolean(), optional(:restricted_to) => [String.t()], optional(:starts_at) => String.t(), optional(:subscription_cycles) => number(), optional(:usage_limit) => number(), optional(String.t()) => DodoPayments.RequestTypes.input_value() } | DodoPayments.RequestTypes.compatibility_params()
Parameters for discounts_create. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: locked upstream resources/discounts.ts declaration DiscountCreateParams.
@type list_customers_params() :: %{ optional(:page_number) => number(), optional(:page_size) => number(), optional(String.t()) => DodoPayments.RequestTypes.input_value() } | DodoPayments.RequestTypes.compatibility_params()
Parameters for discount_customers_list. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: Dodo OpenAPI schema (the upstream TypeScript endpoint is schema-first).
@type list_params() :: %{ optional(:page_number) => number(), optional(:page_size) => number(), optional(:active) => boolean(), optional(:code) => String.t(), optional(:discount_type) => DodoPayments.Enums.discount_type(), optional(:product_id) => String.t(), optional(String.t()) => DodoPayments.RequestTypes.input_value() } | DodoPayments.RequestTypes.compatibility_params()
Parameters for discounts_list. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: locked upstream resources/discounts.ts declaration DiscountListParams.
@type update_params() :: %{ optional(:amount) => number(), optional(:code) => String.t(), optional(:currency_options) => [ DodoPayments.RequestTypes.discount_currency_option() ], optional(:customer_eligibility) => DodoPayments.Enums.customer_eligibility(), optional(:expires_at) => String.t(), optional(:metadata) => DodoPayments.RequestTypes.flat_metadata(), optional(:name) => String.t(), optional(:per_customer_usage_limit) => number(), optional(:preserve_on_plan_change) => boolean(), optional(:restricted_to) => [String.t()], optional(:starts_at) => String.t(), optional(:subscription_cycles) => number(), optional(:type) => DodoPayments.Enums.discount_type(), optional(:usage_limit) => number(), optional(String.t()) => DodoPayments.RequestTypes.input_value() } | DodoPayments.RequestTypes.compatibility_params()
Parameters for discounts_update. Exact fields use atom keys; string-keyed and mixed-key maps remain supported. Source: locked upstream resources/discounts.ts declaration DiscountUpdateParams.
Functions
@spec attach_customers( DodoPayments.Client.t(), String.t() | integer(), attach_customers_params() ) :: {:ok, DodoPayments.DiscountCustomersResponse.t()} | {:error, Exception.t()}
Calls Dodo operation discount_customers_attach (POST /discounts/{discount_id}/customers). Required parameters: :customer_ids.
API parameters must be supplied as a map.
@spec attach_customers( DodoPayments.Client.t(), String.t() | integer(), attach_customers_params(), keyword() ) :: {:ok, DodoPayments.DiscountCustomersResponse.t() | DodoPayments.Response.t(DodoPayments.DiscountCustomersResponse.t())} | {:error, Exception.t()}
Calls Dodo operation discount_customers_attach (POST /discounts/{discount_id}/customers). Required parameters: :customer_ids.
The final argument contains request-local options.
@spec create(DodoPayments.Client.t(), create_params()) :: {:ok, DodoPayments.Discount.t()} | {:error, Exception.t()}
Calls Dodo operation discounts_create (POST /discounts). Required parameters: :type, :amount.
API parameters must be supplied as a map.
@spec create(DodoPayments.Client.t(), create_params(), keyword()) :: {:ok, DodoPayments.Discount.t() | DodoPayments.Response.t(DodoPayments.Discount.t())} | {:error, Exception.t()}
Calls Dodo operation discounts_create (POST /discounts). Required parameters: :type, :amount.
The final argument contains request-local options.
@spec delete(DodoPayments.Client.t(), String.t() | integer(), keyword()) :: {:ok, nil | DodoPayments.Response.t(nil)} | {:error, Exception.t()}
Calls Dodo operation discounts_delete (DELETE /discounts/{discount_id}). Required parameters: none.
Options are request-local.
@spec detach_customer( DodoPayments.Client.t(), String.t() | integer(), String.t() | integer(), keyword() ) :: {:ok, nil | DodoPayments.Response.t(nil)} | {:error, Exception.t()}
Calls Dodo operation discount_customers_detach (DELETE /discounts/{discount_id}/customers/{customer_id}). Required parameters: none.
Options are request-local.
@spec list(DodoPayments.Client.t()) :: {:ok, DodoPayments.Page.Numbered.t(DodoPayments.Discount.t())} | {:error, Exception.t()}
Calls Dodo operation discounts_list (GET /discounts). Required parameters: none. Numbered pagination is zero-based.
Calls the operation with an empty parameter map.
@spec list(DodoPayments.Client.t(), list_params() | nil | keyword()) :: {:ok, DodoPayments.Page.Numbered.t(DodoPayments.Discount.t()) | DodoPayments.Response.t( DodoPayments.Page.Numbered.t(DodoPayments.Discount.t()) )} | {:error, Exception.t()}
Calls Dodo operation discounts_list (GET /discounts). Required parameters: none. Numbered pagination is zero-based.
Pass a map for Dodo parameters or a keyword list for request-local options.
@spec list(DodoPayments.Client.t(), list_params() | nil, keyword()) :: {:ok, DodoPayments.Page.Numbered.t(DodoPayments.Discount.t()) | DodoPayments.Response.t( DodoPayments.Page.Numbered.t(DodoPayments.Discount.t()) )} | {:error, Exception.t()}
Calls Dodo operation discounts_list (GET /discounts). Required parameters: none. Numbered pagination is zero-based.
Accepts both a Dodo parameter map and request-local options.
@spec list_customers(DodoPayments.Client.t(), String.t() | integer()) :: {:ok, DodoPayments.Page.Numbered.t(DodoPayments.DiscountCustomer.t())} | {:error, Exception.t()}
Calls Dodo operation discount_customers_list (GET /discounts/{discount_id}/customers). Required parameters: none. Numbered pagination is zero-based.
Calls the operation with an empty parameter map.
@spec list_customers( DodoPayments.Client.t(), String.t() | integer(), list_customers_params() | nil | keyword() ) :: {:ok, DodoPayments.Page.Numbered.t(DodoPayments.DiscountCustomer.t()) | DodoPayments.Response.t( DodoPayments.Page.Numbered.t(DodoPayments.DiscountCustomer.t()) )} | {:error, Exception.t()}
Calls Dodo operation discount_customers_list (GET /discounts/{discount_id}/customers). Required parameters: none. Numbered pagination is zero-based.
Pass a map for Dodo parameters or a keyword list for request-local options.
@spec list_customers( DodoPayments.Client.t(), String.t() | integer(), list_customers_params() | nil, keyword() ) :: {:ok, DodoPayments.Page.Numbered.t(DodoPayments.DiscountCustomer.t()) | DodoPayments.Response.t( DodoPayments.Page.Numbered.t(DodoPayments.DiscountCustomer.t()) )} | {:error, Exception.t()}
Calls Dodo operation discount_customers_list (GET /discounts/{discount_id}/customers). Required parameters: none. Numbered pagination is zero-based.
Accepts both a Dodo parameter map and request-local options.
@spec retrieve(DodoPayments.Client.t(), String.t() | integer(), keyword()) :: {:ok, DodoPayments.Discount.t() | DodoPayments.Response.t(DodoPayments.Discount.t())} | {:error, Exception.t()}
Calls Dodo operation discounts_retrieve (GET /discounts/{discount_id}). Required parameters: none.
Options are request-local.
@spec retrieve_by_code(DodoPayments.Client.t(), String.t() | integer(), keyword()) :: {:ok, DodoPayments.Discount.t() | DodoPayments.Response.t(DodoPayments.Discount.t())} | {:error, Exception.t()}
Calls Dodo operation discounts_retrieve_by_code (GET /discounts/code/{code}). Required parameters: none.
Options are request-local.
@spec update(DodoPayments.Client.t(), String.t() | integer()) :: {:ok, DodoPayments.Discount.t()} | {:error, Exception.t()}
Calls Dodo operation discounts_update (PATCH /discounts/{discount_id}). Required parameters: none.
Calls the operation with an empty parameter map.
@spec update( DodoPayments.Client.t(), String.t() | integer(), update_params() | nil | keyword() ) :: {:ok, DodoPayments.Discount.t() | DodoPayments.Response.t(DodoPayments.Discount.t())} | {:error, Exception.t()}
Calls Dodo operation discounts_update (PATCH /discounts/{discount_id}). Required parameters: none.
Pass a map for Dodo parameters or a keyword list for request-local options.
@spec update( DodoPayments.Client.t(), String.t() | integer(), update_params() | nil, keyword() ) :: {:ok, DodoPayments.Discount.t() | DodoPayments.Response.t(DodoPayments.Discount.t())} | {:error, Exception.t()}
Calls Dodo operation discounts_update (PATCH /discounts/{discount_id}). Required parameters: none.
Accepts both a Dodo parameter map and request-local options.