| Copyright | (c) David Johnson, 2014 |
|---|---|
| Maintainer | [email protected] |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Web.Stripe.Customer
Description
https://stripe.com/docs/api#customers
import Web.Stripe
import Web.Stripe.Customer
main :: IO ()
main = do
let config = SecretKey "secret_key"
result <- stripe config createEmptyCustomer
case result of
Right customer -> print customer
Left stripeError -> print stripeError
- createEmptyCustomer :: Stripe Customer
- createCustomerByEmail :: Email -> Stripe Customer
- createCustomerByToken :: TokenId -> Stripe Customer
- createCustomerByCard :: CardNumber -> ExpMonth -> ExpYear -> CVC -> Stripe Customer
- createCustomerBase :: Maybe AccountBalance -> Maybe TokenId -> Maybe CardNumber -> Maybe ExpMonth -> Maybe ExpYear -> Maybe CVC -> Maybe CouponId -> Maybe Description -> Maybe Email -> Maybe PlanId -> Maybe Quantity -> Maybe TrialPeriod -> MetaData -> Stripe Customer
- updateCustomerBase :: CustomerId -> Maybe AccountBalance -> Maybe TokenId -> Maybe CardNumber -> Maybe ExpMonth -> Maybe ExpYear -> Maybe CVC -> Maybe CouponId -> Maybe CardId -> Maybe Description -> Maybe Email -> MetaData -> Stripe Customer
- updateCustomerAccountBalance :: CustomerId -> AccountBalance -> Stripe Customer
- updateCustomerDefaultCard :: CustomerId -> CardId -> Stripe Customer
- deleteCustomer :: CustomerId -> Stripe StripeDeleteResult
- getCustomer :: CustomerId -> Stripe Customer
- getCustomerExpandable :: CustomerId -> ExpandParams -> Stripe Customer
- getCustomers :: Limit -> StartingAfter CustomerId -> EndingBefore CustomerId -> Stripe (StripeList Customer)
- getCustomersExpandable :: Limit -> StartingAfter CustomerId -> EndingBefore CustomerId -> ExpandParams -> Stripe (StripeList Customer)
- data Customer
- = Customer {
- customerObject :: Text
- customerCreated :: UTCTime
- customerId :: CustomerId
- customerLiveMode :: Bool
- customerDescription :: Maybe Description
- customerEmail :: Maybe Email
- customerDelinquent :: Bool
- customerSubscriptions :: StripeList Subscription
- customerDiscount :: Maybe Discount
- customerAccountBalance :: Int
- customerCards :: StripeList Card
- customerCurrency :: Maybe Currency
- customerDefaultCard :: Maybe CardId
- customerMetaData :: MetaData
- | DeletedCustomer { }
- = Customer {
- data CustomerId
- data CardId
- data StripeList a = StripeList {}
- newtype TokenId = TokenId Text
- newtype CardNumber = CardNumber Text
- newtype ExpMonth = ExpMonth Int
- newtype ExpYear = ExpYear Int
- newtype CVC = CVC Text
- newtype CouponId = CouponId Text
- newtype Email = Email Text
- newtype PlanId = PlanId Text
- newtype Quantity = Quantity Int
- data StripeDeleteResult = StripeDeleteResult {}
- type Description = Text
- type AccountBalance = Int
- type TrialPeriod = UTCTime
- type Limit = Maybe Int
API
createEmptyCustomer :: Stripe Customer Source
Creates a blank customer
Creates a customer by his/her email
Creates a customer by a Token created from stripe.js or the stripe API.
Arguments
| :: CardNumber | Card Number |
| -> ExpMonth | Card Expiration Month |
| -> ExpYear | Card Expiration Year |
| -> CVC | Card |
| -> Stripe Customer |
Creates a Customer with a Card
Arguments
| :: Maybe AccountBalance | Integer amount corresponding to AccountBalance |
| -> Maybe TokenId | Either a dictionary of a card or a |
| -> Maybe CardNumber | Card Number |
| -> Maybe ExpMonth | Card Expiration Month |
| -> Maybe ExpYear | Card Expiration Year |
| -> Maybe CVC | Card CVC |
| -> Maybe CouponId | Discount on all recurring charges |
| -> Maybe Description | Arbitrary string to attach to a customer object |
| -> Maybe Email | Email address of customer |
| -> Maybe PlanId | Identifier of plan to subscribe customer to |
| -> Maybe Quantity | The quantity you'd like to apply to the subscription you're creating |
| -> Maybe TrialPeriod | TimeStamp representing the trial period the customer will get |
| -> MetaData | MetaData associated with the customer being created |
| -> Stripe Customer |
The base request for customer creation
Arguments
| :: CustomerId |
|
| -> Maybe AccountBalance | Integer amount corresponding to AccountBalance |
| -> Maybe TokenId | Either a dictionary of a card or a tokenId |
| -> Maybe CardNumber | Either a dictionary of a card or a tokenId |
| -> Maybe ExpMonth |
|
| -> Maybe ExpYear |
|
| -> Maybe CVC |
|
| -> Maybe CouponId | Discount on all recurring charges |
| -> Maybe CardId |
|
| -> Maybe Description | Arbitrary string to attach to a customer object |
| -> Maybe Email | Email address of customer |
| -> MetaData | MetaData associated with the customer being created |
| -> Stripe Customer |
Updates a customer
updateCustomerAccountBalance Source
Arguments
| :: CustomerId |
|
| -> AccountBalance |
|
| -> Stripe Customer |
Update Customer Account Balance
updateCustomerDefaultCard Source
Arguments
| :: CustomerId |
|
| -> CardId |
|
| -> Stripe Customer |
Update Customer Account Balance
Arguments
| :: CustomerId | The |
| -> Stripe StripeDeleteResult |
Deletes the specified customer
Arguments
| :: CustomerId | The |
| -> Stripe Customer |
Retrieves a customer by his/her ID.
Arguments
| :: CustomerId | The |
| -> ExpandParams | The |
| -> Stripe Customer |
Retrieves a customer by his/her CustomerID with ExpandParams
Arguments
| :: Limit | Defaults to 10 if |
| -> StartingAfter CustomerId | Paginate starting after the following |
| -> EndingBefore CustomerId | Paginate ending before the following |
| -> Stripe (StripeList Customer) |
Retrieve up to 100 customers at a time
Arguments
| :: Limit | Defaults to 10 if |
| -> StartingAfter CustomerId | Paginate starting after the following |
| -> EndingBefore CustomerId | Paginate ending before the following |
| -> ExpandParams | Get Customers with |
| -> Stripe (StripeList Customer) |
Retrieve up to 100 customers at a time
Types
Customer object
Constructors
data CustomerId Source
CustomerId for a Customer
Constructors
| CustomerId Text | |
| ExpandedCustomer Customer |
Instances
| Eq CustomerId | |
| Show CustomerId | |
| FromJSON CustomerId | JSON Instance for |
CardId for a Customer
Constructors
| CardId Text | |
| ExpandedCard Card |
data StripeList a Source
Generic handling of Stripe JSON arrays
Constructors
| StripeList | |
Instances
| Eq a => Eq (StripeList a) | |
| Show a => Show (StripeList a) | |
| FromJSON a => FromJSON (StripeList a) | JSON Instance for |
Expiration Month for a Card
Expiration Year for a Card
Generic Quantity type to be used with Customer,
Subscription and InvoiceLineItem API requests
data StripeDeleteResult Source
JSON returned from a Stripe deletion request
Instances
| Eq StripeDeleteResult | |
| Show StripeDeleteResult | |
| FromJSON StripeDeleteResult | JSON Instance for |
type Description = Text Source
Generic Description for use in constructing API Calls
type AccountBalance = Int Source
AccountBalance for a Customer
type TrialPeriod = UTCTime Source
TrialPeriod for a Plan
Pagination Option for StripeList