{-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE MultiWayIf #-} -- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator. {-# LANGUAGE OverloadedStrings #-} -- | Contains the different functions to run the operation postSubscriptionItemsItem module StripeAPI.Operations.PostSubscriptionItemsItem where import qualified Control.Monad.Fail import qualified Control.Monad.Trans.Reader import qualified Data.Aeson import qualified Data.Aeson as Data.Aeson.Encoding.Internal import qualified Data.Aeson as Data.Aeson.Types import qualified Data.Aeson as Data.Aeson.Types.FromJSON import qualified Data.Aeson as Data.Aeson.Types.Internal import qualified Data.Aeson as Data.Aeson.Types.ToJSON import qualified Data.ByteString.Char8 import qualified Data.ByteString.Char8 as Data.ByteString.Internal import qualified Data.Either import qualified Data.Functor import qualified Data.Scientific import qualified Data.Text import qualified Data.Text.Internal import qualified Data.Time.Calendar as Data.Time.Calendar.Days import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime import qualified Data.Vector import qualified GHC.Base import qualified GHC.Classes import qualified GHC.Int import qualified GHC.Show import qualified GHC.Types import qualified Network.HTTP.Client import qualified Network.HTTP.Client as Network.HTTP.Client.Request import qualified Network.HTTP.Client as Network.HTTP.Client.Types import qualified Network.HTTP.Simple import qualified Network.HTTP.Types import qualified Network.HTTP.Types as Network.HTTP.Types.Status import qualified Network.HTTP.Types as Network.HTTP.Types.URI import qualified StripeAPI.Common import StripeAPI.Types import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | > POST /v1/subscription_items/{item} -- -- \

Updates the plan or quantity of an item on a current subscription.\<\/p> postSubscriptionItemsItem :: forall m. StripeAPI.Common.MonadHTTP m => -- | item | Constraints: Maximum length of 5000 Data.Text.Internal.Text -> -- | The request body to send GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBody -> -- | Monadic computation which returns the result of the operation StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostSubscriptionItemsItemResponse) postSubscriptionItemsItem item body = GHC.Base.fmap ( \response_0 -> GHC.Base.fmap ( Data.Either.either PostSubscriptionItemsItemResponseError GHC.Base.id GHC.Base.. ( \response body -> if | (\status_1 -> Network.HTTP.Types.Status.statusCode status_1 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> PostSubscriptionItemsItemResponse200 Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String SubscriptionItem ) | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) -> PostSubscriptionItemsItemResponseDefault Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String Error ) | GHC.Base.otherwise -> Data.Either.Left "Missing default response type" ) response_0 ) response_0 ) (StripeAPI.Common.doBodyCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.pack "POST") (Data.Text.pack ("/v1/subscription_items/" GHC.Base.++ (Data.ByteString.Char8.unpack (Network.HTTP.Types.URI.urlEncode GHC.Types.True GHC.Base.$ (Data.ByteString.Char8.pack GHC.Base.$ StripeAPI.Common.stringifyModel item)) GHC.Base.++ ""))) GHC.Base.mempty body StripeAPI.Common.RequestBodyEncodingFormData) -- | Defines the object schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification. data PostSubscriptionItemsItemRequestBody = PostSubscriptionItemsItemRequestBody { -- | billing_thresholds: Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. postSubscriptionItemsItemRequestBodyBillingThresholds :: (GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBodyBillingThresholds'Variants), -- | expand: Specifies which fields in the response should be expanded. postSubscriptionItemsItemRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])), -- | 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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`. postSubscriptionItemsItemRequestBodyMetadata :: (GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBodyMetadata'Variants), -- | off_session: Indicates if a customer is on or off-session while an invoice payment is attempted. postSubscriptionItemsItemRequestBodyOffSession :: (GHC.Maybe.Maybe GHC.Types.Bool), -- | payment_behavior: Use \`allow_incomplete\` to transition the subscription to \`status=past_due\` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription\'s invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication) for Billing to learn more. This is the default behavior. -- -- Use \`default_incomplete\` to transition the subscription to \`status=past_due\` when payment is required and await explicit confirmation of the invoice\'s payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, [SCA regulation](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication), or collecting a mandate for a bank debit payment method. -- -- Use \`pending_if_incomplete\` to update the subscription using [pending updates](https:\/\/stripe.com\/docs\/billing\/subscriptions\/pending-updates). When you use \`pending_if_incomplete\` you can only pass the parameters [supported by pending updates](https:\/\/stripe.com\/docs\/billing\/pending-updates-reference\#supported-attributes). -- -- Use \`error_if_incomplete\` if you want Stripe to return an HTTP 402 status code if a subscription\'s invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https:\/\/stripe.com\/docs\/upgrades\#2019-03-14) to learn more. postSubscriptionItemsItemRequestBodyPaymentBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBodyPaymentBehavior'), -- | price: The ID of the price object. -- -- Constraints: -- -- * Maximum length of 5000 postSubscriptionItemsItemRequestBodyPrice :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | price_data: Data used to generate a new [Price](https:\/\/stripe.com\/docs\/api\/prices) object inline. postSubscriptionItemsItemRequestBodyPriceData :: (GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBodyPriceData'), -- | proration_behavior: Determines how to handle [prorations](https:\/\/stripe.com\/docs\/subscriptions\/billing-cycle\#prorations) when the billing cycle changes (e.g., when switching plans, resetting \`billing_cycle_anchor=now\`, or starting a trial), or if an item\'s \`quantity\` changes. Valid values are \`create_prorations\`, \`none\`, or \`always_invoice\`. -- -- Passing \`create_prorations\` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https:\/\/stripe.com\/docs\/subscriptions\/upgrading-downgrading\#immediate-payment). In order to always invoice immediately for prorations, pass \`always_invoice\`. -- -- Prorations can be disabled by passing \`none\`. postSubscriptionItemsItemRequestBodyProrationBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBodyProrationBehavior'), -- | proration_date: If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https:\/\/stripe.com\/docs\/api\#retrieve_customer_invoice) endpoint. postSubscriptionItemsItemRequestBodyProrationDate :: (GHC.Maybe.Maybe GHC.Types.Int), -- | quantity: The quantity you\'d like to apply to the subscription item you\'re creating. postSubscriptionItemsItemRequestBodyQuantity :: (GHC.Maybe.Maybe GHC.Types.Int), -- | tax_rates: A list of [Tax Rate](https:\/\/stripe.com\/docs\/api\/tax_rates) ids. These Tax Rates will override the [\`default_tax_rates\`](https:\/\/stripe.com\/docs\/api\/subscriptions\/create\#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. postSubscriptionItemsItemRequestBodyTaxRates :: (GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBodyTaxRates'Variants) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBody where toJSON obj = Data.Aeson.Types.Internal.object ("billing_thresholds" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyBillingThresholds obj : "expand" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyExpand obj : "metadata" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyMetadata obj : "off_session" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyOffSession obj : "payment_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPaymentBehavior obj : "price" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPrice obj : "price_data" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData obj : "proration_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyProrationBehavior obj : "proration_date" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyProrationDate obj : "quantity" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyQuantity obj : "tax_rates" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyTaxRates obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("billing_thresholds" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyBillingThresholds obj) GHC.Base.<> (("expand" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyExpand obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyMetadata obj) GHC.Base.<> (("off_session" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyOffSession obj) GHC.Base.<> (("payment_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPaymentBehavior obj) GHC.Base.<> (("price" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPrice obj) GHC.Base.<> (("price_data" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData obj) GHC.Base.<> (("proration_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyProrationBehavior obj) GHC.Base.<> (("proration_date" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyProrationDate obj) GHC.Base.<> (("quantity" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyQuantity obj) GHC.Base.<> ("tax_rates" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyTaxRates obj))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBody where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsItemRequestBody" (\obj -> ((((((((((GHC.Base.pure PostSubscriptionItemsItemRequestBody GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "billing_thresholds")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "expand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "off_session")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "payment_behavior")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "price")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "price_data")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "proration_behavior")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "proration_date")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "quantity")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tax_rates")) -- | Create a new 'PostSubscriptionItemsItemRequestBody' with all required fields. mkPostSubscriptionItemsItemRequestBody :: PostSubscriptionItemsItemRequestBody mkPostSubscriptionItemsItemRequestBody = PostSubscriptionItemsItemRequestBody { postSubscriptionItemsItemRequestBodyBillingThresholds = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyExpand = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyMetadata = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyOffSession = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyPaymentBehavior = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyPrice = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyPriceData = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyProrationBehavior = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyProrationDate = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyQuantity = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyTaxRates = GHC.Maybe.Nothing } -- | Defines the object schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.billing_thresholds.anyOf@ in the specification. data PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 = PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 { -- | usage_gte postSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1UsageGte :: GHC.Types.Int } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 where toJSON obj = Data.Aeson.Types.Internal.object ("usage_gte" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1UsageGte obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs ("usage_gte" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1UsageGte obj) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1" (\obj -> GHC.Base.pure PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "usage_gte")) -- | Create a new 'PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1' with all required fields. mkPostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 :: -- | 'postSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1UsageGte' GHC.Types.Int -> PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 mkPostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 postSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1UsageGte = PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 {postSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1UsageGte = postSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1UsageGte} -- | Defines the oneOf schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.billing_thresholds.anyOf@ in the specification. -- -- Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. data PostSubscriptionItemsItemRequestBodyBillingThresholds'Variants = -- | Represents the JSON value @""@ PostSubscriptionItemsItemRequestBodyBillingThresholds'EmptyString | PostSubscriptionItemsItemRequestBodyBillingThresholds'PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyBillingThresholds'Variants where toJSON (PostSubscriptionItemsItemRequestBodyBillingThresholds'PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostSubscriptionItemsItemRequestBodyBillingThresholds'EmptyString) = "" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyBillingThresholds'Variants where parseJSON val = if | val GHC.Classes.== "" -> GHC.Base.pure PostSubscriptionItemsItemRequestBodyBillingThresholds'EmptyString | GHC.Base.otherwise -> case (PostSubscriptionItemsItemRequestBodyBillingThresholds'PostSubscriptionItemsItemRequestBodyBillingThresholds'OneOf1 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched" of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the oneOf schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.metadata.anyOf@ in the specification. -- -- 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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`. data PostSubscriptionItemsItemRequestBodyMetadata'Variants = -- | Represents the JSON value @""@ PostSubscriptionItemsItemRequestBodyMetadata'EmptyString | PostSubscriptionItemsItemRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyMetadata'Variants where toJSON (PostSubscriptionItemsItemRequestBodyMetadata'Object a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostSubscriptionItemsItemRequestBodyMetadata'EmptyString) = "" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyMetadata'Variants where parseJSON val = if | val GHC.Classes.== "" -> GHC.Base.pure PostSubscriptionItemsItemRequestBodyMetadata'EmptyString | GHC.Base.otherwise -> case (PostSubscriptionItemsItemRequestBodyMetadata'Object Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched" of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the enum schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_behavior@ in the specification. -- -- Use \`allow_incomplete\` to transition the subscription to \`status=past_due\` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription\'s invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication) for Billing to learn more. This is the default behavior. -- -- Use \`default_incomplete\` to transition the subscription to \`status=past_due\` when payment is required and await explicit confirmation of the invoice\'s payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, [SCA regulation](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication), or collecting a mandate for a bank debit payment method. -- -- Use \`pending_if_incomplete\` to update the subscription using [pending updates](https:\/\/stripe.com\/docs\/billing\/subscriptions\/pending-updates). When you use \`pending_if_incomplete\` you can only pass the parameters [supported by pending updates](https:\/\/stripe.com\/docs\/billing\/pending-updates-reference\#supported-attributes). -- -- Use \`error_if_incomplete\` if you want Stripe to return an HTTP 402 status code if a subscription\'s invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https:\/\/stripe.com\/docs\/upgrades\#2019-03-14) to learn more. data PostSubscriptionItemsItemRequestBodyPaymentBehavior' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsItemRequestBodyPaymentBehavior'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PostSubscriptionItemsItemRequestBodyPaymentBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"allow_incomplete"@ PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumAllowIncomplete | -- | Represents the JSON value @"default_incomplete"@ PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumDefaultIncomplete | -- | Represents the JSON value @"error_if_incomplete"@ PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumErrorIfIncomplete | -- | Represents the JSON value @"pending_if_incomplete"@ PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumPendingIfIncomplete deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyPaymentBehavior' where toJSON (PostSubscriptionItemsItemRequestBodyPaymentBehavior'Other val) = val toJSON (PostSubscriptionItemsItemRequestBodyPaymentBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumAllowIncomplete) = "allow_incomplete" toJSON (PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumDefaultIncomplete) = "default_incomplete" toJSON (PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumErrorIfIncomplete) = "error_if_incomplete" toJSON (PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumPendingIfIncomplete) = "pending_if_incomplete" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyPaymentBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "allow_incomplete" -> PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumAllowIncomplete | val GHC.Classes.== "default_incomplete" -> PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumDefaultIncomplete | val GHC.Classes.== "error_if_incomplete" -> PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumErrorIfIncomplete | val GHC.Classes.== "pending_if_incomplete" -> PostSubscriptionItemsItemRequestBodyPaymentBehavior'EnumPendingIfIncomplete | GHC.Base.otherwise -> PostSubscriptionItemsItemRequestBodyPaymentBehavior'Other val ) -- | Defines the object schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data@ in the specification. -- -- Data used to generate a new [Price](https:\/\/stripe.com\/docs\/api\/prices) object inline. data PostSubscriptionItemsItemRequestBodyPriceData' = PostSubscriptionItemsItemRequestBodyPriceData' { -- | currency postSubscriptionItemsItemRequestBodyPriceData'Currency :: Data.Text.Internal.Text, -- | product -- -- Constraints: -- -- * Maximum length of 5000 postSubscriptionItemsItemRequestBodyPriceData'Product :: Data.Text.Internal.Text, -- | recurring postSubscriptionItemsItemRequestBodyPriceData'Recurring :: PostSubscriptionItemsItemRequestBodyPriceData'Recurring', -- | tax_behavior postSubscriptionItemsItemRequestBodyPriceData'TaxBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'), -- | unit_amount postSubscriptionItemsItemRequestBodyPriceData'UnitAmount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | unit_amount_decimal postSubscriptionItemsItemRequestBodyPriceData'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyPriceData' where toJSON obj = Data.Aeson.Types.Internal.object ("currency" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Currency obj : "product" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Product obj : "recurring" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Recurring obj : "tax_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'TaxBehavior obj : "unit_amount" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'UnitAmount obj : "unit_amount_decimal" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'UnitAmountDecimal obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("currency" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Currency obj) GHC.Base.<> (("product" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Product obj) GHC.Base.<> (("recurring" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Recurring obj) GHC.Base.<> (("tax_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'TaxBehavior obj) GHC.Base.<> (("unit_amount" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'UnitAmount obj) GHC.Base.<> ("unit_amount_decimal" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'UnitAmountDecimal obj)))))) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyPriceData' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsItemRequestBodyPriceData'" (\obj -> (((((GHC.Base.pure PostSubscriptionItemsItemRequestBodyPriceData' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "product")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "recurring")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tax_behavior")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "unit_amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "unit_amount_decimal")) -- | Create a new 'PostSubscriptionItemsItemRequestBodyPriceData'' with all required fields. mkPostSubscriptionItemsItemRequestBodyPriceData' :: -- | 'postSubscriptionItemsItemRequestBodyPriceData'Currency' Data.Text.Internal.Text -> -- | 'postSubscriptionItemsItemRequestBodyPriceData'Product' Data.Text.Internal.Text -> -- | 'postSubscriptionItemsItemRequestBodyPriceData'Recurring' PostSubscriptionItemsItemRequestBodyPriceData'Recurring' -> PostSubscriptionItemsItemRequestBodyPriceData' mkPostSubscriptionItemsItemRequestBodyPriceData' postSubscriptionItemsItemRequestBodyPriceData'Currency postSubscriptionItemsItemRequestBodyPriceData'Product postSubscriptionItemsItemRequestBodyPriceData'Recurring = PostSubscriptionItemsItemRequestBodyPriceData' { postSubscriptionItemsItemRequestBodyPriceData'Currency = postSubscriptionItemsItemRequestBodyPriceData'Currency, postSubscriptionItemsItemRequestBodyPriceData'Product = postSubscriptionItemsItemRequestBodyPriceData'Product, postSubscriptionItemsItemRequestBodyPriceData'Recurring = postSubscriptionItemsItemRequestBodyPriceData'Recurring, postSubscriptionItemsItemRequestBodyPriceData'TaxBehavior = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyPriceData'UnitAmount = GHC.Maybe.Nothing, postSubscriptionItemsItemRequestBodyPriceData'UnitAmountDecimal = GHC.Maybe.Nothing } -- | Defines the object schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.recurring@ in the specification. data PostSubscriptionItemsItemRequestBodyPriceData'Recurring' = PostSubscriptionItemsItemRequestBodyPriceData'Recurring' { -- | interval postSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval :: PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval', -- | interval_count postSubscriptionItemsItemRequestBodyPriceData'Recurring'IntervalCount :: (GHC.Maybe.Maybe GHC.Types.Int) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyPriceData'Recurring' where toJSON obj = Data.Aeson.Types.Internal.object ("interval" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval obj : "interval_count" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Recurring'IntervalCount obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("interval" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval obj) GHC.Base.<> ("interval_count" Data.Aeson.Types.ToJSON..= postSubscriptionItemsItemRequestBodyPriceData'Recurring'IntervalCount obj)) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyPriceData'Recurring' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsItemRequestBodyPriceData'Recurring'" (\obj -> (GHC.Base.pure PostSubscriptionItemsItemRequestBodyPriceData'Recurring' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "interval")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "interval_count")) -- | Create a new 'PostSubscriptionItemsItemRequestBodyPriceData'Recurring'' with all required fields. mkPostSubscriptionItemsItemRequestBodyPriceData'Recurring' :: -- | 'postSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval' PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval' -> PostSubscriptionItemsItemRequestBodyPriceData'Recurring' mkPostSubscriptionItemsItemRequestBodyPriceData'Recurring' postSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval = PostSubscriptionItemsItemRequestBodyPriceData'Recurring' { postSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval = postSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval, postSubscriptionItemsItemRequestBodyPriceData'Recurring'IntervalCount = GHC.Maybe.Nothing } -- | Defines the enum schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.recurring.properties.interval@ in the specification. data PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"day"@ PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumDay | -- | Represents the JSON value @"month"@ PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumMonth | -- | Represents the JSON value @"week"@ PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumWeek | -- | Represents the JSON value @"year"@ PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumYear deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval' where toJSON (PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'Other val) = val toJSON (PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumDay) = "day" toJSON (PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumMonth) = "month" toJSON (PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumWeek) = "week" toJSON (PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumYear) = "year" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "day" -> PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumDay | val GHC.Classes.== "month" -> PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumMonth | val GHC.Classes.== "week" -> PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumWeek | val GHC.Classes.== "year" -> PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'EnumYear | GHC.Base.otherwise -> PostSubscriptionItemsItemRequestBodyPriceData'Recurring'Interval'Other val ) -- | Defines the enum schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.tax_behavior@ in the specification. data PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"exclusive"@ PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumExclusive | -- | Represents the JSON value @"inclusive"@ PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumInclusive | -- | Represents the JSON value @"unspecified"@ PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumUnspecified deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior' where toJSON (PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'Other val) = val toJSON (PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumExclusive) = "exclusive" toJSON (PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumInclusive) = "inclusive" toJSON (PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumUnspecified) = "unspecified" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "exclusive" -> PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumExclusive | val GHC.Classes.== "inclusive" -> PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumInclusive | val GHC.Classes.== "unspecified" -> PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'EnumUnspecified | GHC.Base.otherwise -> PostSubscriptionItemsItemRequestBodyPriceData'TaxBehavior'Other val ) -- | Defines the enum schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.proration_behavior@ in the specification. -- -- Determines how to handle [prorations](https:\/\/stripe.com\/docs\/subscriptions\/billing-cycle\#prorations) when the billing cycle changes (e.g., when switching plans, resetting \`billing_cycle_anchor=now\`, or starting a trial), or if an item\'s \`quantity\` changes. Valid values are \`create_prorations\`, \`none\`, or \`always_invoice\`. -- -- Passing \`create_prorations\` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https:\/\/stripe.com\/docs\/subscriptions\/upgrading-downgrading\#immediate-payment). In order to always invoice immediately for prorations, pass \`always_invoice\`. -- -- Prorations can be disabled by passing \`none\`. data PostSubscriptionItemsItemRequestBodyProrationBehavior' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsItemRequestBodyProrationBehavior'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PostSubscriptionItemsItemRequestBodyProrationBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"always_invoice"@ PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumAlwaysInvoice | -- | Represents the JSON value @"create_prorations"@ PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumCreateProrations | -- | Represents the JSON value @"none"@ PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumNone deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyProrationBehavior' where toJSON (PostSubscriptionItemsItemRequestBodyProrationBehavior'Other val) = val toJSON (PostSubscriptionItemsItemRequestBodyProrationBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumAlwaysInvoice) = "always_invoice" toJSON (PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumCreateProrations) = "create_prorations" toJSON (PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumNone) = "none" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyProrationBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "always_invoice" -> PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumAlwaysInvoice | val GHC.Classes.== "create_prorations" -> PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumCreateProrations | val GHC.Classes.== "none" -> PostSubscriptionItemsItemRequestBodyProrationBehavior'EnumNone | GHC.Base.otherwise -> PostSubscriptionItemsItemRequestBodyProrationBehavior'Other val ) -- | Defines the oneOf schema located at @paths.\/v1\/subscription_items\/{item}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.tax_rates.anyOf@ in the specification. -- -- A list of [Tax Rate](https:\/\/stripe.com\/docs\/api\/tax_rates) ids. These Tax Rates will override the [\`default_tax_rates\`](https:\/\/stripe.com\/docs\/api\/subscriptions\/create\#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. data PostSubscriptionItemsItemRequestBodyTaxRates'Variants = -- | Represents the JSON value @""@ PostSubscriptionItemsItemRequestBodyTaxRates'EmptyString | PostSubscriptionItemsItemRequestBodyTaxRates'ListTText ([Data.Text.Internal.Text]) deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsItemRequestBodyTaxRates'Variants where toJSON (PostSubscriptionItemsItemRequestBodyTaxRates'ListTText a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostSubscriptionItemsItemRequestBodyTaxRates'EmptyString) = "" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsItemRequestBodyTaxRates'Variants where parseJSON val = if | val GHC.Classes.== "" -> GHC.Base.pure PostSubscriptionItemsItemRequestBodyTaxRates'EmptyString | GHC.Base.otherwise -> case (PostSubscriptionItemsItemRequestBodyTaxRates'ListTText Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched" of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Represents a response of the operation 'postSubscriptionItemsItem'. -- -- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'PostSubscriptionItemsItemResponseError' is used. data PostSubscriptionItemsItemResponse = -- | Means either no matching case available or a parse error PostSubscriptionItemsItemResponseError GHC.Base.String | -- | Successful response. PostSubscriptionItemsItemResponse200 SubscriptionItem | -- | Error response. PostSubscriptionItemsItemResponseDefault Error deriving (GHC.Show.Show, GHC.Classes.Eq)