Copyright | (c) David Johnson, 2014 |
---|---|
Maintainer | djohnson.m@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
https://stripe.com/docs/api#cards
{-# LANGUAGE OverloadedStrings #-} import Web.Stripe import Web.Stripe.Customer import Web.Stripe.Card main :: IO () main = do let config = StripeConfig (StripeKey "secret_key") credit = CardNumber "4242424242424242" em = ExpMonth 12 ey = ExpYear 2015 cvc = CVC "123" cardinfo = (mkNewCard credit em ey) { newCardCVC = Just cvc } result <- stripe config $ createCustomer case result of (Left stripeError) -> print stripeError (Right (Customer { customerId = cid })) -> do result <- stripe config $ createCustomerCard cid cardinfo case result of Right card -> print card Left stripeError -> print stripeError
- data CreateCustomerCardByToken
- createCustomerCardByToken :: CustomerId -> TokenId -> StripeRequest CreateCustomerCardByToken
- data CreateRecipientCardByToken
- createRecipientCardByToken :: RecipientId -> TokenId -> StripeRequest CreateRecipientCardByToken
- data CreateCustomerCard
- createCustomerCard :: CustomerId -> NewCard -> StripeRequest CreateCustomerCard
- data CreateRecipientCard
- createRecipientCard :: RecipientId -> NewCard -> StripeRequest CreateRecipientCard
- data GetCustomerCard
- getCustomerCard :: CustomerId -> CardId -> StripeRequest GetCustomerCard
- data GetRecipientCard
- getRecipientCard :: RecipientId -> RecipientCardId -> StripeRequest GetRecipientCard
- data GetCustomerCards
- getCustomerCards :: CustomerId -> StripeRequest GetCustomerCards
- data GetRecipientCards
- getRecipientCards :: RecipientId -> StripeRequest GetRecipientCards
- data UpdateCustomerCard
- updateCustomerCard :: CustomerId -> CardId -> StripeRequest UpdateCustomerCard
- data UpdateRecipientCard
- updateRecipientCard :: RecipientId -> RecipientCardId -> StripeRequest UpdateRecipientCard
- data DeleteCustomerCard
- deleteCustomerCard :: CustomerId -> CardId -> StripeRequest DeleteCustomerCard
- data DeleteRecipientCard
- deleteRecipientCard :: RecipientId -> RecipientCardId -> StripeRequest DeleteRecipientCard
- newtype AddressLine1 = AddressLine1 Text
- newtype AddressLine2 = AddressLine2 Text
- newtype AddressCity = AddressCity Text
- newtype AddressCountry = AddressCountry Text
- newtype AddressState = AddressState Text
- newtype AddressZip = AddressZip Text
- data Brand
- = Visa
- | AMEX
- | MasterCard
- | Discover
- | JCB
- | DinersClub
- | Unknown
- data Card = Card {
- cardId :: CardId
- cardObject :: Text
- cardLastFour :: Text
- cardBrand :: Brand
- cardFunding :: Text
- cardExpMonth :: ExpMonth
- cardExpYear :: ExpYear
- cardFingerprint :: Text
- cardCountry :: Text
- cardName :: Maybe Name
- cardAddressLine1 :: Maybe AddressLine1
- cardAddressLine2 :: Maybe AddressLine2
- cardAddressCity :: Maybe AddressCity
- cardAddressState :: Maybe AddressState
- cardAddressZip :: Maybe AddressZip
- cardAddressCountry :: Maybe AddressCountry
- cardCVCCheck :: Maybe Text
- cardAddressLine1Check :: Maybe Text
- cardAddressZipCheck :: Maybe Text
- cardCustomerId :: Maybe (Expandable CustomerId)
- newtype CardId = CardId Text
- newtype CardNumber = CardNumber Text
- newtype CVC = CVC Text
- newtype EndingBefore a = EndingBefore a
- newtype ExpandParams = ExpandParams {
- getExpandParams :: [Text]
- newtype ExpMonth = ExpMonth Int
- newtype ExpYear = ExpYear Int
- newtype Limit = Limit Int
- newtype Name = Name {}
- data RecipientCard = RecipientCard {
- recipientCardId :: RecipientCardId
- recipientCardLastFour :: Text
- recipientCardBrand :: Brand
- recipientCardFunding :: Text
- recipientCardExpMonth :: ExpMonth
- recipientCardExpYear :: ExpYear
- recipientCardFingerprint :: Text
- recipientCardCountry :: Country
- recipientCardName :: Maybe Name
- recipientCardAddressLine1 :: Maybe AddressLine1
- recipientCardAddressLine2 :: Maybe AddressLine2
- recipientCardAddressCity :: Maybe AddressCity
- recipientCardAddressState :: Maybe AddressState
- recipientCardAddressZip :: Maybe AddressZip
- recipientCardAddressCountry :: Maybe AddressCountry
- recipientCardCVCCheck :: Maybe Text
- recipientCardAddressLine1Check :: Maybe Text
- recipientCardAddressZipCheck :: Maybe Text
- recipientCardRecipientId :: Maybe (Expandable RecipientId)
- newtype RecipientCardId = RecipientCardId Text
- newtype RecipientId = RecipientId Text
- newtype StartingAfter a = StartingAfter a
API
Customers
Create Card
createCustomerCardByToken Source #
:: CustomerId |
|
-> TokenId |
|
-> StripeRequest CreateCustomerCardByToken |
createRecipientCardByToken Source #
:: RecipientId |
|
-> TokenId |
|
-> StripeRequest CreateRecipientCardByToken |
data CreateCustomerCard Source #
:: CustomerId |
|
-> NewCard |
|
-> StripeRequest CreateCustomerCard |
Customer
Card
creation from card info
data CreateRecipientCard Source #
:: RecipientId |
|
-> NewCard |
|
-> StripeRequest CreateRecipientCard |
Recipient
Card
creation from card info
Get Card(s)
data GetCustomerCard Source #
:: CustomerId |
|
-> CardId |
|
-> StripeRequest GetCustomerCard |
Get card by CustomerId
and CardId
data GetRecipientCard Source #
:: RecipientId |
|
-> RecipientCardId |
|
-> StripeRequest GetRecipientCard |
Get card by RecipientId
and RecipientCardId
data GetCustomerCards Source #
:: CustomerId | The |
-> StripeRequest GetCustomerCards |
Retrieve all cards associated with a Customer
data GetRecipientCards Source #
:: RecipientId | The |
-> StripeRequest GetRecipientCards |
Retrieve all cards associated with a Recipient
Update Card
data UpdateCustomerCard Source #
:: CustomerId |
|
-> CardId |
|
-> StripeRequest UpdateCustomerCard |
Update a Customer
Card
data UpdateRecipientCard Source #
:: RecipientId |
|
-> RecipientCardId |
|
-> StripeRequest UpdateRecipientCard |
Update a Recipient
Card
Delete Card
data DeleteCustomerCard Source #
:: CustomerId |
|
-> CardId | |
-> StripeRequest DeleteCustomerCard |
Removes a Card
with from a Customer
data DeleteRecipientCard Source #
:: RecipientId |
|
-> RecipientCardId | |
-> StripeRequest DeleteRecipientCard |
Removes a RecipientCard
with from a Recipient
Types
newtype AddressLine1 Source #
Address Line One for a Card
newtype AddressLine2 Source #
Address Line Two for a Card
newtype AddressCity Source #
City address for a Card
newtype AddressCountry Source #
Country address for a Card
newtype AddressState Source #
Address State for a Card
newtype AddressZip Source #
Address Zip Code for a Card
Credit / Debit Card Brand
Card
Object
CardId for a Customer
newtype CardNumber Source #
Number associated with a Card
CVC for a Card
newtype EndingBefore a Source #
Pagination Option for StripeList
newtype ExpandParams Source #
Type of Expansion Parameters for use on Stripe
objects
Expiration Month for a Card
Expiration Year for a Card
Pagination Option for StripeList
a cardholder's full name
data RecipientCard Source #
RecipientCard
object
Eq RecipientCard Source # | |
Data RecipientCard Source # | |
Ord RecipientCard Source # | |
Read RecipientCard Source # | |
Show RecipientCard Source # | |
FromJSON RecipientCard Source # | JSON Instance for |
newtype RecipientCardId Source #
CardId for a Recipient
newtype RecipientId Source #
RecipientId
for a Recipient
newtype StartingAfter a Source #
Pagination Option for StripeList