| Copyright | (c) David Johnson, 2014 |
|---|---|
| Maintainer | djohnson.m@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Web.Stripe.Refund
Description
https://stripe.com/docs/api#refunds
import Web.Stripe
import Web.Stripe.Customer
import Web.Stripe.Charge
import Web.Stripe.Refund
main :: IO ()
main = do
let config = SecretKey "secret_key"
credit = CardNumber "4242424242424242"
em = ExpMonth 12
ey = ExpYear 2015
cvc = CVC "123"
result <- stripe config $ do
Customer { customerId = cid } <- createCustomerByCard cn em ey cvc
Charge { chargeId = chid } <- chargeCustomer cid USD 100 Nothing
createRefund chid ([] :: MetaData)
case result of
Right refund -> print refund
Left stripeError -> print stripeError
- createRefund :: ChargeId -> MetaData -> Stripe Refund
- getRefund :: ChargeId -> RefundId -> Stripe Refund
- getRefundExpandable :: ChargeId -> RefundId -> ExpandParams -> Stripe Refund
- getRefunds :: ChargeId -> Limit -> StartingAfter RefundId -> EndingBefore RefundId -> Stripe (StripeList Refund)
- getRefundsExpandable :: ChargeId -> Limit -> StartingAfter RefundId -> EndingBefore RefundId -> ExpandParams -> Stripe (StripeList Refund)
- updateRefund :: ChargeId -> RefundId -> MetaData -> Stripe Refund
- data Refund = Refund {}
- newtype RefundId = RefundId Text
- data ChargeId
- data Charge = Charge {
- chargeId :: ChargeId
- chargeObject :: Text
- chargeCreated :: UTCTime
- chargeLiveMode :: Bool
- chargePaid :: Bool
- chargeAmount :: Int
- chargeCurrency :: Currency
- chargeRefunded :: Bool
- chargeCreditCard :: Card
- chargeCaptured :: Bool
- chargeRefunds :: StripeList Refund
- chargeBalanceTransaction :: Maybe TransactionId
- chargeFailureMessage :: Maybe Text
- chargeFailureCode :: Maybe Text
- chargeAmountRefunded :: Int
- chargeCustomerId :: Maybe CustomerId
- chargeInvoice :: Maybe InvoiceId
- chargeDescription :: Maybe Description
- chargeDispute :: Maybe Dispute
- chargeMetaData :: MetaData
- chargeStatementDescription :: Maybe Description
- chargeReceiptEmail :: Maybe Text
- chargeReceiptNumber :: Maybe Text
- data StripeList a = StripeList {}
API
Arguments
| :: ChargeId | |
| -> RefundId | |
| -> ExpandParams |
|
| -> Stripe Refund |
Retrieve a Refund by ChargeId and RefundId with ExpandParams
Arguments
| :: ChargeId | |
| -> Limit | Defaults to 10 if |
| -> StartingAfter RefundId | Paginate starting after the following |
| -> EndingBefore RefundId | Paginate ending before the following |
| -> Stripe (StripeList Refund) |
Retrieve a lot of Refunds by ChargeId
Arguments
| :: ChargeId | |
| -> Limit | Defaults to 10 if |
| -> StartingAfter RefundId | Paginate starting after the following |
| -> EndingBefore RefundId | Paginate ending before the following |
| -> ExpandParams | |
| -> Stripe (StripeList Refund) |
Retrieve a lot of Refunds by ChargeId with ExpandParams
Types
Constructors
| ChargeId Text | |
| ExpandedCharge Charge |
Charge object in Stripe API
Constructors
data StripeList a Source
Generic handling of Stripe JSON arrays
Constructors
| StripeList | |
Instances
| Eq a => Eq (StripeList a) | |
| Show a => Show (StripeList a) | |
| FromJSON a => FromJSON (StripeList a) | JSON Instance for |