From 31c5b0bedce8d4de34e838f405400bfa5cea1ebd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Jan 2024 01:37:43 +0000 Subject: [PATCH] Update services based on v751 of Stripe OpenApi SDK Reference: https://github.com/stripe/openapi/releases/tag/v751 --- .latest-tag-stripe-openapi-sdk | 2 +- lib/generated/account.ex | 9 +- lib/generated/payment_intent.ex | 179 +++++++++++++++----------------- lib/generated/setup_intent.ex | 19 ++-- lib/generated/subscription.ex | 66 +++++++----- priv/openapi/spec3.sdk.json | 83 +++++++++++++++ 6 files changed, 219 insertions(+), 139 deletions(-) diff --git a/.latest-tag-stripe-openapi-sdk b/.latest-tag-stripe-openapi-sdk index 9413947d..2c5c0bf2 100644 --- a/.latest-tag-stripe-openapi-sdk +++ b/.latest-tag-stripe-openapi-sdk @@ -1 +1 @@ -v749 +v751 diff --git a/lib/generated/account.ex b/lib/generated/account.ex index 8f8b4bef..30761e17 100644 --- a/lib/generated/account.ex +++ b/lib/generated/account.ex @@ -217,8 +217,8 @@ defmodule Stripe.Account do ) ( - @typedoc "Settings specific to the account's use of the Card Issuing product." - @type card_issuing :: %{optional(:tos_acceptance) => tos_acceptance} + @typedoc "The card_issuing capability." + @type card_issuing :: %{optional(:requested) => boolean} ) ( @@ -578,12 +578,11 @@ defmodule Stripe.Account do ) ( - @typedoc "Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance)." + @typedoc "Details on the account's acceptance of the [Stripe Issuing Terms and Disclosures](https://stripe.com/docs/issuing/connect/tos_acceptance)." @type tos_acceptance :: %{ optional(:date) => integer, optional(:ip) => binary, - optional(:service_agreement) => binary, - optional(:user_agent) => binary + optional(:user_agent) => binary | binary } ) diff --git a/lib/generated/payment_intent.ex b/lib/generated/payment_intent.ex index 784c6b29..76e1d455 100644 --- a/lib/generated/payment_intent.ex +++ b/lib/generated/payment_intent.ex @@ -92,11 +92,11 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc "If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method." + @typedoc nil @type acss_debit :: %{ - optional(:account_number) => binary, - optional(:institution_number) => binary, - optional(:transit_number) => binary + optional(:mandate_options) => mandate_options, + optional(:setup_future_usage) => :none | :off_session | :on_session, + optional(:verification_method) => :automatic | :instant | :microdeposits } ) @@ -149,8 +149,8 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc "If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account." - @type bacs_debit :: %{optional(:account_number) => binary, optional(:sort_code) => binary} + @typedoc nil + @type bacs_debit :: %{optional(:setup_future_usage) => :none | :off_session | :on_session} ) ( @@ -292,8 +292,38 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc nil - @type eps :: %{optional(:setup_future_usage) => :none} + @typedoc "If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method." + @type eps :: %{ + optional(:bank) => + :arzte_und_apotheker_bank + | :austrian_anadi_bank_ag + | :bank_austria + | :bankhaus_carl_spangler + | :bankhaus_schelhammer_und_schattera_ag + | :bawag_psk_ag + | :bks_bank_ag + | :brull_kallmus_bank_ag + | :btv_vier_lander_bank + | :capital_bank_grawe_gruppe_ag + | :deutsche_bank_ag + | :dolomitenbank + | :easybank_ag + | :erste_bank_und_sparkassen + | :hypo_alpeadriabank_international_ag + | :hypo_bank_burgenland_aktiengesellschaft + | :hypo_noe_lb_fur_niederosterreich_u_wien + | :hypo_oberosterreich_salzburg_steiermark + | :hypo_tirol_bank_ag + | :hypo_vorarlberg_bank_ag + | :marchfelder_bank + | :oberbank_ag + | :raiffeisen_bankengruppe_osterreich + | :schoellerbank_ag + | :sparda_bank_wien + | :volksbank_gruppe + | :volkskreditbank_ag + | :vr_bank_braunau + } ) ( @@ -352,25 +382,8 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc "If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method." - @type ideal :: %{ - optional(:bank) => - :abn_amro - | :asn_bank - | :bunq - | :handelsbanken - | :ing - | :knab - | :moneyou - | :n26 - | :rabobank - | :regiobank - | :revolut - | :sns_bank - | :triodos_bank - | :van_lanschot - | :yoursafe - } + @typedoc nil + @type ideal :: %{optional(:setup_future_usage) => :none | :off_session} ) ( @@ -379,56 +392,8 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc nil - @type klarna :: %{ - optional(:capture_method) => :manual, - optional(:preferred_locale) => - :"cs-CZ" - | :"da-DK" - | :"de-AT" - | :"de-CH" - | :"de-DE" - | :"el-GR" - | :"en-AT" - | :"en-AU" - | :"en-BE" - | :"en-CA" - | :"en-CH" - | :"en-CZ" - | :"en-DE" - | :"en-DK" - | :"en-ES" - | :"en-FI" - | :"en-FR" - | :"en-GB" - | :"en-GR" - | :"en-IE" - | :"en-IT" - | :"en-NL" - | :"en-NO" - | :"en-NZ" - | :"en-PL" - | :"en-PT" - | :"en-SE" - | :"en-US" - | :"es-ES" - | :"es-US" - | :"fi-FI" - | :"fr-BE" - | :"fr-CA" - | :"fr-CH" - | :"fr-FR" - | :"it-CH" - | :"it-IT" - | :"nb-NO" - | :"nl-BE" - | :"nl-NL" - | :"pl-PL" - | :"pt-PT" - | :"sv-FI" - | :"sv-SE", - optional(:setup_future_usage) => :none - } + @typedoc "If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method." + @type klarna :: %{optional(:dob) => dob} ) ( @@ -457,17 +422,12 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc "Configuration options for setting up an eMandate for cards issued in India." + @typedoc "Additional fields for Mandate creation" @type mandate_options :: %{ - optional(:amount) => integer, - optional(:amount_type) => :fixed | :maximum, - optional(:description) => binary, - optional(:end_date) => integer, - optional(:interval) => :day | :month | :sporadic | :week | :year, - optional(:interval_count) => integer, - optional(:reference) => binary, - optional(:start_date) => integer, - optional(:supported_types) => list(:india) + optional(:custom_mandate_url) => binary | binary, + optional(:interval_description) => binary, + optional(:payment_schedule) => :combined | :interval | :sporadic, + optional(:transaction_type) => :business | :personal } ) @@ -495,10 +455,34 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc nil + @typedoc "If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method." @type p24 :: %{ - optional(:setup_future_usage) => :none, - optional(:tos_shown_and_accepted) => boolean + optional(:bank) => + :alior_bank + | :bank_millennium + | :bank_nowy_bfg_sa + | :bank_pekao_sa + | :banki_spbdzielcze + | :blik + | :bnp_paribas + | :boz + | :citi_handlowy + | :credit_agricole + | :envelobank + | :etransfer_pocztowy24 + | :getin_bank + | :ideabank + | :ing + | :inteligo + | :mbank_mtransfer + | :nest_przelew + | :noble_pay + | :pbac_z_ipko + | :plus_bank + | :santander_przelew24 + | :tmobile_usbugi_bankowe + | :toyota_bank + | :volkswagen_bank } ) @@ -676,7 +660,7 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc "Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information." + @typedoc "Options to configure Radar. Learn more about [Radar Sessions](https://stripe.com/docs/radar/radar-session)." @type radar_options :: %{optional(:session) => binary} ) @@ -729,14 +713,13 @@ defmodule Stripe.PaymentIntent do ) ( - @typedoc nil + @typedoc "If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method." @type us_bank_account :: %{ - optional(:financial_connections) => financial_connections, - optional(:mandate_options) => mandate_options, - optional(:networks) => networks, - optional(:preferred_settlement_speed) => :fastest | :standard, - optional(:setup_future_usage) => :none | :off_session | :on_session, - optional(:verification_method) => :automatic | :instant | :microdeposits + optional(:account_holder_type) => :company | :individual, + optional(:account_number) => binary, + optional(:account_type) => :checking | :savings, + optional(:financial_connections_account) => binary, + optional(:routing_number) => binary } ) diff --git a/lib/generated/setup_intent.ex b/lib/generated/setup_intent.ex index 0b0b6a5a..c8cf6526 100644 --- a/lib/generated/setup_intent.ex +++ b/lib/generated/setup_intent.ex @@ -62,11 +62,11 @@ defmodule Stripe.SetupIntent do ) ( - @typedoc "If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method." + @typedoc "If this is a `acss_debit` SetupIntent, this sub-hash contains details about the ACSS Debit payment method options." @type acss_debit :: %{ - optional(:account_number) => binary, - optional(:institution_number) => binary, - optional(:transit_number) => binary + optional(:currency) => :cad | :usd, + optional(:mandate_options) => mandate_options, + optional(:verification_method) => :automatic | :instant | :microdeposits } ) @@ -469,12 +469,13 @@ defmodule Stripe.SetupIntent do ) ( - @typedoc "If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options." + @typedoc "If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method." @type us_bank_account :: %{ - optional(:financial_connections) => financial_connections, - optional(:mandate_options) => mandate_options, - optional(:networks) => networks, - optional(:verification_method) => :automatic | :instant | :microdeposits + optional(:account_holder_type) => :company | :individual, + optional(:account_number) => binary, + optional(:account_type) => :checking | :savings, + optional(:financial_connections_account) => binary, + optional(:routing_number) => binary } ) diff --git a/lib/generated/subscription.ex b/lib/generated/subscription.ex index 8bc2db6c..164142c5 100644 --- a/lib/generated/subscription.ex +++ b/lib/generated/subscription.ex @@ -24,6 +24,7 @@ defmodule Stripe.Subscription do :automatic_tax, :test_clock, :billing_cycle_anchor, + :billing_cycle_anchor_config, :object, :cancel_at_period_end, :default_source, @@ -49,12 +50,13 @@ defmodule Stripe.Subscription do :application_fee_percent ] - @typedoc "The `subscription` type.\n\n * `application` ID of the Connect Application that created the subscription.\n * `application_fee_percent` A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.\n * `automatic_tax` \n * `billing_cycle_anchor` The reference point that aligns future [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle) dates. It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals. The timestamp is in UTC format.\n * `billing_thresholds` Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period\n * `cancel_at` A date in the future at which the subscription will automatically get canceled\n * `cancel_at_period_end` If the subscription has been canceled with the `at_period_end` flag set to `true`, `cancel_at_period_end` on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.\n * `canceled_at` If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.\n * `cancellation_details` Details about why this subscription was cancelled\n * `collection_method` Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.\n * `created` Time at which the object was created. Measured in seconds since the Unix epoch.\n * `currency` Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).\n * `current_period_end` End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.\n * `current_period_start` Start of the current period that the subscription has been invoiced for.\n * `customer` ID of the customer who owns the subscription.\n * `days_until_due` Number of days a customer has to pay invoices generated by this subscription. This value will be `null` for subscriptions where `collection_method=charge_automatically`.\n * `default_payment_method` ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over `default_source`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).\n * `default_source` ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If `default_payment_method` is also set, `default_payment_method` will take precedence. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).\n * `default_tax_rates` The tax rates that will apply to any subscription item that does not have `tax_rates` set. Invoices created will have their `default_tax_rates` populated from the subscription.\n * `description` The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.\n * `discount` Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis.\n * `ended_at` If the subscription has ended, the date the subscription ended.\n * `id` Unique identifier for the object.\n * `items` List of subscription items, each with an attached price.\n * `latest_invoice` The most recent invoice this subscription has generated.\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 * `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 * `next_pending_invoice_item_invoice` Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `on_behalf_of` The account (if any) the charge was made on behalf of for charges associated with this subscription. See the Connect documentation for details.\n * `pause_collection` If specified, payment collection for this subscription will be paused.\n * `payment_settings` Payment settings passed on to invoices created by the subscription.\n * `pending_invoice_item_interval` Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval.\n * `pending_setup_intent` You can use this [SetupIntent](https://stripe.com/docs/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2).\n * `pending_update` If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid.\n * `schedule` The schedule attached to the subscription\n * `start_date` Date when the subscription was first created. The date might differ from the `created` date due to backdating.\n * `status` Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, or `unpaid`. \n\nFor `collection_method=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` state. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal state, the open invoice will be voided and no further invoices will be generated. \n\nA subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over. \n\nIf subscription `collection_method=charge_automatically`, it becomes `past_due` when payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will become `canceled` or `unpaid` (depending on your subscriptions settings). \n\nIf subscription `collection_method=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.\n * `test_clock` ID of the test clock this subscription belongs to.\n * `transfer_data` The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.\n * `trial_end` If the subscription has a trial, the end of that trial.\n * `trial_settings` Settings related to subscription trials.\n * `trial_start` If the subscription has a trial, the beginning of that trial.\n" + @typedoc "The `subscription` type.\n\n * `application` ID of the Connect Application that created the subscription.\n * `application_fee_percent` A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.\n * `automatic_tax` \n * `billing_cycle_anchor` The reference point that aligns future [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle) dates. It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals. The timestamp is in UTC format.\n * `billing_cycle_anchor_config` The fixed values used to calculate the `billing_cycle_anchor`.\n * `billing_thresholds` Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period\n * `cancel_at` A date in the future at which the subscription will automatically get canceled\n * `cancel_at_period_end` If the subscription has been canceled with the `at_period_end` flag set to `true`, `cancel_at_period_end` on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.\n * `canceled_at` If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.\n * `cancellation_details` Details about why this subscription was cancelled\n * `collection_method` Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.\n * `created` Time at which the object was created. Measured in seconds since the Unix epoch.\n * `currency` Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).\n * `current_period_end` End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.\n * `current_period_start` Start of the current period that the subscription has been invoiced for.\n * `customer` ID of the customer who owns the subscription.\n * `days_until_due` Number of days a customer has to pay invoices generated by this subscription. This value will be `null` for subscriptions where `collection_method=charge_automatically`.\n * `default_payment_method` ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over `default_source`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).\n * `default_source` ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If `default_payment_method` is also set, `default_payment_method` will take precedence. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).\n * `default_tax_rates` The tax rates that will apply to any subscription item that does not have `tax_rates` set. Invoices created will have their `default_tax_rates` populated from the subscription.\n * `description` The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.\n * `discount` Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis.\n * `ended_at` If the subscription has ended, the date the subscription ended.\n * `id` Unique identifier for the object.\n * `items` List of subscription items, each with an attached price.\n * `latest_invoice` The most recent invoice this subscription has generated.\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 * `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 * `next_pending_invoice_item_invoice` Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `on_behalf_of` The account (if any) the charge was made on behalf of for charges associated with this subscription. See the Connect documentation for details.\n * `pause_collection` If specified, payment collection for this subscription will be paused.\n * `payment_settings` Payment settings passed on to invoices created by the subscription.\n * `pending_invoice_item_interval` Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval.\n * `pending_setup_intent` You can use this [SetupIntent](https://stripe.com/docs/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2).\n * `pending_update` If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid.\n * `schedule` The schedule attached to the subscription\n * `start_date` Date when the subscription was first created. The date might differ from the `created` date due to backdating.\n * `status` Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, or `unpaid`. \n\nFor `collection_method=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` state. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal state, the open invoice will be voided and no further invoices will be generated. \n\nA subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over. \n\nIf subscription `collection_method=charge_automatically`, it becomes `past_due` when payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will become `canceled` or `unpaid` (depending on your subscriptions settings). \n\nIf subscription `collection_method=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.\n * `test_clock` ID of the test clock this subscription belongs to.\n * `transfer_data` The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.\n * `trial_end` If the subscription has a trial, the end of that trial.\n * `trial_settings` Settings related to subscription trials.\n * `trial_start` If the subscription has a trial, the beginning of that trial.\n" @type t :: %__MODULE__{ application: (binary | term | term) | nil, application_fee_percent: term | nil, automatic_tax: term, billing_cycle_anchor: integer, + billing_cycle_anchor_config: term | nil, billing_thresholds: term | nil, cancel_at: integer | nil, cancel_at_period_end: boolean, @@ -133,6 +135,17 @@ defmodule Stripe.Subscription do } ) + ( + @typedoc "Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC." + @type billing_cycle_anchor_config :: %{ + optional(:day_of_month) => integer, + optional(:hour) => integer, + optional(:minute) => integer, + optional(:month) => integer, + optional(:second) => integer + } + ) + ( @typedoc nil @type billing_thresholds :: %{ @@ -446,43 +459,44 @@ defmodule Stripe.Subscription do ( @spec create( params :: %{ - optional(:add_invoice_items) => list(add_invoice_items), optional(:application_fee_percent) => number, - optional(:automatic_tax) => automatic_tax, - optional(:backdate_start_date) => integer, - optional(:billing_cycle_anchor) => integer, - optional(:billing_thresholds) => billing_thresholds | binary, - optional(:cancel_at) => integer, - optional(:cancel_at_period_end) => boolean, + optional(:add_invoice_items) => list(add_invoice_items), optional(:collection_method) => :charge_automatically | :send_invoice, - optional(:coupon) => binary, - optional(:currency) => binary, - optional(:customer) => binary, - optional(:days_until_due) => integer, optional(:default_payment_method) => binary, - optional(:default_source) => binary, - optional(:default_tax_rates) => list(binary) | binary, - optional(:description) => binary, optional(:expand) => list(binary), - optional(:items) => list(items), + optional(:coupon) => binary, optional(:metadata) => %{optional(binary) => binary} | binary, - optional(:off_session) => boolean, + optional(:description) => binary, optional(:on_behalf_of) => binary | binary, + optional(:customer) => binary, + optional(:days_until_due) => integer, + optional(:promotion_code) => binary, + optional(:payment_settings) => payment_settings, + optional(:pending_invoice_item_interval) => + pending_invoice_item_interval | binary, + optional(:billing_thresholds) => billing_thresholds | binary, + optional(:default_source) => binary, + optional(:cancel_at_period_end) => boolean, + optional(:trial_from_plan) => boolean, + optional(:billing_cycle_anchor_config) => billing_cycle_anchor_config, + optional(:billing_cycle_anchor) => integer, + optional(:trial_period_days) => integer, + optional(:automatic_tax) => automatic_tax, + optional(:currency) => binary, + optional(:trial_end) => :now | integer, + optional(:cancel_at) => integer, + optional(:trial_settings) => trial_settings, optional(:payment_behavior) => :allow_incomplete | :default_incomplete | :error_if_incomplete | :pending_if_incomplete, - optional(:payment_settings) => payment_settings, - optional(:pending_invoice_item_interval) => - pending_invoice_item_interval | binary, - optional(:promotion_code) => binary, - optional(:proration_behavior) => :always_invoice | :create_prorations | :none, + optional(:items) => list(items), optional(:transfer_data) => transfer_data, - optional(:trial_end) => :now | integer, - optional(:trial_from_plan) => boolean, - optional(:trial_period_days) => integer, - optional(:trial_settings) => trial_settings + optional(:proration_behavior) => :always_invoice | :create_prorations | :none, + optional(:off_session) => boolean, + optional(:default_tax_rates) => list(binary) | binary, + optional(:backdate_start_date) => integer }, opts :: Keyword.t() ) :: diff --git a/priv/openapi/spec3.sdk.json b/priv/openapi/spec3.sdk.json index 6c6fd1cd..a2616f2c 100644 --- a/priv/openapi/spec3.sdk.json +++ b/priv/openapi/spec3.sdk.json @@ -46076,6 +46076,15 @@ "format": "unix-time", "type": "integer" }, + "billing_cycle_anchor_config": { + "anyOf": [ + { + "$ref": "#/components/schemas/subscriptions_resource_billing_cycle_anchor_config" + } + ], + "description": "The fixed values used to calculate the `billing_cycle_anchor`.", + "nullable": true + }, "billing_thresholds": { "anyOf": [ { @@ -46540,6 +46549,7 @@ "x-expandableFields": [ "application", "automatic_tax", + "billing_cycle_anchor_config", "billing_thresholds", "cancellation_details", "customer", @@ -47851,6 +47861,45 @@ "destination" ] }, + "subscriptions_resource_billing_cycle_anchor_config": { + "description": "", + "properties": { + "day_of_month": { + "description": "The day of the month of the billing_cycle_anchor.", + "type": "integer" + }, + "hour": { + "description": "The hour of the day of the billing_cycle_anchor.", + "nullable": true, + "type": "integer" + }, + "minute": { + "description": "The minute of the hour of the billing_cycle_anchor.", + "nullable": true, + "type": "integer" + }, + "month": { + "description": "The month to start full cycle billing periods.", + "nullable": true, + "type": "integer" + }, + "second": { + "description": "The second of the minute of the billing_cycle_anchor.", + "nullable": true, + "type": "integer" + } + }, + "required": [ + "day_of_month", + "hour", + "minute", + "month", + "second" + ], + "title": "SubscriptionsResourceBillingCycleAnchorConfig", + "type": "object", + "x-expandableFields": [] + }, "subscriptions_resource_pause_collection": { "description": "The Pause Collection settings determine how we will pause collection for this subscription and for how long the subscription\nshould be paused.", "properties": { @@ -129973,6 +130022,10 @@ "explode": true, "style": "deepObject" }, + "billing_cycle_anchor_config": { + "explode": true, + "style": "deepObject" + }, "billing_thresholds": { "explode": true, "style": "deepObject" @@ -130128,6 +130181,36 @@ "type": "integer", "x-stripeBypassValidation": true }, + "billing_cycle_anchor_config": { + "description": "Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC.", + "properties": { + "day_of_month": { + "description": "The day of the month the billing_cycle_anchor should be. Ranges from 1 to 31.", + "type": "integer" + }, + "hour": { + "description": "The hour of the day the billing_cycle_anchor should be. Ranges from 0 to 23.", + "type": "integer" + }, + "minute": { + "description": "The minute of the hour the billing_cycle_anchor should be. Ranges from 0 to 59.", + "type": "integer" + }, + "month": { + "description": "The month to start full cycle billing periods. Ranges from 1 to 12.", + "type": "integer" + }, + "second": { + "description": "The second of the minute the billing_cycle_anchor should be. Ranges from 0 to 59.", + "type": "integer" + } + }, + "required": [ + "day_of_month" + ], + "title": "billing_cycle_anchor_config_param", + "type": "object" + }, "billing_thresholds": { "anyOf": [ {