A Haskell implementation of the Stripe API.
Haskell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
src/Web/Stripe
.ghci
.gitignore
LICENSE
README.mkd
Setup.hs
stripe.cabal

README.mkd

DEPRECATED

This library isn't being maintained any longer. There's a much better implementation out there now by dmjio. You'll find the maintained library on Hackage as stripe-haskell.

Historical info

If you're still using this library or are curious about how it worked, read on!

Installation

Installation is simple. If you have cabal installed, just run:

cabal install stripe

and you'll be on your way!

Example Usage

{-# LANGUAGE OverloadedStrings #-}

import           Web.Stripe.Charge (Amount (..), Charge (..), Count (..),
                                    Currency (..), Offset (..), getCharges)
import           Web.Stripe.Client (SecretKey (..), StripeConfig, defaultConfig,
                                    runStripeT)

-- The secret key below is used on the live Stripe API documentation. In
-- practice, you should always store your secret key securely.
conf :: StripeConfig
conf  = defaultConfig $ SecretKey "sk_test_mkGsLqEW6SLnZa487HYfJVLf"

main :: IO ()
main  = do
    amounts <- runStripeT conf $ do
        charges <- getCharges Nothing (Just $ Count 5) (Just $ Offset 1)
        return   $ map getAmt charges
    either err (putStrLn . show) amounts
    where
        getAmt c = (unAmount $ chargeAmount c, unCurrency $ chargeCurrency c)
        err _    = putStrLn "Uh-oh! It didn't work :-("

Which produces the output along the lines of: [(842,"usd"),(2048,"usd"),(1010,"usd"),(4096,"usd"),(4200,"usd")].

Limitations

  • This package currently does not implement Stripe invoices.

Help

First, consult the Haddock and Stripe API docs to be certain you're using the API correctly. It's a good idea to try another library first to see if it works there. If you think you might be misunderstanding the API, or having an issue with Stripe itself, it's best to contact them.

If all of that fails, or if you otherwise think it's an issue with this implementation of the API, please submit an issue here. Better yet, submit a pull request with a proposed solution!

Contributors

License

We like the MIT license. See LICENSE.