stripe-0.1: A Haskell implementation of the Stripe API.

Web.Stripe.Subscription

Synopsis

Documentation

data Subscription Source

Represents a subscription in the Stripe API.

Instances

Show Subscription 
JSON Subscription

Attempts to parse JSON into a Subscription.

data SubStatus Source

Describes the various stages that a

Instances

newtype SubProrate Source

A boolean flag that determines whether or not to prorate switching plans during a billing cycle.

Constructors

SubProrate 

Fields

unSubProrate :: Bool
 

Instances

newtype SubTrialEnd Source

UTC integer timestamp representing the end of the trial period that the customer receives before being charged for the first time.

Constructors

SubTrialEnd 

Fields

unSubTrialEnd :: Int
 

Instances

newtype SubAtPeriodEnd Source

A boolean flag that determines whether or not the cancellation of the Subscription should be delayed until the end of the current period.

Constructors

SubAtPeriodEnd 

Instances

updateSubRCard :: MonadIO m => RequestCard -> CustomerId -> PlanId -> Maybe CpnId -> Maybe SubProrate -> Maybe SubTrialEnd -> StripeT m SubscriptionSource

Update the subscription associated with a Customer, identified by CustomerId, in the Stripe system.

If SubTrialEnd is provided, this will override the default trial period of the plan to which the customer is subscribed.

updateSubToken :: MonadIO m => TokenId -> CustomerId -> PlanId -> Maybe CpnId -> Maybe SubProrate -> Maybe SubTrialEnd -> StripeT m SubscriptionSource

Behaves precisely like updateSubRCard, but uses a Token, identified by TokenId, rather than a RequestCard.

cancelSub :: MonadIO m => CustomerId -> Maybe SubAtPeriodEnd -> StripeT m SubscriptionSource

Cancels the Subscription associated with a Customer, identified by CustomerId, in the Stripe system.

data UTCTime

This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.

Constructors

UTCTime 

Fields

utctDay :: Day

the day

utctDayTime :: DiffTime

the time from midnight, 0 <= t < 86401s (because of leap-seconds)

data SConfig Source

Configuration for the StripeT monad transformer.

Constructors

SConfig 

Fields

key :: APIKey
 
caFile :: FilePath
 

newtype StripeT m a Source

Defines the monad transformer under which all Stripe REST API resource calls take place.

Constructors

StripeT (StateT SConfig (ErrorT SFailure m) a) 

runStripeT :: MonadIO m => SConfig -> StripeT m a -> m (Either SFailure a)Source

Runs the StripeT monad transformer with a given SConfig. This will handle all of the authorization dance steps necessary to utilize the Stripe API.

Its use is demonstrated in other functions, such as query.