| Copyright | (c) David Johnson, 2014 |
|---|---|
| Maintainer | djohnson.m@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Web.Stripe.Card
Contents
Description
https://stripe.com/docs/api#cards
import Web.Stripe
import Web.Stripe.Customer
import Web.Stripe.Card
main :: IO ()
main = do
let config = SecretKey "secret_key"
credit = CardNumber "4242424242424242"
em = ExpMonth 12
ey = ExpYear 2015
cvc = CVC "123"
result <- stripe config $ do
Customer { customerId = cid } <- createEmptyCustomer
card <- createCustomerCard cid credit em ey cvc
return card
case result of
Right card -> print card
Left stripeError -> print stripeError
- createCustomerCard :: CustomerId -> CardNumber -> ExpMonth -> ExpYear -> CVC -> Stripe Card
- createCustomerCardByToken :: CustomerId -> TokenId -> Stripe Card
- getCustomerCard :: CustomerId -> CardId -> Stripe Card
- getCustomerCardExpandable :: CustomerId -> CardId -> ExpandParams -> Stripe Card
- getCustomerCards :: CustomerId -> Maybe Limit -> StartingAfter CardId -> EndingBefore CardId -> Stripe (StripeList Card)
- getCustomerCardsExpandable :: CustomerId -> Maybe Limit -> StartingAfter CardId -> EndingBefore CardId -> ExpandParams -> Stripe (StripeList Card)
- updateCustomerCard :: CustomerId -> CardId -> Maybe Name -> Maybe AddressCity -> Maybe AddressCountry -> Maybe AddressLine1 -> Maybe AddressLine2 -> Maybe AddressState -> Maybe AddressZip -> Stripe Card
- deleteCustomerCard :: CustomerId -> CardId -> Stripe StripeDeleteResult
- createRecipientCard :: RecipientId -> CardNumber -> ExpMonth -> ExpYear -> CVC -> Stripe RecipientCard
- createRecipientCardByToken :: RecipientId -> TokenId -> Stripe RecipientCard
- getRecipientCard :: RecipientId -> RecipientCardId -> Stripe RecipientCard
- getRecipientCardExpandable :: RecipientId -> RecipientCardId -> ExpandParams -> Stripe RecipientCard
- getRecipientCards :: RecipientId -> Maybe Limit -> StartingAfter RecipientCardId -> EndingBefore RecipientCardId -> Stripe (StripeList RecipientCard)
- getRecipientCardsExpandable :: RecipientId -> Maybe Limit -> StartingAfter RecipientCardId -> EndingBefore RecipientCardId -> ExpandParams -> Stripe (StripeList RecipientCard)
- updateRecipientCard :: RecipientId -> RecipientCardId -> Maybe Name -> Maybe AddressCity -> Maybe AddressCountry -> Maybe AddressLine1 -> Maybe AddressLine2 -> Maybe AddressState -> Maybe AddressZip -> Stripe RecipientCard
- deleteRecipientCard :: RecipientId -> RecipientCardId -> Stripe StripeDeleteResult
- 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 CustomerId
- 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 RecipientId
- data CardId
- data RecipientCardId
- newtype CardNumber = CardNumber Text
- newtype ExpMonth = ExpMonth Int
- newtype ExpYear = ExpYear Int
- newtype CVC = CVC Text
- type Name = Text
- 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 RecipientId
API
Customers
Create Customer Card
createCustomerCardByToken Source
Arguments
| :: CustomerId | The Customer to which the card will be added |
| -> TokenId | The Token representative of the card |
| -> Stripe Card |
Get Customer Card(s)
Arguments
| :: CustomerId |
|
| -> CardId |
|
| -> Stripe Card |
Get card by CustomerId and CardId
getCustomerCardExpandable Source
Arguments
| :: CustomerId |
|
| -> CardId |
|
| -> ExpandParams |
|
| -> Stripe Card |
Get card by CustomerId and CardId with ExpandParams
Arguments
| :: CustomerId | The |
| -> Maybe Limit | Defaults to 10 if |
| -> StartingAfter CardId | Paginate starting after the following |
| -> EndingBefore CardId | Paginate ending before the following |
| -> Stripe (StripeList Card) |
Retrieve all cards associated with a Customer
getCustomerCardsExpandable Source
Arguments
| :: CustomerId | The |
| -> Maybe Limit | Defaults to 10 if |
| -> StartingAfter CardId | Paginate starting after the following |
| -> EndingBefore CardId | Paginate ending before the following |
| -> ExpandParams | Expansion on |
| -> Stripe (StripeList Card) |
Retrieve all cards associated with a Customer
Update Customer Card
Arguments
| :: CustomerId |
|
| -> CardId | |
| -> Maybe Name | |
| -> Maybe AddressCity | City associated with |
| -> Maybe AddressCountry | Country associated with |
| -> Maybe AddressLine1 | Address Line 1 associated with |
| -> Maybe AddressLine2 | Address Line 2 associated with |
| -> Maybe AddressState | Address State 2 associated with |
| -> Maybe AddressZip | Address Zip associated with |
| -> Stripe Card |
Delete Card
Arguments
| :: CustomerId |
|
| -> CardId | |
| -> Stripe StripeDeleteResult |
Removes a card from a Customer
Recipients
Create Recipient Card
Arguments
| :: RecipientId |
|
| -> CardNumber |
|
| -> ExpMonth |
|
| -> ExpYear |
|
| -> CVC |
|
| -> Stripe RecipientCard |
Create a Recipient Card by CardNumber
createRecipientCardByToken Source
Arguments
| :: RecipientId | The Customer to which the card will be added |
| -> TokenId | The Token representative of the card |
| -> Stripe RecipientCard |
Get Recipient Card(s)
Arguments
| :: RecipientId |
|
| -> RecipientCardId | |
| -> Stripe RecipientCard |
Get card by RecipientId and CardId
getRecipientCardExpandable Source
Arguments
| :: RecipientId |
|
| -> RecipientCardId | |
| -> ExpandParams |
|
| -> Stripe RecipientCard |
Get card by RecipientId and CardId
Arguments
| :: RecipientId | The |
| -> Maybe Limit | Defaults to 10 if |
| -> StartingAfter RecipientCardId | Paginate starting after the following |
| -> EndingBefore RecipientCardId | Paginate ending before the following |
| -> Stripe (StripeList RecipientCard) |
Retrieve all cards associated with a Recipient
getRecipientCardsExpandable Source
Arguments
| :: RecipientId | The |
| -> Maybe Limit | Defaults to 10 if |
| -> StartingAfter RecipientCardId | Paginate starting after the following |
| -> EndingBefore RecipientCardId | Paginate ending before the following |
| -> ExpandParams | The |
| -> Stripe (StripeList RecipientCard) |
Retrieve all cards associated with a Recipient
Updated Recipient Card
Arguments
| :: RecipientId |
|
| -> RecipientCardId | |
| -> Maybe Name | |
| -> Maybe AddressCity | City associated with |
| -> Maybe AddressCountry | Country associated with |
| -> Maybe AddressLine1 | Address Line 1 associated with |
| -> Maybe AddressLine2 | Address Line 2 associated with |
| -> Maybe AddressState | Address State 2 associated with |
| -> Maybe AddressZip | Address Zip associated with |
| -> Stripe RecipientCard |
Delete Recipient Card
Arguments
| :: RecipientId | The |
| -> RecipientCardId | |
| -> Stripe StripeDeleteResult |
Removes a card from a Customer
Types
Credit / Debit Card Brand
Constructors
| Visa | |
| AMEX | |
| MasterCard | |
| Discover | |
| JCB | |
| DinersClub | |
| Unknown |
Card Object
Constructors
| Card | |
Fields
| |
data RecipientCard Source
RecipientCard object
Constructors
Instances
| Eq RecipientCard | |
| Show RecipientCard | |
| FromJSON RecipientCard | JSON Instance for |
CardId for a Customer
Constructors
| CardId Text | |
| ExpandedCard Card |
data RecipientCardId Source
CardId for a Recipient
Constructors
| RecipientCardId Text | |
| ExpandedRecipientCard RecipientCard |
Instances
Expiration Month for a Card
Expiration Year for a Card
data RecipientId Source
RecipientId for a Recipient
Constructors
| RecipientId Text | |
| ExpandedRecipient Recipient |
Instances
| Eq RecipientId | |
| Show RecipientId | |
| FromJSON RecipientId | JSON Instance for |