Copyright | (c) David Johnson 2014 |
---|---|
Maintainer | djohnson.m@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
https://stripe.com/docs/api#refunds
{-# LANGUAGE OverloadedStrings #-} import Web.Stripe import Web.Stripe.Customer import Web.Stripe.Charge import Web.Stripe.Refund main :: IO () main = do let config = StripeConfig (StripeKey "secret_key") credit = CardNumber "4242424242424242" em = ExpMonth 12 ey = ExpYear 2015 cvc = CVC "123" cardinfo = (mkNewCard credit em ey) { newCardCVC = Just cvc } result <- stripe config $ createCustomer -&- cardinfo case result of (Left stripeError) -> print stripeError (Right (Customer { customerId = cid })) -> do result <- stripe config $ createCharge (Amount 100) USD -&- cid case result of (Left stripeError) -> print stripeError (Right (Charge { chargeId = chid })) -> do result <- stripe config $ createRefund chid case result of (Left stripeError) -> print stripeError (Right refund) -> print refund
Synopsis
- data CreateRefund
- createRefund :: ChargeId -> StripeRequest CreateRefund
- data GetRefund
- getRefund :: ChargeId -> RefundId -> StripeRequest GetRefund
- data GetRefunds
- getRefunds :: ChargeId -> StripeRequest GetRefunds
- data UpdateRefund
- updateRefund :: ChargeId -> RefundId -> StripeRequest UpdateRefund
- newtype Amount = Amount {}
- data Charge = Charge {
- chargeId :: ChargeId
- chargeObject :: Text
- chargeCreated :: UTCTime
- chargeLiveMode :: Bool
- chargePaid :: Bool
- chargeAmount :: Amount
- chargeCurrency :: Currency
- chargeRefunded :: Bool
- chargeCreditCard :: Maybe Card
- chargeCaptured :: Bool
- chargeRefunds :: StripeList Refund
- chargeBalanceTransaction :: Maybe (Expandable TransactionId)
- chargeFailureMessage :: Maybe Text
- chargeFailureCode :: Maybe Text
- chargeAmountRefunded :: Int
- chargeCustomerId :: Maybe (Expandable CustomerId)
- chargeInvoice :: Maybe (Expandable InvoiceId)
- chargeDescription :: Maybe Description
- chargeDispute :: Maybe Dispute
- chargeMetaData :: MetaData
- chargeStatementDescription :: Maybe StatementDescription
- chargeReceiptEmail :: Maybe Text
- chargeReceiptNumber :: Maybe Text
- newtype ChargeId = ChargeId Text
- newtype EndingBefore a = EndingBefore a
- newtype ExpandParams = ExpandParams {
- getExpandParams :: [Text]
- data Refund = Refund {}
- newtype RefundApplicationFee = RefundApplicationFee {}
- data RefundReason
- newtype RefundId = RefundId Text
- data StripeList a = StripeList {}
API
data CreateRefund Source #
Instances
StripeHasParam CreateRefund MetaData Source # | |
Defined in Web.Stripe.Refund | |
StripeHasParam CreateRefund Amount Source # | |
Defined in Web.Stripe.Refund | |
StripeHasParam CreateRefund RefundReason Source # | |
Defined in Web.Stripe.Refund | |
StripeHasParam CreateRefund RefundApplicationFee Source # | |
Defined in Web.Stripe.Refund | |
type StripeReturn CreateRefund Source # | |
Defined in Web.Stripe.Refund |
create a Refund
Instances
StripeHasParam GetRefund ExpandParams Source # | |
Defined in Web.Stripe.Refund | |
type StripeReturn GetRefund Source # | |
Defined in Web.Stripe.Refund |
:: ChargeId | |
-> RefundId | |
-> StripeRequest GetRefund |
data GetRefunds Source #
Instances
StripeHasParam GetRefunds ExpandParams Source # | |
Defined in Web.Stripe.Refund | |
StripeHasParam GetRefunds Limit Source # | |
Defined in Web.Stripe.Refund | |
StripeHasParam GetRefunds (EndingBefore RefundId) Source # | |
Defined in Web.Stripe.Refund | |
StripeHasParam GetRefunds (StartingAfter RefundId) Source # | |
Defined in Web.Stripe.Refund | |
type StripeReturn GetRefunds Source # | |
Defined in Web.Stripe.Refund |
:: ChargeId |
|
-> StripeRequest GetRefunds |
Retrieve a lot of Refunds by ChargeId
data UpdateRefund Source #
Instances
StripeHasParam UpdateRefund MetaData Source # | |
Defined in Web.Stripe.Refund | |
type StripeReturn UpdateRefund Source # | |
Defined in Web.Stripe.Refund |
Types
Amount representing a monetary value. Stripe represents pennies as whole numbers i.e. 100 = $1
Instances
Charge
object in Stripe
API
Instances
Eq Charge Source # | |
Data Charge Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Charge -> c Charge # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Charge # toConstr :: Charge -> Constr # dataTypeOf :: Charge -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Charge) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Charge) # gmapT :: (forall b. Data b => b -> b) -> Charge -> Charge # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Charge -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Charge -> r # gmapQ :: (forall d. Data d => d -> u) -> Charge -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Charge -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Charge -> m Charge # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Charge -> m Charge # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Charge -> m Charge # | |
Ord Charge Source # | |
Read Charge Source # | |
Show Charge Source # | |
FromJSON Charge Source # | JSON Instance for |
Instances
newtype EndingBefore a Source #
Pagination Option for StripeList
Instances
newtype ExpandParams Source #
Type of Expansion Parameters for use on Stripe
objects
Instances
Refund
Object
Instances
Eq Refund Source # | |
Data Refund Source # | |
Defined in Web.Stripe.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Refund -> c Refund # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Refund # toConstr :: Refund -> Constr # dataTypeOf :: Refund -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Refund) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Refund) # gmapT :: (forall b. Data b => b -> b) -> Refund -> Refund # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Refund -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Refund -> r # gmapQ :: (forall d. Data d => d -> u) -> Refund -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Refund -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Refund -> m Refund # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Refund -> m Refund # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Refund -> m Refund # | |
Ord Refund Source # | |
Read Refund Source # | |
Show Refund Source # | |
FromJSON Refund Source # | JSON Instance for |
newtype RefundApplicationFee Source #
Instances
data RefundReason Source #
Instances
Instances
data StripeList a Source #
Generic handling of Stripe JSON arrays