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
- 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
:: CustomerId |
|
-> StripeRequest CreateInvoice |
The Invoice
to be created for a Customer
data GetInvoice Source
data GetInvoiceLineItems Source
Retrieve an InvoiceLineItem
s by InvoiceId
data GetUpcomingInvoice Source
Retrieve an upcoming Invoice
for a Customer
by CustomerId
data UpdateInvoice Source
data PayInvoice Source
type StripeReturn PayInvoice = Invoice Source |
data GetInvoices Source
getInvoices :: StripeRequest GetInvoices Source
Retrieve a StripeList
of Invoice
s
Types
newtype ApplicationFeeId Source
Closed
- invoice closed or not
newtype CustomerId Source
CustomerId
for a Customer
newtype Description Source
Generic Description for use in constructing API Calls
newtype EndingBefore a Source
Pagination Option for StripeList
newtype ExpandParams Source
Type of Expansion Parameters for use on Stripe
objects
Forgiven
- invoice forgiven or not
Invoice
Object
data InvoiceLineItem Source
InvoiceLineItem
Object
newtype InvoiceLineItemId Source
InvoiceLineItemId
for an InvoiceLineItem
data InvoiceLineItemType Source
Type of InvoiceItem
Pagination Option for StripeList
Type of MetaData for use on Stripe
objects
Period for an InvoiceLineItem
newtype StatementDescription Source
StatementDescription
to be added to a Charge
newtype StartingAfter a Source
Pagination Option for StripeList
data StripeList a Source
Generic handling of Stripe JSON arrays
Eq a => Eq (StripeList a) Source | |
Data a => Data (StripeList a) Source | |
Ord a => Ord (StripeList a) Source | |
Read a => Read (StripeList a) Source | |
Show a => Show (StripeList a) Source | |
FromJSON a => FromJSON (StripeList a) Source | JSON Instance for |
newtype SubscriptionId Source
SubscriptionId
for a Subscription