Web.Stripe.Client
- data SConfig = SConfig {}
- newtype APIKey = APIKey {}
- data SResponseCode
- data SFailure
- = BadRequest (Maybe SError)
- | Unauthorized (Maybe SError)
- | NotFound (Maybe SError)
- | PaymentRequired (Maybe SError)
- | InternalServerError (Maybe SError)
- | BadGateway (Maybe SError)
- | ServiceUnavailable (Maybe SError)
- | GatewayTimeout (Maybe SError)
- | OtherFailure (Maybe Text)
- data SError
- = InvalidRequestError {
- ireMessage :: String
- | APIError {
- apiMessage :: String
- | CardError { }
- | UnknownError { }
- = InvalidRequestError {
- data SErrorCode
- data SRequest = SRequest {}
- type Stripe a = StripeT IO a
- newtype StripeT m a = StripeT (StateT SConfig (ErrorT SFailure m) a)
- defaultConfig :: APIKey -> SConfig
- runStripeT :: MonadIO m => SConfig -> StripeT m a -> m (Either SFailure a)
- baseSReq :: SRequest
- query :: (MonadIO m, JSON a) => SRequest -> StripeT m (SResponseCode, a)
- query_ :: MonadIO m => SRequest -> StripeT m ()
- data StdMethod
Documentation
Configuration for the StripeT
monad transformer.
A key used when authenticating to the Stripe API.
data SResponseCode Source
This represents the possible successes that a connection to the Stripe API can encounter. For specificity, a success can be represented by other error codes, and so the same is true in this data type.
Please consult the official Stripe REST API documentation on error codes at https://stripe.com/docs/api#errors for more information.
Instances
This represents the possible failures that a connection to the Stripe API can encounter.
Please consult the official Stripe REST API documentation on error codes at https://stripe.com/docs/api#errors for more information.
Constructors
Describes a SFailure
in more detail, categorizing the error and
providing additional information about it. At minimum, this is a message,
and for CardError
, this is a message, even more precise code
(SErrorCode
), and potentially a paramter that helps suggest where an
error message should be displayed.
In case the appropriate error could not be determined from the specified
type, UnkownError
will be returned with the supplied type and message.
Please consult the official Stripe REST API documentation on error codes at https://stripe.com/docs/api#errors for more information.
Constructors
InvalidRequestError | |
Fields
| |
APIError | |
Fields
| |
CardError | |
UnknownError | |
data SErrorCode Source
Attempts to describe a CardError
in more detail, classifying in what
specific way it failed.
Please consult the official Stripe REST API documentation on error codes at https://stripe.com/docs/api#errors for more information.
Constructors
InvalidNumber | |
IncorrectNumber | |
InvalidExpiryMonth | |
InvalidExpiryYear | |
InvalidCVC | |
ExpiredCard | |
InvalidAmount | |
IncorrectCVC | |
CardDeclined | |
Missing | |
DuplicateTransaction | |
ProcessingError | |
UnknownErrorCode Text | Could not be matched; text gives error name. |
Instances
Represents a request to the Stripe API, providing the fields necessary to
specify a Stripe resource. More generally, baseSReq
will be desired as
it provides sensible defaults that can be overriden as needed.
Constructors
SRequest | |
type Stripe a = StripeT IO aSource
A convenience specialization of the StripeT
monad transformer in which
the underlying monad is IO.
Defines the monad transformer under which all Stripe REST API resource calls take place.
defaultConfig :: APIKey -> SConfigSource
The basic SRequest
environment upon which all other Stripe API requests
will be built. Standard usage involves overriding one or more of the
fields. E.g., for a request to "https:api.stripe.comv1coupons",
one would have:
baseSReq { sDestinaton = ["charges"] }
query :: (MonadIO m, JSON a) => SRequest -> StripeT m (SResponseCode, a)Source
Queries the Stripe API and attempts to parse the results into a data type
that is an instance of JSON
. This is primarily for internal use by other
Stripe submodules, which supply the request values accordingly. However,
it can also be used directly. E.g.,
let conf = SConfig "key" "CA file" runStripeT conf $ query baseSReq { sDestination = ["charges"] }