Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data Mode
- data BothModes a = BothModes {}
- applyMode :: Mode -> BothModes a -> a
- isLiveMode :: Mode -> Bool
- isTestMode :: Mode -> Bool
- isLiveMode' :: Bool -> Mode
- isTestMode' :: Bool -> Mode
- newtype PublishableApiKey = PublishableApiKey Text
- newtype ApiSecretKey = ApiSecretKey ByteString
- textToApiSecretKey :: Text -> ApiSecretKey
- newtype WebhookSecretKey = WebhookSecretKey ByteString
- textToWebhookSecretKey :: Text -> WebhookSecretKey
- newtype TokenId = TokenId Text
- newtype CustomerId = CustomerId Text
- newtype ProductId = ProductId Text
- newtype PlanId = PlanId Text
- newtype SubscriptionId = SubscriptionId Text
- newtype InvoiceId = InvoiceId Text
Modes
"To make the API as explorable as possible, accounts have test mode and
live mode API keys. There is no switch
for changing between modes, just use
the appropriate key to perform a live or test transaction. Requests made with
test mode credentials never hit the banking networks and incur no cost." -
Stripe
This library provides functions to convert back and forth between Mode
and
Bool
:
isLiveMode
(and its inverse,isLiveMode'
)isTestMode
(and its inverse,isTestMode'
)
A pair of values of the same type, one for live mode and one for test mode.
For example, you may wish to use a value of type
to represent your publishable API keys for both live mode
and test mode. BothModes
PublishableApiKey
Conversion with Bool
isLiveMode :: Mode -> Bool Source #
LiveMode → True; TestMode → False
isTestMode :: Mode -> Bool Source #
LiveMode → False; TestMode → True
isLiveMode' :: Bool -> Mode Source #
True → LiveMode; False → TestMode
isTestMode' :: Bool -> Mode Source #
True → TestMode; False → LiveMode
Keys
Each Stripe account has a pair of API keys involved in making requests to the Stripe API:
- The publishable key (
PublishableApiKey
) - The secret key (
ApiSecretKey
)
Each webhook endpoint you set up has a "signing secret" (WebhookSecretKey
)
that you use to verify the authenticity of the webhook events you receive *from*
Stripe.
newtype PublishableApiKey Source #
Publishable API keys are used in client-side code.
"Publishable API keys are meant solely to identify your account with Stripe, they aren’t secret. In other words, they can safely be published in places like your Stripe.js JavaScript code, or in an Android or iPhone app. Publishable keys only have the power to create tokens." - Stripe
Secret API key
newtype ApiSecretKey Source #
API secret keys are used to make requests to Stripe.
"Authenticate your account when using the API by including your secret API key in the request. You can manage your API keys in the Dashboard. Your API keys carry many privileges, so be sure to keep them secret!" - Stripe
The key is represented here as a ByteString
, but you are
likely have the data as a Text
value. You can use
textToApiSecretKey
to do this conversion.
textToApiSecretKey :: Text -> ApiSecretKey Source #
Convert a Text
representation of a Stripe API key (that looks
something like "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
) to an ApiSecretKey
.
Webhook secret
newtype WebhookSecretKey Source #
Webhook secrets are used to verify the authenticity of webhook events that you receive from Stripe.
"Stripe can optionally sign the webhook events it sends to your endpoints. We do so by including a signature in each event’s Stripe-Signature header. This allows you to validate that the events were sent by Stripe, not by a third party. [...] Before you can verify signatures, you need to retrieve your endpoint’s secret from your Dashboard’s Webhooks settings. - Stripe
The key is represented here as a ByteString
, but you are
likely have the data as a Text
value. You can use
textToWebhookSecretKey
to do this conversion.
textToWebhookSecretKey :: Text -> WebhookSecretKey Source #
Convert a Text
representation of a Stripe webhook secret (that
looks something like "whsec_ojm5cmJMGMTw3w7ngjI7mgkRsFGLRtCt"
) to a
WebhookSecretKey
.
Identifiers
Identifier of a Stripe "token", which represents a payment source that was submitted by a user to Stripe.
"This ensures that no sensitive card data touches your server, and allows your integration to operate in a PCI-compliant way." - Stripe
newtype CustomerId Source #
A customer identifier assigned by Stripe.
"Customer objects allow you to perform recurring charges, and to track multiple charges, that are associated with the same customer." - Stripe
Instances
Eq CustomerId Source # | |
Defined in Stripe.Concepts (==) :: CustomerId -> CustomerId -> Bool # (/=) :: CustomerId -> CustomerId -> Bool # |
The ID of a Stripe product.
"Product objects describe items that your customers can subscribe to with a Subscription. An associated Plan determines the product pricing." - Stripe
The ID of a Stripe subscription plan.
"Plans define the base price, currency, and billing cycle for subscriptions. For example, you might have a $5/month plan that provides limited access to your products, and a $15/month plan that allows full access." - Stripe
newtype SubscriptionId Source #
Identifier for a customer's subscription to a product.
"Subscriptions allow you to charge a customer on a recurring basis. A subscription ties a customer to a particular plan you've created." - Stripe
Instances
Eq SubscriptionId Source # | |
Defined in Stripe.Concepts (==) :: SubscriptionId -> SubscriptionId -> Bool # (/=) :: SubscriptionId -> SubscriptionId -> Bool # |
The ID of a Stripe invoice.
"Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription." - Stripe