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

Safe HaskellNone

Web.Stripe.Coupon

Synopsis

Documentation

data Coupon Source

Represents a coupon in the Stripe system.

Instances

Show Coupon 
FromJSON Coupon

Attempts to parse JSON into a Coupon.

newtype CpnId Source

Represents the identifier for a given Coupon in the Stripe system.

Constructors

CpnId 

Fields

unCpnId :: Text
 

Instances

data CpnDuration Source

Represents the duration of a coupon. If an interval identifier is not known, UnknownDuration is used to carry the original identifier supplied by Stripe.

Constructors

Once 
Repeating Int

Field specifies how long (months) discount is in effect

Forever 
UnknownDuration Text 

newtype CpnPercentOff Source

Represents the percent off that is applied by a coupon. This must be between 1 and 100.

Constructors

CpnPercentOff 

Fields

unCpnPercentOff :: Int
 

newtype CpnMaxRedeems Source

A positive number representing the maximum number of times that a coupon can be redeemed.

Constructors

CpnMaxRedeems 

Fields

unCpnMaxRedeems :: Int
 

newtype CpnRedeemBy Source

UTC timestamp specifying the last time at which the coupon can be redeemed.

Constructors

CpnRedeemBy 

Fields

unCpnRedeemBy :: Int
 

createCoupon :: MonadIO m => Coupon -> Maybe CpnMaxRedeems -> Maybe CpnRedeemBy -> StripeT m ()Source

Creates a Coupon in the Stripe system.

getCoupon :: MonadIO m => CpnId -> StripeT m CouponSource

Retrieves a specific Coupon based on its CpnId.

getCoupons :: MonadIO m => Maybe Count -> Maybe Offset -> StripeT m [Coupon]Source

Retrieves a list of all Coupons. The query can optionally be refined to a specific:

  • number of charges, via Count and * page of results, via Offset.

delCoupon :: MonadIO m => Coupon -> StripeT m BoolSource

Deletes a Coupon if it exists. If it does not, an InvalidRequestError will be thrown indicating this.

delCouponById :: MonadIO m => CpnId -> StripeT m BoolSource

Deletes a Coupon, identified by its CpnId, if it exists. If it does not, an InvalidRequestError will be thrown indicating this.

newtype Count Source

A maximum number of objects that the Stripe API will return. This value should be between 1 and 100, inclusive.

Constructors

Count 

Fields

unCount :: Int
 

Instances

newtype Offset Source

A positive integer that is an offset into the array of objects returned by the Stripe API.

Constructors

Offset 

Fields

unOffset :: Int
 

Instances

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.