stripe-core-2.3.0: Stripe API for Haskell - Pure Core

Copyright(c) David Johnson 2014
Maintainerdjohnson.m@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Web.Stripe.Refund

Contents

Description

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

API

createRefund #

Arguments

:: ChargeId

ChargeId associated with the Charge to be refunded

-> StripeRequest CreateRefund 

create a Refund

getRefund #

Arguments

:: ChargeId

ChargeId associated with the Refund to be retrieved

-> RefundId

RefundId associated with the Refund to be retrieved

-> StripeRequest GetRefund 

Retrieve a Refund by ChargeId and RefundId

getRefunds #

Arguments

:: ChargeId

ChargeId associated with the Refunds to get

-> StripeRequest GetRefunds 

Retrieve a lot of Refunds by ChargeId

updateRefund #

Arguments

:: ChargeId

ChargeId associated with the Charge to be updated

-> RefundId

RefundId associated with the Refund to be retrieved

-> StripeRequest UpdateRefund 

Update a Refund by ChargeId and RefundId

Types

newtype Amount #

Amount representing a monetary value. Stripe represents pennies as whole numbers i.e. 100 = $1

Constructors

Amount 

Fields

Instances

Eq Amount # 

Methods

(==) :: Amount -> Amount -> Bool #

(/=) :: Amount -> Amount -> Bool #

Data Amount # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Amount -> c Amount #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Amount #

toConstr :: Amount -> Constr #

dataTypeOf :: Amount -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Amount) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Amount) #

gmapT :: (forall b. Data b => b -> b) -> Amount -> Amount #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Amount -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Amount -> r #

gmapQ :: (forall d. Data d => d -> u) -> Amount -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Amount -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Amount -> m Amount #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Amount -> m Amount #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Amount -> m Amount #

Ord Amount # 
Read Amount # 
Show Amount # 
ToStripeParam Amount # 
StripeHasParam CreateRefund Amount # 
StripeHasParam UpdateInvoiceItem Amount # 
StripeHasParam CaptureCharge Amount # 
StripeHasParam CreateApplicationFeeRefund Amount # 

data Charge #

Charge object in Stripe API

Instances

Eq Charge # 

Methods

(==) :: Charge -> Charge -> Bool #

(/=) :: Charge -> Charge -> Bool #

Data Charge # 

Methods

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 # 
Read Charge # 
Show Charge # 
FromJSON Charge #

JSON Instance for Charge

newtype ChargeId #

ChargeId associated with a Charge

Constructors

ChargeId Text 

Instances

Eq ChargeId # 
Data ChargeId # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ChargeId -> c ChargeId #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ChargeId #

toConstr :: ChargeId -> Constr #

dataTypeOf :: ChargeId -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c ChargeId) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ChargeId) #

gmapT :: (forall b. Data b => b -> b) -> ChargeId -> ChargeId #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ChargeId -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ChargeId -> r #

gmapQ :: (forall d. Data d => d -> u) -> ChargeId -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ChargeId -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ChargeId -> m ChargeId #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ChargeId -> m ChargeId #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ChargeId -> m ChargeId #

Ord ChargeId # 
Read ChargeId # 
Show ChargeId # 
FromJSON ChargeId #

JSON Instance for ChargeId

ToStripeParam ChargeId # 
StripeHasParam GetApplicationFees ChargeId # 
StripeHasParam GetCharges (EndingBefore ChargeId) # 
StripeHasParam GetCharges (StartingAfter ChargeId) # 
type ExpandsTo ChargeId # 

newtype EndingBefore a #

Pagination Option for StripeList

Constructors

EndingBefore a 

Instances

StripeHasParam GetTransfers (EndingBefore TransferId) # 
StripeHasParam GetSubscriptionsByCustomerId (EndingBefore SubscriptionId) # 
StripeHasParam GetSubscriptions (EndingBefore SubscriptionId) # 
StripeHasParam GetRefunds (EndingBefore RefundId) # 
StripeHasParam GetRecipients (EndingBefore RecipientId) # 
StripeHasParam GetPlans (EndingBefore PlanId) # 
StripeHasParam GetInvoiceItems (EndingBefore InvoiceItemId) # 
StripeHasParam GetInvoiceLineItems (EndingBefore InvoiceLineItemId) # 
StripeHasParam GetInvoices (EndingBefore InvoiceId) # 
StripeHasParam GetEvents (EndingBefore EventId) # 
StripeHasParam GetCustomers (EndingBefore CustomerId) # 
StripeHasParam GetCoupons (EndingBefore CouponId) # 
StripeHasParam GetCharges (EndingBefore ChargeId) # 
StripeHasParam GetRecipientCards (EndingBefore CardId) # 
StripeHasParam GetCustomerCards (EndingBefore CardId) # 
StripeHasParam GetBalanceTransactionHistory (EndingBefore TransactionId) # 
StripeHasParam GetApplicationFeeRefunds (EndingBefore RefundId) # 
StripeHasParam GetApplicationFees (EndingBefore ApplicationFeeId) # 
Eq a => Eq (EndingBefore a) # 
Data a => Data (EndingBefore a) # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EndingBefore a -> c (EndingBefore a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (EndingBefore a) #

toConstr :: EndingBefore a -> Constr #

dataTypeOf :: EndingBefore a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (EndingBefore a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (EndingBefore a)) #

gmapT :: (forall b. Data b => b -> b) -> EndingBefore a -> EndingBefore a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EndingBefore a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EndingBefore a -> r #

gmapQ :: (forall d. Data d => d -> u) -> EndingBefore a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> EndingBefore a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> EndingBefore a -> m (EndingBefore a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EndingBefore a -> m (EndingBefore a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EndingBefore a -> m (EndingBefore a) #

Ord a => Ord (EndingBefore a) # 
Read a => Read (EndingBefore a) # 
Show a => Show (EndingBefore a) # 
ToStripeParam param => ToStripeParam (EndingBefore param) # 

newtype ExpandParams #

Type of Expansion Parameters for use on Stripe objects

Constructors

ExpandParams 

Fields

Instances

Eq ExpandParams # 
Data ExpandParams # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ExpandParams -> c ExpandParams #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ExpandParams #

toConstr :: ExpandParams -> Constr #

dataTypeOf :: ExpandParams -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c ExpandParams) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ExpandParams) #

gmapT :: (forall b. Data b => b -> b) -> ExpandParams -> ExpandParams #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ExpandParams -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ExpandParams -> r #

gmapQ :: (forall d. Data d => d -> u) -> ExpandParams -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ExpandParams -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ExpandParams -> m ExpandParams #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ExpandParams -> m ExpandParams #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ExpandParams -> m ExpandParams #

Ord ExpandParams # 
Read ExpandParams # 
Show ExpandParams # 
ToStripeParam ExpandParams # 
StripeHasParam GetTransfers ExpandParams # 
StripeHasParam GetTransfer ExpandParams # 
StripeHasParam GetSubscriptionsByCustomerId ExpandParams # 
StripeHasParam GetSubscriptions ExpandParams # 
StripeHasParam GetSubscription ExpandParams # 
StripeHasParam GetRefunds ExpandParams # 
StripeHasParam GetRefund ExpandParams # 
StripeHasParam GetRecipients ExpandParams # 
StripeHasParam GetRecipient ExpandParams # 
StripeHasParam GetInvoiceItems ExpandParams # 
StripeHasParam GetInvoiceItem ExpandParams # 
StripeHasParam GetInvoices ExpandParams # 
StripeHasParam GetInvoice ExpandParams # 
StripeHasParam GetCustomers ExpandParams # 
StripeHasParam GetCustomer ExpandParams # 
StripeHasParam GetCharges ExpandParams # 
StripeHasParam GetCharge ExpandParams # 
StripeHasParam CreateCharge ExpandParams # 
StripeHasParam GetRecipientCards ExpandParams # 
StripeHasParam GetCustomerCards ExpandParams # 
StripeHasParam GetRecipientCard ExpandParams # 
StripeHasParam GetCustomerCard ExpandParams # 
StripeHasParam GetBalanceTransaction ExpandParams # 
StripeHasParam GetApplicationFeeRefunds ExpandParams # 
StripeHasParam GetApplicationFeeRefund ExpandParams # 
StripeHasParam GetApplicationFees ExpandParams # 
StripeHasParam GetApplicationFee ExpandParams # 

data Refund #

Refund Object

Instances

Eq Refund # 

Methods

(==) :: Refund -> Refund -> Bool #

(/=) :: Refund -> Refund -> Bool #

Data Refund # 

Methods

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 # 
Read Refund # 
Show Refund # 
FromJSON Refund #

JSON Instance for Refund

newtype RefundApplicationFee #

Instances

Eq RefundApplicationFee # 
Data RefundApplicationFee # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RefundApplicationFee -> c RefundApplicationFee #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RefundApplicationFee #

toConstr :: RefundApplicationFee -> Constr #

dataTypeOf :: RefundApplicationFee -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RefundApplicationFee) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefundApplicationFee) #

gmapT :: (forall b. Data b => b -> b) -> RefundApplicationFee -> RefundApplicationFee #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RefundApplicationFee -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RefundApplicationFee -> r #

gmapQ :: (forall d. Data d => d -> u) -> RefundApplicationFee -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RefundApplicationFee -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RefundApplicationFee -> m RefundApplicationFee #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RefundApplicationFee -> m RefundApplicationFee #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RefundApplicationFee -> m RefundApplicationFee #

Ord RefundApplicationFee # 
Read RefundApplicationFee # 
Show RefundApplicationFee # 
ToStripeParam RefundApplicationFee # 
StripeHasParam CreateRefund RefundApplicationFee # 

data RefundReason #

Instances

Eq RefundReason # 
Data RefundReason # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RefundReason -> c RefundReason #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RefundReason #

toConstr :: RefundReason -> Constr #

dataTypeOf :: RefundReason -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RefundReason) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefundReason) #

gmapT :: (forall b. Data b => b -> b) -> RefundReason -> RefundReason #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RefundReason -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RefundReason -> r #

gmapQ :: (forall d. Data d => d -> u) -> RefundReason -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RefundReason -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RefundReason -> m RefundReason #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RefundReason -> m RefundReason #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RefundReason -> m RefundReason #

Ord RefundReason # 
Read RefundReason # 
Show RefundReason # 
ToStripeParam RefundReason # 
StripeHasParam CreateRefund RefundReason # 

newtype RefundId #

Constructors

RefundId Text 

Instances

Eq RefundId # 
Data RefundId # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RefundId -> c RefundId #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RefundId #

toConstr :: RefundId -> Constr #

dataTypeOf :: RefundId -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RefundId) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefundId) #

gmapT :: (forall b. Data b => b -> b) -> RefundId -> RefundId #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RefundId -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RefundId -> r #

gmapQ :: (forall d. Data d => d -> u) -> RefundId -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RefundId -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RefundId -> m RefundId #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RefundId -> m RefundId #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RefundId -> m RefundId #

Ord RefundId # 
Read RefundId # 
Show RefundId # 
ToStripeParam RefundId # 
StripeHasParam GetRefunds (EndingBefore RefundId) # 
StripeHasParam GetRefunds (StartingAfter RefundId) # 
StripeHasParam GetApplicationFeeRefunds (EndingBefore RefundId) # 
StripeHasParam GetApplicationFeeRefunds (StartingAfter RefundId) # 

data StripeList a #

Generic handling of Stripe JSON arrays

Constructors

StripeList 

Fields

Instances

Eq a => Eq (StripeList a) # 

Methods

(==) :: StripeList a -> StripeList a -> Bool #

(/=) :: StripeList a -> StripeList a -> Bool #

Data a => Data (StripeList a) # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> StripeList a -> c (StripeList a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (StripeList a) #

toConstr :: StripeList a -> Constr #

dataTypeOf :: StripeList a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (StripeList a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (StripeList a)) #

gmapT :: (forall b. Data b => b -> b) -> StripeList a -> StripeList a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> StripeList a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> StripeList a -> r #

gmapQ :: (forall d. Data d => d -> u) -> StripeList a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> StripeList a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> StripeList a -> m (StripeList a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> StripeList a -> m (StripeList a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> StripeList a -> m (StripeList a) #

Ord a => Ord (StripeList a) # 
Read a => Read (StripeList a) # 
Show a => Show (StripeList a) # 
FromJSON a => FromJSON (StripeList a) #

JSON Instance for StripeList