Stripe balance\<\/a> must be able to cover the payout amount, or you’ll receive an “Insufficient Funds” error.\<\/p>
--
-- \If your API key is in test mode, money won’t actually be sent, though everything else will occur as if in live mode.\<\/p>
--
-- \
If you are creating a manual payout on a Stripe account that uses multiple payment source types, you’ll need to specify the source type balance that the payout should draw from. The \balance object\<\/a> details available and pending amounts by source type.\<\/p>
postPayouts ::
forall m.
StripeAPI.Common.MonadHTTP m =>
-- | The request body to send
PostPayoutsRequestBody ->
-- | Monadic computation which returns the result of the operation
StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostPayoutsResponse)
postPayouts body =
GHC.Base.fmap
( \response_0 ->
GHC.Base.fmap
( Data.Either.either PostPayoutsResponseError 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) ->
PostPayoutsResponse200
Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body ::
Data.Either.Either
GHC.Base.String
Payout
)
| GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) ->
PostPayoutsResponseDefault
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/payouts") GHC.Base.mempty (GHC.Maybe.Just body) StripeAPI.Common.RequestBodyEncodingFormData)
-- | Defines the object schema located at @paths.\/v1\/payouts.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data PostPayoutsRequestBody = PostPayoutsRequestBody
{ -- | amount: A positive integer in cents representing how much to payout.
postPayoutsRequestBodyAmount :: GHC.Types.Int,
-- | 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).
postPayoutsRequestBodyCurrency :: Data.Text.Internal.Text,
-- | description: An arbitrary string attached to the object. Often useful for displaying to users.
--
-- Constraints:
--
-- * Maximum length of 5000
postPayoutsRequestBodyDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
-- | destination: The ID of a bank account or a card to send the payout to. If no destination is supplied, the default external account for the specified currency will be used.
postPayoutsRequestBodyDestination :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
-- | expand: Specifies which fields in the response should be expanded.
postPayoutsRequestBodyExpand :: (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\`.
postPayoutsRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
-- | method: The method used to send this payout, which can be \`standard\` or \`instant\`. \`instant\` is only supported for payouts to debit cards. (See [Instant payouts for marketplaces for more information](https:\/\/stripe.com\/blog\/instant-payouts-for-marketplaces).)
--
-- Constraints:
--
-- * Maximum length of 5000
postPayoutsRequestBodyMethod :: (GHC.Maybe.Maybe PostPayoutsRequestBodyMethod'),
-- | source_type: The balance type of your Stripe balance to draw this payout from. Balances for different payment sources are kept separately. You can find the amounts with the balances API. One of \`bank_account\`, \`card\`, or \`fpx\`.
--
-- Constraints:
--
-- * Maximum length of 5000
postPayoutsRequestBodySourceType :: (GHC.Maybe.Maybe PostPayoutsRequestBodySourceType'),
-- | statement_descriptor: A string to be displayed on the recipient\'s bank or card statement. This may be at most 22 characters. Attempting to use a \`statement_descriptor\` longer than 22 characters will return an error. Note: Most banks will truncate this information and\/or display it inconsistently. Some may not display it at all.
--
-- Constraints:
--
-- * Maximum length of 22
postPayoutsRequestBodyStatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( GHC.Show.Show,
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostPayoutsRequestBody where
toJSON obj = Data.Aeson.Types.Internal.object ("amount" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyAmount obj : "currency" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyCurrency obj : "description" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyDescription obj : "destination" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyDestination obj : "expand" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyExpand obj : "metadata" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyMetadata obj : "method" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyMethod obj : "source_type" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodySourceType obj : "statement_descriptor" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyStatementDescriptor obj : GHC.Base.mempty)
toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("amount" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyAmount obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyCurrency obj) GHC.Base.<> (("description" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyDescription obj) GHC.Base.<> (("destination" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyDestination obj) GHC.Base.<> (("expand" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyExpand obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyMetadata obj) GHC.Base.<> (("method" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyMethod obj) GHC.Base.<> (("source_type" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodySourceType obj) GHC.Base.<> ("statement_descriptor" Data.Aeson.Types.ToJSON..= postPayoutsRequestBodyStatementDescriptor obj)))))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostPayoutsRequestBody where
parseJSON = Data.Aeson.Types.FromJSON.withObject "PostPayoutsRequestBody" (\obj -> ((((((((GHC.Base.pure PostPayoutsRequestBody GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "description")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "destination")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "expand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "method")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "source_type")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "statement_descriptor"))
-- | Create a new 'PostPayoutsRequestBody' with all required fields.
mkPostPayoutsRequestBody ::
-- | 'postPayoutsRequestBodyAmount'
GHC.Types.Int ->
-- | 'postPayoutsRequestBodyCurrency'
Data.Text.Internal.Text ->
PostPayoutsRequestBody
mkPostPayoutsRequestBody postPayoutsRequestBodyAmount postPayoutsRequestBodyCurrency =
PostPayoutsRequestBody
{ postPayoutsRequestBodyAmount = postPayoutsRequestBodyAmount,
postPayoutsRequestBodyCurrency = postPayoutsRequestBodyCurrency,
postPayoutsRequestBodyDescription = GHC.Maybe.Nothing,
postPayoutsRequestBodyDestination = GHC.Maybe.Nothing,
postPayoutsRequestBodyExpand = GHC.Maybe.Nothing,
postPayoutsRequestBodyMetadata = GHC.Maybe.Nothing,
postPayoutsRequestBodyMethod = GHC.Maybe.Nothing,
postPayoutsRequestBodySourceType = GHC.Maybe.Nothing,
postPayoutsRequestBodyStatementDescriptor = GHC.Maybe.Nothing
}
-- | Defines the enum schema located at @paths.\/v1\/payouts.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.method@ in the specification.
--
-- The method used to send this payout, which can be \`standard\` or \`instant\`. \`instant\` is only supported for payouts to debit cards. (See [Instant payouts for marketplaces for more information](https:\/\/stripe.com\/blog\/instant-payouts-for-marketplaces).)
data PostPayoutsRequestBodyMethod'
= -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
PostPayoutsRequestBodyMethod'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.
PostPayoutsRequestBodyMethod'Typed Data.Text.Internal.Text
| -- | Represents the JSON value @"instant"@
PostPayoutsRequestBodyMethod'EnumInstant
| -- | Represents the JSON value @"standard"@
PostPayoutsRequestBodyMethod'EnumStandard
deriving (GHC.Show.Show, GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostPayoutsRequestBodyMethod' where
toJSON (PostPayoutsRequestBodyMethod'Other val) = val
toJSON (PostPayoutsRequestBodyMethod'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
toJSON (PostPayoutsRequestBodyMethod'EnumInstant) = "instant"
toJSON (PostPayoutsRequestBodyMethod'EnumStandard) = "standard"
instance Data.Aeson.Types.FromJSON.FromJSON PostPayoutsRequestBodyMethod' where
parseJSON val =
GHC.Base.pure
( if
| val GHC.Classes.== "instant" -> PostPayoutsRequestBodyMethod'EnumInstant
| val GHC.Classes.== "standard" -> PostPayoutsRequestBodyMethod'EnumStandard
| GHC.Base.otherwise -> PostPayoutsRequestBodyMethod'Other val
)
-- | Defines the enum schema located at @paths.\/v1\/payouts.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.source_type@ in the specification.
--
-- The balance type of your Stripe balance to draw this payout from. Balances for different payment sources are kept separately. You can find the amounts with the balances API. One of \`bank_account\`, \`card\`, or \`fpx\`.
data PostPayoutsRequestBodySourceType'
= -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
PostPayoutsRequestBodySourceType'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.
PostPayoutsRequestBodySourceType'Typed Data.Text.Internal.Text
| -- | Represents the JSON value @"bank_account"@
PostPayoutsRequestBodySourceType'EnumBankAccount
| -- | Represents the JSON value @"card"@
PostPayoutsRequestBodySourceType'EnumCard
| -- | Represents the JSON value @"fpx"@
PostPayoutsRequestBodySourceType'EnumFpx
deriving (GHC.Show.Show, GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostPayoutsRequestBodySourceType' where
toJSON (PostPayoutsRequestBodySourceType'Other val) = val
toJSON (PostPayoutsRequestBodySourceType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
toJSON (PostPayoutsRequestBodySourceType'EnumBankAccount) = "bank_account"
toJSON (PostPayoutsRequestBodySourceType'EnumCard) = "card"
toJSON (PostPayoutsRequestBodySourceType'EnumFpx) = "fpx"
instance Data.Aeson.Types.FromJSON.FromJSON PostPayoutsRequestBodySourceType' where
parseJSON val =
GHC.Base.pure
( if
| val GHC.Classes.== "bank_account" -> PostPayoutsRequestBodySourceType'EnumBankAccount
| val GHC.Classes.== "card" -> PostPayoutsRequestBodySourceType'EnumCard
| val GHC.Classes.== "fpx" -> PostPayoutsRequestBodySourceType'EnumFpx
| GHC.Base.otherwise -> PostPayoutsRequestBodySourceType'Other val
)
-- | Represents a response of the operation 'postPayouts'.
--
-- 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), 'PostPayoutsResponseError' is used.
data PostPayoutsResponse
= -- | Means either no matching case available or a parse error
PostPayoutsResponseError GHC.Base.String
| -- | Successful response.
PostPayoutsResponse200 Payout
| -- | Error response.
PostPayoutsResponseDefault Error
deriving (GHC.Show.Show, GHC.Classes.Eq)