stripe-core-2.0.0: Stripe API for Haskell - Pure Core

Copyright(c) David Johnson, 2014
Maintainerdjohnson.m@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Web.Stripe.Card

Contents

Description

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

Synopsis

API

Customers

Create Card

createCustomerCardByToken Source

Arguments

:: CustomerId

CustomerId of card holder

-> TokenId

TokenId of card to add

-> StripeRequest CreateCustomerCardByToken 

Customer Card creation from a TokenId

createRecipientCardByToken Source

Arguments

:: RecipientId

RecipientId of card holder

-> TokenId

TokenId of card to add

-> StripeRequest CreateRecipientCardByToken 

Recipient Card creation from a TokenId

createCustomerCard Source

Arguments

:: CustomerId

RecipientId of card holder

-> NewCard

NewCard data for the card

-> StripeRequest CreateCustomerCard 

Customer Card creation from card info

createRecipientCard Source

Arguments

:: RecipientId

RecipientId of card holder

-> NewCard

NewCard data for the card

-> StripeRequest CreateRecipientCard 

Recipient Card creation from card info

Get Card(s)

getCustomerCard Source

Arguments

:: CustomerId

CustomerId of the Card to retrieve

-> CardId

CardId of the card to retrieve

-> StripeRequest GetCustomerCard 

Get card by CustomerId and CardId

getRecipientCard Source

Arguments

:: RecipientId

RecipientId of the Card to retrieve

-> RecipientCardId

CardId of the card to retrieve

-> StripeRequest GetRecipientCard 

getCustomerCards Source

Arguments

:: CustomerId

The CustomerId associated with the cards

-> StripeRequest GetCustomerCards 

Retrieve all cards associated with a Customer

getRecipientCards Source

Arguments

:: RecipientId

The RecipientId associated with the cards

-> StripeRequest GetRecipientCards 

Retrieve all cards associated with a Recipient

Update Card

updateCustomerCard Source

Arguments

:: CustomerId

CustomerId of the card holder

-> CardId

CardId of card to update

-> StripeRequest UpdateCustomerCard 

Update a Customer Card

updateRecipientCard Source

Arguments

:: RecipientId

RecipientId of the card holder

-> RecipientCardId

RecipientCardId of the card to update

-> StripeRequest UpdateRecipientCard 

Update a Recipient Card

Delete Card

deleteCustomerCard Source

Arguments

:: CustomerId

CustomerId of the Card to be deleted

-> CardId

CardId associated with Card to be deleted

-> StripeRequest DeleteCustomerCard 

Removes a Card with from a Customer

deleteRecipientCard Source

Arguments

:: RecipientId

RecipientId of the Card to retrieve

-> RecipientCardId

CardId associated with Card to be deleted

-> StripeRequest DeleteRecipientCard 

Removes a RecipientCard with from a Recipient

Types

data Brand Source

Credit / Debit Card Brand

newtype ExpandParams Source

Type of Expansion Parameters for use on Stripe objects

Constructors

ExpandParams 

Fields

getExpandParams :: [Text]