Packages
stripity_stripe
3.3.2
3.3.2
3.3.1
3.2.0
3.1.1
3.1.0
3.0.0
2.17.3
2.17.2
2.17.1
2.17.0
2.16.0
2.15.1
2.15.0
2.14.1
2.14.0
2.13.0
2.12.1
2.12.0
2.11.0
2.10.0
2.9.0
2.8.0
2.7.2
2.7.1
2.7.0
2.6.0
2.5.0
2.4.0
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.1.0
2.0.1
2.0.0
2.0.0-alpha.11
2.0.0-alpha.10
2.0.0-alpha.9
2.0.0-alpha.8
2.0.0-alpha.7
2.0.0-alpha.6
2.0.0-alpha.5
2.0.0-alpha.4
2.0.0-alpha.3
2.0.0-alpha.2
2.0.0-alpha.1
1.6.2
1.6.1
1.6.0
1.4.0
1.3.0
1.2.0
1.1.0
0.5.0
0.4.0
0.3.0
0.2.0
A Stripe client for Elixir.
Current section
Files
Jump to
Current section
Files
lib/generated/billing_portal__configuration.ex
defmodule Stripe.BillingPortal.Configuration do
use Stripe.Entity
@moduledoc "A portal configuration describes the functionality and behavior you embed in a portal session. Related guide: [Configure the customer portal](/customer-management/configure-portal)."
(
defstruct [
:active,
:application,
:business_profile,
:created,
:default_return_url,
:features,
:id,
:is_default,
:livemode,
:login_page,
:metadata,
:name,
:object,
:updated
]
@typedoc "The `billing_portal.configuration` type.\n\n * `active` Whether the configuration is active and can be used to create portal sessions.\n * `application` ID of the Connect Application that created the configuration.\n * `business_profile` \n * `created` Time at which the object was created. Measured in seconds since the Unix epoch.\n * `default_return_url` The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session.\n * `features` \n * `id` Unique identifier for the object.\n * `is_default` Whether the configuration is the default. If `true`, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.\n * `livemode` Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.\n * `login_page` \n * `metadata` Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.\n * `name` The name of the configuration.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `updated` Time at which the object was last updated. Measured in seconds since the Unix epoch.\n"
@type t :: %__MODULE__{
active: boolean,
application: (binary | term | term) | nil,
business_profile: term,
created: integer,
default_return_url: binary | nil,
features: term,
id: binary,
is_default: boolean,
livemode: boolean,
login_page: term,
metadata: term | nil,
name: binary | nil,
object: binary,
updated: integer
}
)
(
@typedoc "Control whether the quantity of the product can be adjusted."
@type adjustable_quantity :: %{
optional(:enabled) => boolean,
optional(:maximum) => integer,
optional(:minimum) => integer
}
)
(
@typedoc "The business information shown to customers in the portal."
@type business_profile :: %{
optional(:headline) => binary | binary,
optional(:privacy_policy_url) => binary,
optional(:terms_of_service_url) => binary
}
)
(
@typedoc "Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer"
@type cancellation_reason :: %{
optional(:enabled) => boolean,
optional(:options) =>
list(
:customer_service
| :low_quality
| :missing_features
| :other
| :switched_service
| :too_complex
| :too_expensive
| :unused
)
| binary
}
)
(
@typedoc nil
@type conditions :: %{optional(:type) => :decreasing_item_amount | :shortening_interval}
)
(
@typedoc "Information about updating the customer details in the portal."
@type customer_update :: %{
optional(:allowed_updates) =>
list(:address | :email | :name | :phone | :shipping | :tax_id) | binary,
optional(:enabled) => boolean
}
)
(
@typedoc "Information about the features available in the portal."
@type features :: %{
optional(:customer_update) => customer_update,
optional(:invoice_history) => invoice_history,
optional(:payment_method_update) => payment_method_update,
optional(:subscription_cancel) => subscription_cancel,
optional(:subscription_update) => subscription_update
}
)
(
@typedoc "Information about showing the billing history in the portal."
@type invoice_history :: %{optional(:enabled) => boolean}
)
(
@typedoc "The hosted login page for this configuration. Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share)."
@type login_page :: %{optional(:enabled) => boolean}
)
(
@typedoc "Information about updating payment methods in the portal."
@type payment_method_update :: %{
optional(:enabled) => boolean,
optional(:payment_method_configuration) => binary | binary
}
)
(
@typedoc nil
@type products :: %{
optional(:adjustable_quantity) => adjustable_quantity,
optional(:prices) => list(binary),
optional(:product) => binary
}
)
(
@typedoc "Setting to control when an update should be scheduled at the end of the period instead of applying immediately."
@type schedule_at_period_end :: %{optional(:conditions) => list(conditions)}
)
(
@typedoc "Information about canceling subscriptions in the portal."
@type subscription_cancel :: %{
optional(:cancellation_reason) => cancellation_reason,
optional(:enabled) => boolean,
optional(:mode) => :at_period_end | :immediately,
optional(:proration_behavior) => :always_invoice | :create_prorations | :none
}
)
(
@typedoc "Information about updating subscriptions in the portal."
@type subscription_update :: %{
optional(:default_allowed_updates) =>
list(:price | :promotion_code | :quantity) | binary,
optional(:enabled) => boolean,
optional(:products) => list(products) | binary,
optional(:proration_behavior) => :always_invoice | :create_prorations | :none,
optional(:schedule_at_period_end) => schedule_at_period_end,
optional(:trial_update_behavior) => :continue_trial | :end_trial
}
)
(
nil
@doc "<p>Returns a list of configurations that describe the functionality of the customer portal.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/billing_portal/configurations`\n"
(
@spec list(
params :: %{
optional(:active) => boolean,
optional(:ending_before) => binary,
optional(:expand) => list(binary),
optional(:is_default) => boolean,
optional(:limit) => integer,
optional(:starting_after) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.List.t(Stripe.BillingPortal.Configuration.t())}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def list(params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params("/v1/billing_portal/configurations", [], [])
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
)
(
nil
@doc "<p>Retrieves a configuration that describes the functionality of the customer portal.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/billing_portal/configurations/{configuration}`\n"
(
@spec retrieve(
configuration :: binary(),
params :: %{optional(:expand) => list(binary)},
opts :: Keyword.t()
) ::
{:ok, Stripe.BillingPortal.Configuration.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def retrieve(configuration, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/billing_portal/configurations/{configuration}",
[
%{
__struct__: OpenApiGen.Blueprint.Parameter,
in: "path",
name: "configuration",
required: true,
schema: %{
__struct__: OpenApiGen.Blueprint.Parameter.Schema,
any_of: [],
items: [],
name: "configuration",
properties: [],
title: nil,
type: "string"
}
}
],
[configuration]
)
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
)
(
nil
@doc "<p>Creates a configuration that describes the functionality and behavior of a PortalSession</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/billing_portal/configurations`\n"
(
@spec create(
params :: %{
optional(:business_profile) => business_profile,
optional(:default_return_url) => binary | binary,
optional(:expand) => list(binary),
optional(:features) => features,
optional(:login_page) => login_page,
optional(:metadata) => %{optional(binary) => binary},
optional(:name) => binary | binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.BillingPortal.Configuration.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def create(params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params("/v1/billing_portal/configurations", [], [])
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.make_request()
end
)
)
(
nil
@doc "<p>Updates a configuration that describes the functionality of the customer portal.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/billing_portal/configurations/{configuration}`\n"
(
@spec update(
configuration :: binary(),
params :: %{
optional(:active) => boolean,
optional(:business_profile) => business_profile,
optional(:default_return_url) => binary | binary,
optional(:expand) => list(binary),
optional(:features) => features,
optional(:login_page) => login_page,
optional(:metadata) => %{optional(binary) => binary} | binary,
optional(:name) => binary | binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.BillingPortal.Configuration.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def update(configuration, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/billing_portal/configurations/{configuration}",
[
%{
__struct__: OpenApiGen.Blueprint.Parameter,
in: "path",
name: "configuration",
required: true,
schema: %{
__struct__: OpenApiGen.Blueprint.Parameter.Schema,
any_of: [],
items: [],
name: "configuration",
properties: [],
title: nil,
type: "string"
}
}
],
[configuration]
)
Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.make_request()
end
)
)
end