stripe-haskell-0.1.1.2: Stripe API for Haskell

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

Web.Stripe.Subscription

Contents

Description

https://stripe.com/docs/api#subscriptions

import Web.Stripe         
import Web.Stripe.Subscription
import Web.Stripe.Customer
import Web.Stripe.Plan

main :: IO ()
main = do
  let config = SecretKey "secret_key"
  result <- stripe config $ do
    Customer { customerId = cid } <- createEmptyCustomer
    Plan { planId = pid } <- createPlan (PlanId "free plan")
                     (0 :: Amount) -- free plan
                     (USD :: Currency)
                     (Month :: Inteval)
                     ("sample plan" :: Name)
                     ([] :: MetaData)
  createSubscription cid pid ([] :: MetaData)
  case result of
    Right subscription -> print subscription
    Left stripeError -> print stripeError

Synopsis

API

createSubscription Source

Arguments

:: CustomerId

The CustomerId upon which to create the Subscription

-> PlanId

The PlanId to associate the Subscription with

-> MetaData

The MetaData associated with the Subscription

-> Stripe Subscription 

getSubscriptions Source

Arguments

:: CustomerId

The CustomerId of the Subscriptions to retrieve

-> Limit

Defaults to 10 if Nothing specified

-> StartingAfter SubscriptionId

Paginate starting after the following CustomerId

-> EndingBefore SubscriptionId

Paginate ending before the following CustomerId

-> Stripe (StripeList Subscription) 

Retrieve active Subscriptions

getSubscriptionsExpandable Source

Arguments

:: CustomerId

The CustomerId of the Subscriptions to retrieve

-> Limit

Defaults to 10 if Nothing specified

-> StartingAfter SubscriptionId

Paginate starting after the following CustomerId

-> EndingBefore SubscriptionId

Paginate ending before the following CustomerId

-> ExpandParams

The ExpandParams of the object to expand

-> Stripe (StripeList Subscription) 

Retrieve active Subscriptions

cancelSubscription Source

Arguments

:: CustomerId

The CustomerId of the Subscription to cancel

-> SubscriptionId

The SubscriptionId of the Subscription to cancel

-> Bool

Flag set to true will delay cancellation until end of current period, default False

-> Stripe Subscription 

Types

newtype CouponId Source

Constructors

CouponId Text 

Instances

newtype PlanId Source

PlanId for a Plan

Constructors

PlanId Text 

Instances

data StripeList a Source

Generic handling of Stripe JSON arrays

Constructors

StripeList 

Fields

list :: [a]
 
stripeUrl :: Text
 
object :: Text
 
totalCount :: Maybe Int
 
hasMore :: Bool
 

Instances

Eq a => Eq (StripeList a) 
Show a => Show (StripeList a) 
FromJSON a => FromJSON (StripeList a)

JSON Instance for StripeList