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

Safe HaskellNone

Web.Stripe.Subscription

Synopsis

Documentation

data Subscription Source

Represents a subscription in the Stripe API.

Instances

Show Subscription 
FromJSON Subscription

Attempts to parse JSON into a Subscription.

data SubStatus Source

Describes the various stages that a

newtype SubProrate Source

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

Constructors

SubProrate 

Fields

unSubProrate :: Bool
 

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
 

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 

createSub :: MonadIO m => CustomerId -> PlanId -> Maybe CpnId -> Maybe SubTrialEnd -> StripeT m SubscriptionSource

Create a new Subscription. Limitations: does not yet support passing a card, quantity, or application fee

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 StripeConfig Source

Configuration for the StripeT monad transformer.

newtype StripeT m a Source

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

runStripeT :: MonadIO m => StripeConfig -> StripeT m a -> m (Either StripeFailure a)Source

Runs the StripeT monad transformer with a given StripeConfig. 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.