Copyright | (c) David Johnson 2014 |
---|---|
Maintainer | djohnson.m@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
https://stripe.com/docs/api#tokens
{-# LANGUAGE OverloadedStrings #-} import Web.Stripe import Web.Stripe.Token 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 $ createCardToken (Just cardinfo) case result of Right token -> print token Left stripeError -> print stripeError
Synopsis
- data CreateCardToken
- createCardToken :: Maybe NewCard -> StripeRequest CreateCardToken
- data CreateBankAccountToken
- createBankAccountToken :: Maybe NewBankAccount -> StripeRequest CreateBankAccountToken
- data GetCardToken
- getCardToken :: TokenId -> StripeRequest GetCardToken
- data GetBankAccountToken
- getBankAccountToken :: TokenId -> StripeRequest GetBankAccountToken
- data Account = Account {
- accountId :: AccountId
- accountEmail :: Email
- accountStatementDescriptor :: Maybe Description
- accountDisplayName :: Maybe Text
- accountTimeZone :: Text
- accountDetailsSubmitted :: Bool
- accountChargeEnabled :: Bool
- accountTransferEnabled :: Bool
- accountCurrenciesSupported :: [Currency]
- accountDefaultCurrency :: Currency
- accountCountry :: Text
- accountObject :: Text
- accountBusinessName :: Maybe Text
- accountBusinessURL :: Maybe Text
- accountBusinessLogo :: Maybe Text
- accountSupportPhone :: Maybe Text
- newtype AccountNumber = AccountNumber Text
- data BankAccount = BankAccount {}
- data Card = Card {
- cardId :: CardId
- cardObject :: Text
- cardLastFour :: Text
- cardBrand :: Brand
- cardFunding :: Text
- cardExpMonth :: ExpMonth
- cardExpYear :: ExpYear
- cardFingerprint :: Maybe Text
- cardCountry :: Maybe 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)
- cardMetaData :: MetaData
- newtype CardNumber = CardNumber Text
- newtype Country = Country Text
- newtype CustomerId = CustomerId Text
- newtype CVC = CVC Text
- newtype ExpMonth = ExpMonth Int
- newtype ExpYear = ExpYear Int
- data NewBankAccount = NewBankAccount {}
- mkNewCard :: CardNumber -> ExpMonth -> ExpYear -> NewCard
- data NewCard = NewCard {
- newCardCardNumber :: CardNumber
- newCardExpMonth :: ExpMonth
- newCardExpYear :: ExpYear
- newCardCVC :: Maybe CVC
- newCardName :: Maybe Name
- newCardAddressLine1 :: Maybe AddressLine1
- newCardAddressLine2 :: Maybe AddressLine2
- newCardAddressCity :: Maybe AddressCity
- newCardAddressZip :: Maybe AddressZip
- newCardAddressState :: Maybe AddressState
- newCardAddressCountry :: Maybe AddressCountry
- newtype RoutingNumber = RoutingNumber Text
- data Token a = Token {
- tokenId :: TokenId
- tokenLiveMode :: Bool
- tokenCreated :: UTCTime
- tokenUsed :: Bool
- tokenObject :: Text
- tokenType :: TokenType
- tokenData :: a
- newtype TokenId = TokenId Text
- data TokenType
API
data CreateCardToken Source #
Instances
StripeHasParam CreateCardToken CustomerId Source # | |
Defined in Web.Stripe.Token | |
type StripeReturn CreateCardToken Source # | |
Defined in Web.Stripe.Token |
:: Maybe NewCard | optional |
-> StripeRequest CreateCardToken |
data CreateBankAccountToken Source #
Instances
type StripeReturn CreateBankAccountToken Source # | |
Defined in Web.Stripe.Token |
createBankAccountToken Source #
:: Maybe NewBankAccount | option |
-> StripeRequest CreateBankAccountToken |
Create a Token
for a specific BankAccount
data GetCardToken Source #
Instances
type StripeReturn GetCardToken Source # | |
Defined in Web.Stripe.Token |
data GetBankAccountToken Source #
Instances
type StripeReturn GetBankAccountToken Source # | |
Defined in Web.Stripe.Token |
:: TokenId | The |
-> StripeRequest GetBankAccountToken |
Types
Account
Object
Instances
Eq Account Source # | |
Data Account Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Account -> c Account # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Account # toConstr :: Account -> Constr # dataTypeOf :: Account -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Account) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Account) # gmapT :: (forall b. Data b => b -> b) -> Account -> Account # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Account -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Account -> r # gmapQ :: (forall d. Data d => d -> u) -> Account -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Account -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Account -> m Account # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Account -> m Account # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Account -> m Account # | |
Ord Account Source # | |
Read Account Source # | |
Show Account Source # | |
FromJSON Account Source # | JSON Instance for |
newtype AccountNumber Source #
Account Number of a Bank Account
Instances
data BankAccount Source #
BankAccount
Object
Instances
Card
Object
Instances
Eq Card Source # | |
Data Card Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Card -> c Card # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Card # dataTypeOf :: Card -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Card) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Card) # gmapT :: (forall b. Data b => b -> b) -> Card -> Card # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Card -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Card -> r # gmapQ :: (forall d. Data d => d -> u) -> Card -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Card -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Card -> m Card # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Card -> m Card # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Card -> m Card # | |
Ord Card Source # | |
Read Card Source # | |
Show Card Source # | |
FromJSON Card Source # | JSON Instance for |
newtype CardNumber Source #
Number associated with a Card
Instances
Country
Instances
Eq Country Source # | |
Data Country Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Country -> c Country # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Country # toConstr :: Country -> Constr # dataTypeOf :: Country -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Country) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Country) # gmapT :: (forall b. Data b => b -> b) -> Country -> Country # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Country -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Country -> r # gmapQ :: (forall d. Data d => d -> u) -> Country -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Country -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Country -> m Country # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Country -> m Country # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Country -> m Country # | |
Ord Country Source # | |
Read Country Source # | |
Show Country Source # | |
newtype CustomerId Source #
CustomerId
for a Customer
Instances
CVC for a Card
Instances
Eq CVC Source # | |
Data CVC Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CVC -> c CVC # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CVC # dataTypeOf :: CVC -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CVC) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CVC) # gmapT :: (forall b. Data b => b -> b) -> CVC -> CVC # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CVC -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CVC -> r # gmapQ :: (forall d. Data d => d -> u) -> CVC -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CVC -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CVC -> m CVC # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CVC -> m CVC # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CVC -> m CVC # | |
Ord CVC Source # | |
Read CVC Source # | |
Show CVC Source # | |
ToStripeParam CVC Source # | |
Defined in Web.Stripe.StripeRequest toStripeParam :: CVC -> [(ByteString, ByteString)] -> [(ByteString, ByteString)] Source # |
Expiration Month for a Card
Instances
Eq ExpMonth Source # | |
Data ExpMonth Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ExpMonth -> c ExpMonth # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ExpMonth # toConstr :: ExpMonth -> Constr # dataTypeOf :: ExpMonth -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ExpMonth) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ExpMonth) # gmapT :: (forall b. Data b => b -> b) -> ExpMonth -> ExpMonth # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ExpMonth -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ExpMonth -> r # gmapQ :: (forall d. Data d => d -> u) -> ExpMonth -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ExpMonth -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ExpMonth -> m ExpMonth # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ExpMonth -> m ExpMonth # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ExpMonth -> m ExpMonth # | |
Ord ExpMonth Source # | |
Defined in Web.Stripe.Types | |
Read ExpMonth Source # | |
Show ExpMonth Source # | |
ToStripeParam ExpMonth Source # | |
Defined in Web.Stripe.StripeRequest toStripeParam :: ExpMonth -> [(ByteString, ByteString)] -> [(ByteString, ByteString)] Source # | |
StripeHasParam UpdateRecipientCard ExpMonth Source # | |
Defined in Web.Stripe.Card | |
StripeHasParam UpdateCustomerCard ExpMonth Source # | |
Defined in Web.Stripe.Card |
Expiration Year for a Card
Instances
Eq ExpYear Source # | |
Data ExpYear Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ExpYear -> c ExpYear # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ExpYear # toConstr :: ExpYear -> Constr # dataTypeOf :: ExpYear -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ExpYear) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ExpYear) # gmapT :: (forall b. Data b => b -> b) -> ExpYear -> ExpYear # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ExpYear -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ExpYear -> r # gmapQ :: (forall d. Data d => d -> u) -> ExpYear -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ExpYear -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ExpYear -> m ExpYear # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ExpYear -> m ExpYear # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ExpYear -> m ExpYear # | |
Ord ExpYear Source # | |
Read ExpYear Source # | |
Show ExpYear Source # | |
ToStripeParam ExpYear Source # | |
Defined in Web.Stripe.StripeRequest toStripeParam :: ExpYear -> [(ByteString, ByteString)] -> [(ByteString, ByteString)] Source # | |
StripeHasParam UpdateRecipientCard ExpYear Source # | |
Defined in Web.Stripe.Card | |
StripeHasParam UpdateCustomerCard ExpYear Source # | |
Defined in Web.Stripe.Card |
data NewBankAccount Source #
create a new BankAccount
Instances
mkNewCard :: CardNumber -> ExpMonth -> ExpYear -> NewCard Source #
create a NewCard
with only the required fields
Instances
newtype RoutingNumber Source #
Routing Number for Bank Account
Instances
Token
Object
Token | |
|
Instances
Eq a => Eq (Token a) Source # | |
Data a => Data (Token a) Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Token a -> c (Token a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Token a) # toConstr :: Token a -> Constr # dataTypeOf :: Token a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Token a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Token a)) # gmapT :: (forall b. Data b => b -> b) -> Token a -> Token a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Token a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Token a -> r # gmapQ :: (forall d. Data d => d -> u) -> Token a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Token a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Token a -> m (Token a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Token a -> m (Token a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Token a -> m (Token a) # | |
Ord a => Ord (Token a) Source # | |
Read a => Read (Token a) Source # | |
Show a => Show (Token a) Source # | |
FromJSON a => FromJSON (Token a) Source # | JSON Instance for |
Instances
Type of Token
Instances
Eq TokenType Source # | |
Data TokenType Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TokenType -> c TokenType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TokenType # toConstr :: TokenType -> Constr # dataTypeOf :: TokenType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TokenType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenType) # gmapT :: (forall b. Data b => b -> b) -> TokenType -> TokenType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TokenType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TokenType -> r # gmapQ :: (forall d. Data d => d -> u) -> TokenType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TokenType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TokenType -> m TokenType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenType -> m TokenType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenType -> m TokenType # | |
Ord TokenType Source # | |
Defined in Web.Stripe.Types | |
Read TokenType Source # | |
Show TokenType Source # | |
FromJSON TokenType Source # | JSON Instance for |