{-# 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 postSubscriptionItems module StripeAPI.Operations.PostSubscriptionItems 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 -- -- \

Adds a new item to an existing subscription. No existing items will be changed or replaced.\<\/p> postSubscriptionItems :: forall m. StripeAPI.Common.MonadHTTP m => -- | The request body to send PostSubscriptionItemsRequestBody -> -- | Monadic computation which returns the result of the operation StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostSubscriptionItemsResponse) postSubscriptionItems body = GHC.Base.fmap ( \response_0 -> GHC.Base.fmap ( Data.Either.either PostSubscriptionItemsResponseError 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) -> PostSubscriptionItemsResponse200 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) -> PostSubscriptionItemsResponseDefault 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.mempty (GHC.Maybe.Just body) StripeAPI.Common.RequestBodyEncodingFormData) -- | Defines the object schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification. data PostSubscriptionItemsRequestBody = PostSubscriptionItemsRequestBody { -- | 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. postSubscriptionItemsRequestBodyBillingThresholds :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants), -- | expand: Specifies which fields in the response should be expanded. postSubscriptionItemsRequestBodyExpand :: (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\`. postSubscriptionItemsRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object), -- | 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. postSubscriptionItemsRequestBodyPaymentBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'), -- | price: The ID of the price object. -- -- Constraints: -- -- * Maximum length of 5000 postSubscriptionItemsRequestBodyPrice :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | price_data: Data used to generate a new [Price](https:\/\/stripe.com\/docs\/api\/prices) object inline. postSubscriptionItemsRequestBodyPriceData :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyPriceData'), -- | 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\`. postSubscriptionItemsRequestBodyProrationBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyProrationBehavior'), -- | 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. postSubscriptionItemsRequestBodyProrationDate :: (GHC.Maybe.Maybe GHC.Types.Int), -- | quantity: The quantity you\'d like to apply to the subscription item you\'re creating. postSubscriptionItemsRequestBodyQuantity :: (GHC.Maybe.Maybe GHC.Types.Int), -- | subscription: The identifier of the subscription to modify. -- -- Constraints: -- -- * Maximum length of 5000 postSubscriptionItemsRequestBodySubscription :: Data.Text.Internal.Text, -- | 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. postSubscriptionItemsRequestBodyTaxRates :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBody where toJSON obj = Data.Aeson.Types.Internal.object ("billing_thresholds" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyBillingThresholds obj : "expand" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyExpand obj : "metadata" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyMetadata obj : "payment_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPaymentBehavior obj : "price" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPrice obj : "price_data" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData obj : "proration_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyProrationBehavior obj : "proration_date" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyProrationDate obj : "quantity" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyQuantity obj : "subscription" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodySubscription obj : "tax_rates" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyTaxRates obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("billing_thresholds" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyBillingThresholds obj) GHC.Base.<> (("expand" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyExpand obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyMetadata obj) GHC.Base.<> (("payment_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPaymentBehavior obj) GHC.Base.<> (("price" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPrice obj) GHC.Base.<> (("price_data" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData obj) GHC.Base.<> (("proration_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyProrationBehavior obj) GHC.Base.<> (("proration_date" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyProrationDate obj) GHC.Base.<> (("quantity" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyQuantity obj) GHC.Base.<> (("subscription" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodySubscription obj) GHC.Base.<> ("tax_rates" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyTaxRates obj))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBody where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsRequestBody" (\obj -> ((((((((((GHC.Base.pure PostSubscriptionItemsRequestBody 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..:? "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..: "subscription")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tax_rates")) -- | Create a new 'PostSubscriptionItemsRequestBody' with all required fields. mkPostSubscriptionItemsRequestBody :: -- | 'postSubscriptionItemsRequestBodySubscription' Data.Text.Internal.Text -> PostSubscriptionItemsRequestBody mkPostSubscriptionItemsRequestBody postSubscriptionItemsRequestBodySubscription = PostSubscriptionItemsRequestBody { postSubscriptionItemsRequestBodyBillingThresholds = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyExpand = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyMetadata = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyPaymentBehavior = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyPrice = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyPriceData = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyProrationBehavior = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyProrationDate = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyQuantity = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodySubscription = postSubscriptionItemsRequestBodySubscription, postSubscriptionItemsRequestBodyTaxRates = GHC.Maybe.Nothing } -- | Defines the object schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.billing_thresholds.anyOf@ in the specification. data PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 = PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 { -- | usage_gte postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte :: GHC.Types.Int } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 where toJSON obj = Data.Aeson.Types.Internal.object ("usage_gte" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs ("usage_gte" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte obj) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1" (\obj -> GHC.Base.pure PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "usage_gte")) -- | Create a new 'PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1' with all required fields. mkPostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 :: -- | 'postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte' GHC.Types.Int -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 mkPostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte = PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 {postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte = postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte} -- | Defines the oneOf schema located at @paths.\/v1\/subscription_items.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 PostSubscriptionItemsRequestBodyBillingThresholds'Variants = -- | Represents the JSON value @""@ PostSubscriptionItemsRequestBodyBillingThresholds'EmptyString | PostSubscriptionItemsRequestBodyBillingThresholds'PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyBillingThresholds'Variants where toJSON (PostSubscriptionItemsRequestBodyBillingThresholds'PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostSubscriptionItemsRequestBodyBillingThresholds'EmptyString) = "" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyBillingThresholds'Variants where parseJSON val = if | val GHC.Classes.== "" -> GHC.Base.pure PostSubscriptionItemsRequestBodyBillingThresholds'EmptyString | GHC.Base.otherwise -> case (PostSubscriptionItemsRequestBodyBillingThresholds'PostSubscriptionItemsRequestBodyBillingThresholds'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 enum schema located at @paths.\/v1\/subscription_items.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 PostSubscriptionItemsRequestBodyPaymentBehavior' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsRequestBodyPaymentBehavior'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. PostSubscriptionItemsRequestBodyPaymentBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"allow_incomplete"@ PostSubscriptionItemsRequestBodyPaymentBehavior'EnumAllowIncomplete | -- | Represents the JSON value @"default_incomplete"@ PostSubscriptionItemsRequestBodyPaymentBehavior'EnumDefaultIncomplete | -- | Represents the JSON value @"error_if_incomplete"@ PostSubscriptionItemsRequestBodyPaymentBehavior'EnumErrorIfIncomplete | -- | Represents the JSON value @"pending_if_incomplete"@ PostSubscriptionItemsRequestBodyPaymentBehavior'EnumPendingIfIncomplete deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPaymentBehavior' where toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'Other val) = val toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'EnumAllowIncomplete) = "allow_incomplete" toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'EnumDefaultIncomplete) = "default_incomplete" toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'EnumErrorIfIncomplete) = "error_if_incomplete" toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'EnumPendingIfIncomplete) = "pending_if_incomplete" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPaymentBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "allow_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'EnumAllowIncomplete | val GHC.Classes.== "default_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'EnumDefaultIncomplete | val GHC.Classes.== "error_if_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'EnumErrorIfIncomplete | val GHC.Classes.== "pending_if_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'EnumPendingIfIncomplete | GHC.Base.otherwise -> PostSubscriptionItemsRequestBodyPaymentBehavior'Other val ) -- | Defines the object schema located at @paths.\/v1\/subscription_items.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 PostSubscriptionItemsRequestBodyPriceData' = PostSubscriptionItemsRequestBodyPriceData' { -- | currency postSubscriptionItemsRequestBodyPriceData'Currency :: Data.Text.Internal.Text, -- | product -- -- Constraints: -- -- * Maximum length of 5000 postSubscriptionItemsRequestBodyPriceData'Product :: Data.Text.Internal.Text, -- | recurring postSubscriptionItemsRequestBodyPriceData'Recurring :: PostSubscriptionItemsRequestBodyPriceData'Recurring', -- | tax_behavior postSubscriptionItemsRequestBodyPriceData'TaxBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'), -- | unit_amount postSubscriptionItemsRequestBodyPriceData'UnitAmount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | unit_amount_decimal postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData' where toJSON obj = Data.Aeson.Types.Internal.object ("currency" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Currency obj : "product" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Product obj : "recurring" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Recurring obj : "tax_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'TaxBehavior obj : "unit_amount" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'UnitAmount obj : "unit_amount_decimal" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("currency" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Currency obj) GHC.Base.<> (("product" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Product obj) GHC.Base.<> (("recurring" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Recurring obj) GHC.Base.<> (("tax_behavior" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'TaxBehavior obj) GHC.Base.<> (("unit_amount" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'UnitAmount obj) GHC.Base.<> ("unit_amount_decimal" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal obj)))))) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsRequestBodyPriceData'" (\obj -> (((((GHC.Base.pure PostSubscriptionItemsRequestBodyPriceData' 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 'PostSubscriptionItemsRequestBodyPriceData'' with all required fields. mkPostSubscriptionItemsRequestBodyPriceData' :: -- | 'postSubscriptionItemsRequestBodyPriceData'Currency' Data.Text.Internal.Text -> -- | 'postSubscriptionItemsRequestBodyPriceData'Product' Data.Text.Internal.Text -> -- | 'postSubscriptionItemsRequestBodyPriceData'Recurring' PostSubscriptionItemsRequestBodyPriceData'Recurring' -> PostSubscriptionItemsRequestBodyPriceData' mkPostSubscriptionItemsRequestBodyPriceData' postSubscriptionItemsRequestBodyPriceData'Currency postSubscriptionItemsRequestBodyPriceData'Product postSubscriptionItemsRequestBodyPriceData'Recurring = PostSubscriptionItemsRequestBodyPriceData' { postSubscriptionItemsRequestBodyPriceData'Currency = postSubscriptionItemsRequestBodyPriceData'Currency, postSubscriptionItemsRequestBodyPriceData'Product = postSubscriptionItemsRequestBodyPriceData'Product, postSubscriptionItemsRequestBodyPriceData'Recurring = postSubscriptionItemsRequestBodyPriceData'Recurring, postSubscriptionItemsRequestBodyPriceData'TaxBehavior = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyPriceData'UnitAmount = GHC.Maybe.Nothing, postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal = GHC.Maybe.Nothing } -- | Defines the object schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.recurring@ in the specification. data PostSubscriptionItemsRequestBodyPriceData'Recurring' = PostSubscriptionItemsRequestBodyPriceData'Recurring' { -- | interval postSubscriptionItemsRequestBodyPriceData'Recurring'Interval :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval', -- | interval_count postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount :: (GHC.Maybe.Maybe GHC.Types.Int) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData'Recurring' where toJSON obj = Data.Aeson.Types.Internal.object ("interval" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Recurring'Interval obj : "interval_count" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("interval" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Recurring'Interval obj) GHC.Base.<> ("interval_count" Data.Aeson.Types.ToJSON..= postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount obj)) instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData'Recurring' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSubscriptionItemsRequestBodyPriceData'Recurring'" (\obj -> (GHC.Base.pure PostSubscriptionItemsRequestBodyPriceData'Recurring' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "interval")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "interval_count")) -- | Create a new 'PostSubscriptionItemsRequestBodyPriceData'Recurring'' with all required fields. mkPostSubscriptionItemsRequestBodyPriceData'Recurring' :: -- | 'postSubscriptionItemsRequestBodyPriceData'Recurring'Interval' PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval' -> PostSubscriptionItemsRequestBodyPriceData'Recurring' mkPostSubscriptionItemsRequestBodyPriceData'Recurring' postSubscriptionItemsRequestBodyPriceData'Recurring'Interval = PostSubscriptionItemsRequestBodyPriceData'Recurring' { postSubscriptionItemsRequestBodyPriceData'Recurring'Interval = postSubscriptionItemsRequestBodyPriceData'Recurring'Interval, postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount = GHC.Maybe.Nothing } -- | Defines the enum schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.recurring.properties.interval@ in the specification. data PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsRequestBodyPriceData'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. PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"day"@ PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumDay | -- | Represents the JSON value @"month"@ PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumMonth | -- | Represents the JSON value @"week"@ PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumWeek | -- | Represents the JSON value @"year"@ PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumYear deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval' where toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Other val) = val toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumDay) = "day" toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumMonth) = "month" toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumWeek) = "week" toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumYear) = "year" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "day" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumDay | val GHC.Classes.== "month" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumMonth | val GHC.Classes.== "week" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumWeek | val GHC.Classes.== "year" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumYear | GHC.Base.otherwise -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Other val ) -- | Defines the enum schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.tax_behavior@ in the specification. data PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsRequestBodyPriceData'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. PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"exclusive"@ PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumExclusive | -- | Represents the JSON value @"inclusive"@ PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumInclusive | -- | Represents the JSON value @"unspecified"@ PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumUnspecified deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' where toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Other val) = val toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumExclusive) = "exclusive" toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumInclusive) = "inclusive" toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumUnspecified) = "unspecified" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "exclusive" -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumExclusive | val GHC.Classes.== "inclusive" -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumInclusive | val GHC.Classes.== "unspecified" -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumUnspecified | GHC.Base.otherwise -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Other val ) -- | Defines the enum schema located at @paths.\/v1\/subscription_items.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 PostSubscriptionItemsRequestBodyProrationBehavior' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostSubscriptionItemsRequestBodyProrationBehavior'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. PostSubscriptionItemsRequestBodyProrationBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"always_invoice"@ PostSubscriptionItemsRequestBodyProrationBehavior'EnumAlwaysInvoice | -- | Represents the JSON value @"create_prorations"@ PostSubscriptionItemsRequestBodyProrationBehavior'EnumCreateProrations | -- | Represents the JSON value @"none"@ PostSubscriptionItemsRequestBodyProrationBehavior'EnumNone deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyProrationBehavior' where toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'Other val) = val toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'EnumAlwaysInvoice) = "always_invoice" toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'EnumCreateProrations) = "create_prorations" toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'EnumNone) = "none" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyProrationBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "always_invoice" -> PostSubscriptionItemsRequestBodyProrationBehavior'EnumAlwaysInvoice | val GHC.Classes.== "create_prorations" -> PostSubscriptionItemsRequestBodyProrationBehavior'EnumCreateProrations | val GHC.Classes.== "none" -> PostSubscriptionItemsRequestBodyProrationBehavior'EnumNone | GHC.Base.otherwise -> PostSubscriptionItemsRequestBodyProrationBehavior'Other val ) -- | Defines the oneOf schema located at @paths.\/v1\/subscription_items.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 PostSubscriptionItemsRequestBodyTaxRates'Variants = -- | Represents the JSON value @""@ PostSubscriptionItemsRequestBodyTaxRates'EmptyString | PostSubscriptionItemsRequestBodyTaxRates'ListTText ([Data.Text.Internal.Text]) deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyTaxRates'Variants where toJSON (PostSubscriptionItemsRequestBodyTaxRates'ListTText a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostSubscriptionItemsRequestBodyTaxRates'EmptyString) = "" instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyTaxRates'Variants where parseJSON val = if | val GHC.Classes.== "" -> GHC.Base.pure PostSubscriptionItemsRequestBodyTaxRates'EmptyString | GHC.Base.otherwise -> case (PostSubscriptionItemsRequestBodyTaxRates'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 'postSubscriptionItems'. -- -- 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), 'PostSubscriptionItemsResponseError' is used. data PostSubscriptionItemsResponse = -- | Means either no matching case available or a parse error PostSubscriptionItemsResponseError GHC.Base.String | -- | Successful response. PostSubscriptionItemsResponse200 SubscriptionItem | -- | Error response. PostSubscriptionItemsResponseDefault Error deriving (GHC.Show.Show, GHC.Classes.Eq)