Copyright | (c) David Johnson 2014 |
---|---|
Maintainer | djohnson.m@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
https://stripe.com/docs/api#invoices
{-# LANGUAGE OverloadedStrings #-} import Web.Stripe import Web.Stripe.Customer import Web.Stripe.Invoice import Web.Stripe.InvoiceItem import Web.Stripe.Plan main :: IO () main = do let config = StripeConfig (SecretKey "secret_key") result <- stripe config createCustomer case result of (Left stripeError) -> print stripeError (Right (Customer { customerId = cid })) -> do result <- stripe config $ createPlan (PlanId "planid") (Amount 20) USD Day (PlanName "testplan") case result of (Left stripeError) -> print stripeError (Right (Plan {})) -> do result <- stripe config $ createInvoiceItem cid (Amount 100) USD case result of (Left stripeError) -> print stripeError (Right invoiceItem) -> do result <- stripe config $ createInvoice cid case result of (Left stripeError) -> print stripeError (Right invoice) -> print invoice
Synopsis
- data CreateInvoice
- createInvoice :: CustomerId -> StripeRequest CreateInvoice
- data GetInvoice
- getInvoice :: InvoiceId -> StripeRequest GetInvoice
- data GetInvoiceLineItems
- getInvoiceLineItems :: InvoiceId -> StripeRequest GetInvoiceLineItems
- data GetUpcomingInvoice
- getUpcomingInvoice :: CustomerId -> StripeRequest GetUpcomingInvoice
- data UpdateInvoice
- updateInvoice :: InvoiceId -> StripeRequest UpdateInvoice
- data PayInvoice
- payInvoice :: InvoiceId -> StripeRequest PayInvoice
- data GetInvoices
- getInvoices :: StripeRequest GetInvoices
- newtype ApplicationFeeId = ApplicationFeeId Text
- newtype Closed = Closed {}
- newtype CustomerId = CustomerId Text
- newtype Description = Description Text
- data Discount = Discount {}
- newtype EndingBefore a = EndingBefore a
- newtype ExpandParams = ExpandParams {
- getExpandParams :: [Text]
- newtype Forgiven = Forgiven {
- getForgiven :: Bool
- data Invoice = Invoice {
- invoiceDate :: UTCTime
- invoiceId :: Maybe InvoiceId
- invoicePeriodStart :: UTCTime
- invoicePeriodEnd :: UTCTime
- invoiceLineItems :: StripeList InvoiceLineItem
- invoiceSubTotal :: Int
- invoiceTotal :: Int
- invoiceCustomer :: Expandable CustomerId
- invoiceObject :: Text
- invoiceAttempted :: Bool
- invoiceClosed :: Bool
- invoiceForgiven :: Bool
- invoicePaid :: Bool
- invoiceLiveMode :: Bool
- invoiceAttemptCount :: Int
- invoiceAmountDue :: Int
- invoiceCurrency :: Currency
- invoiceStartingBalance :: Int
- invoiceEndingBalance :: Maybe Int
- invoiceNextPaymentAttempt :: Maybe UTCTime
- invoiceWebHooksDeliveredAt :: Maybe UTCTime
- invoiceCharge :: Maybe (Expandable ChargeId)
- invoiceDiscount :: Maybe Discount
- invoiceApplicateFee :: Maybe FeeId
- invoiceSubscription :: Maybe SubscriptionId
- invoiceStatementDescription :: Maybe StatementDescription
- invoiceDescription :: Maybe Description
- invoiceMetaData :: MetaData
- newtype InvoiceId = InvoiceId Text
- data InvoiceLineItem = InvoiceLineItem {
- invoiceLineItemId :: InvoiceLineItemId
- invoiceLineItemObject :: Text
- invoiceLineItemType :: InvoiceLineItemType
- invoiceLineItemLiveMode :: Bool
- invoiceLineItemAmount :: Int
- invoiceLineItemCurrency :: Currency
- invoiceLineItemProration :: Bool
- invoiceLineItemPeriod :: Period
- invoiceLineItemQuantity :: Maybe Quantity
- invoiceLineItemPlan :: Maybe Plan
- invoiceLineItemDescription :: Maybe Description
- invoiceLineItemMetaData :: MetaData
- newtype InvoiceLineItemId = InvoiceLineItemId Text
- data InvoiceLineItemType
- newtype Limit = Limit Int
- newtype MetaData = MetaData [(Text, Text)]
- data Period = Period {}
- newtype StatementDescription = StatementDescription Text
- newtype StartingAfter a = StartingAfter a
- data StripeList a = StripeList {}
- newtype SubscriptionId = SubscriptionId {}
API
data CreateInvoice Source #
Instances
StripeHasParam CreateInvoice Description Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam CreateInvoice MetaData Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam CreateInvoice ApplicationFeeId Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam CreateInvoice SubscriptionId Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam CreateInvoice StatementDescription Source # | |
Defined in Web.Stripe.Invoice | |
type StripeReturn CreateInvoice Source # | |
Defined in Web.Stripe.Invoice |
:: CustomerId |
|
-> StripeRequest CreateInvoice |
The Invoice
to be created for a Customer
data GetInvoice Source #
Instances
StripeHasParam GetInvoice ExpandParams Source # | |
Defined in Web.Stripe.Invoice | |
type StripeReturn GetInvoice Source # | |
Defined in Web.Stripe.Invoice |
data GetInvoiceLineItems Source #
Instances
StripeHasParam GetInvoiceLineItems Limit Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoiceLineItems SubscriptionId Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoiceLineItems CustomerId Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoiceLineItems (EndingBefore InvoiceLineItemId) Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoiceLineItems (StartingAfter InvoiceLineItemId) Source # | |
Defined in Web.Stripe.Invoice | |
type StripeReturn GetInvoiceLineItems Source # | |
Defined in Web.Stripe.Invoice |
Retrieve an InvoiceLineItem
s by InvoiceId
data GetUpcomingInvoice Source #
Instances
StripeHasParam GetUpcomingInvoice SubscriptionId Source # | |
Defined in Web.Stripe.Invoice | |
type StripeReturn GetUpcomingInvoice Source # | |
Defined in Web.Stripe.Invoice |
Retrieve an upcoming Invoice
for a Customer
by CustomerId
data UpdateInvoice Source #
Instances
StripeHasParam UpdateInvoice Description Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam UpdateInvoice MetaData Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam UpdateInvoice ApplicationFeeId Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam UpdateInvoice Forgiven Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam UpdateInvoice Closed Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam UpdateInvoice StatementDescription Source # | |
Defined in Web.Stripe.Invoice | |
type StripeReturn UpdateInvoice Source # | |
Defined in Web.Stripe.Invoice |
data PayInvoice Source #
Instances
type StripeReturn PayInvoice Source # | |
Defined in Web.Stripe.Invoice |
data GetInvoices Source #
Instances
StripeHasParam GetInvoices ExpandParams Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoices Limit Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoices CustomerId Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoices (EndingBefore InvoiceId) Source # | |
Defined in Web.Stripe.Invoice | |
StripeHasParam GetInvoices (StartingAfter InvoiceId) Source # | |
Defined in Web.Stripe.Invoice | |
type StripeReturn GetInvoices Source # | |
Defined in Web.Stripe.Invoice |
getInvoices :: StripeRequest GetInvoices Source #
Retrieve a StripeList
of Invoice
s
Types
newtype ApplicationFeeId Source #
Instances
Closed
- invoice closed or not
Instances
Eq Closed Source # | |
Data Closed Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Closed -> c Closed # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Closed # toConstr :: Closed -> Constr # dataTypeOf :: Closed -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Closed) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Closed) # gmapT :: (forall b. Data b => b -> b) -> Closed -> Closed # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Closed -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Closed -> r # gmapQ :: (forall d. Data d => d -> u) -> Closed -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Closed -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Closed -> m Closed # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Closed -> m Closed # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Closed -> m Closed # | |
Ord Closed Source # | |
Read Closed Source # | |
Show Closed Source # | |
ToStripeParam Closed Source # | |
Defined in Web.Stripe.StripeRequest toStripeParam :: Closed -> [(ByteString, ByteString)] -> [(ByteString, ByteString)] Source # | |
StripeHasParam UpdateInvoice Closed Source # | |
Defined in Web.Stripe.Invoice |
newtype CustomerId Source #
CustomerId
for a Customer
Instances
newtype Description Source #
Generic Description for use in constructing API Calls
Instances
Instances
Eq Discount Source # | |
Data Discount Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Discount -> c Discount # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Discount # toConstr :: Discount -> Constr # dataTypeOf :: Discount -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Discount) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Discount) # gmapT :: (forall b. Data b => b -> b) -> Discount -> Discount # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Discount -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Discount -> r # gmapQ :: (forall d. Data d => d -> u) -> Discount -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Discount -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Discount -> m Discount # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Discount -> m Discount # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Discount -> m Discount # | |
Ord Discount Source # | |
Defined in Web.Stripe.Types | |
Read Discount Source # | |
Show Discount Source # | |
FromJSON Discount Source # | JSON Instance for |
newtype EndingBefore a Source #
Pagination Option for StripeList
Instances
newtype ExpandParams Source #
Type of Expansion Parameters for use on Stripe
objects
Instances
Forgiven
- invoice forgiven or not
Instances
Eq Forgiven Source # | |
Data Forgiven Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Forgiven -> c Forgiven # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Forgiven # toConstr :: Forgiven -> Constr # dataTypeOf :: Forgiven -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Forgiven) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Forgiven) # gmapT :: (forall b. Data b => b -> b) -> Forgiven -> Forgiven # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Forgiven -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Forgiven -> r # gmapQ :: (forall d. Data d => d -> u) -> Forgiven -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Forgiven -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Forgiven -> m Forgiven # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Forgiven -> m Forgiven # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Forgiven -> m Forgiven # | |
Ord Forgiven Source # | |
Defined in Web.Stripe.Types | |
Read Forgiven Source # | |
Show Forgiven Source # | |
ToStripeParam Forgiven Source # | |
Defined in Web.Stripe.StripeRequest toStripeParam :: Forgiven -> [(ByteString, ByteString)] -> [(ByteString, ByteString)] Source # | |
StripeHasParam UpdateInvoice Forgiven Source # | |
Defined in Web.Stripe.Invoice |
Invoice
Object
Instances
Eq Invoice Source # | |
Data Invoice Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Invoice -> c Invoice # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Invoice # toConstr :: Invoice -> Constr # dataTypeOf :: Invoice -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Invoice) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Invoice) # gmapT :: (forall b. Data b => b -> b) -> Invoice -> Invoice # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Invoice -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Invoice -> r # gmapQ :: (forall d. Data d => d -> u) -> Invoice -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Invoice -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Invoice -> m Invoice # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Invoice -> m Invoice # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Invoice -> m Invoice # | |
Ord Invoice Source # | |
Read Invoice Source # | |
Show Invoice Source # | |
FromJSON Invoice Source # | JSON Instance for |
Instances
data InvoiceLineItem Source #
InvoiceLineItem
Object
Instances
newtype InvoiceLineItemId Source #
InvoiceLineItemId
for an InvoiceLineItem
Instances
data InvoiceLineItemType Source #
Type of InvoiceItem
Instances
Pagination Option for StripeList
Instances
Type of MetaData for use on Stripe
objects
Instances
Period for an InvoiceLineItem
Instances
Eq Period Source # | |
Data Period Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Period -> c Period # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Period # toConstr :: Period -> Constr # dataTypeOf :: Period -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Period) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Period) # gmapT :: (forall b. Data b => b -> b) -> Period -> Period # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Period -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Period -> r # gmapQ :: (forall d. Data d => d -> u) -> Period -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Period -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Period -> m Period # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Period -> m Period # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Period -> m Period # | |
Ord Period Source # | |
Read Period Source # | |
Show Period Source # | |
FromJSON Period Source # | JSON Instance for |
newtype StatementDescription Source #
StatementDescription
to be added to a Charge
Instances
newtype StartingAfter a Source #
Pagination Option for StripeList
Instances
data StripeList a Source #
Generic handling of Stripe JSON arrays
Instances
newtype SubscriptionId Source #
SubscriptionId
for a Subscription