stripe-concepts-1.0.2.4: Types for the Stripe API

Safe HaskellSafe
LanguageHaskell2010

Stripe.Concepts

Contents

Synopsis

Modes

data Mode Source #

"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:

Constructors

LiveMode 
TestMode 

data BothModes a Source #

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 BothModes PublishableApiKey to represent your publishable API keys for both live mode and test mode.

Constructors

BothModes 

Fields

Instances
Functor BothModes Source # 
Instance details

Defined in Stripe.Concepts

Methods

fmap :: (a -> b) -> BothModes a -> BothModes b #

(<$) :: a -> BothModes b -> BothModes a #

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:

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

Constructors

PublishableApiKey Text 

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.

Constructors

ApiSecretKey ByteString 

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

newtype TokenId Source #

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

Constructors

TokenId Text 
Instances
Eq TokenId Source # 
Instance details

Defined in Stripe.Concepts

Methods

(==) :: TokenId -> TokenId -> Bool #

(/=) :: TokenId -> TokenId -> Bool #

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

Constructors

CustomerId Text 
Instances
Eq CustomerId Source # 
Instance details

Defined in Stripe.Concepts

newtype ProductId Source #

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

Constructors

ProductId Text 
Instances
Eq ProductId Source # 
Instance details

Defined in Stripe.Concepts

newtype PlanId Source #

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

Constructors

PlanId Text 
Instances
Eq PlanId Source # 
Instance details

Defined in Stripe.Concepts

Methods

(==) :: PlanId -> PlanId -> Bool #

(/=) :: PlanId -> PlanId -> Bool #

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

Constructors

SubscriptionId Text 
Instances
Eq SubscriptionId Source # 
Instance details

Defined in Stripe.Concepts

newtype InvoiceId Source #

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

Constructors

InvoiceId Text 
Instances
Eq InvoiceId Source # 
Instance details

Defined in Stripe.Concepts

newtype CouponId Source #

The ID of a Stripe coupon.

"A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to invoices or orders." - Stripe

Constructors

CouponId Text 
Instances
Eq CouponId Source # 
Instance details

Defined in Stripe.Concepts

API Versioning

newtype ApiVersion Source #

When Stripe makes a backwards-incompatible change to the API, they release a new API version. The versions are named by the date of their release (e.g. "2019-09-09").

Constructors

ApiVersion Text 
Instances
Eq ApiVersion Source # 
Instance details

Defined in Stripe.Concepts

data RequestApiVersion Source #

Your account API settings specify:

  • Which API version is used by default for requests;
  • Which API version is used for webhook events.

However, you can override the API version for specific requests. "To set the API version on a specific request, send a Stripe-Version header." - Stripe

Constructors

DefaultApiVersion

Use the default API version specified by your account settings.

OverrideApiVersion ApiVersion

Use a specific API version for this request. (Please note however that any webhook events generated as a result of this request will still use your account's default API version.)