Giter Site home page Giter Site logo

stripe's Introduction

stripe Build Status Hackage

##Stripe API coverage for Haskell (Stripe API)

All Stripe commands are supported, including but not limited to Charges, Refunds, Customers, Cards, Subscriptions, Plans, Coupons, Discounts, Invoices, Invoice Items, Disputes, Transfers, Recipients, Bitcoin, Application Fees, Application Fee Refunds, Account, Balance, Events and Tokens.


##100% Haddock Coverage All code written for this library is documented to completion with the haddock documentation tool

##100+ Hspec Tests Thoroughly unit-tested with hspec. All API commands are unit-tested before inclusion into the API (see the tests directory). To run the tests, perform the following:

cabal clean 
cabal configure --enable-tests
cabal build tests
dist/build/tests/tests # You will be prompted to enter your *TEST* key

##Pagination Pagination is possible on all API calls that return a JSON array.
Any API call that returns a StripeList is eligible for pagination. To use in practice do the following:

import Web.Stripe
import Web.Stripe.Customer
    
main :: IO ()
main = do
  let config = StripeConfig "secret key"
  result <- stripe config $ getCustomers 
                                (Just 30 :: Maybe Limit) -- Defaults to 10 if Nothing, 100 is Max
                                (StartingAfter $ CustomerId "customer_id0")
                                (EndingBefore $ CustomerId "customer_id30")
  case result of
    Right stripelist -> print (list stripelist :: [Customer])
    Left stripeError -> print stripeError

##Versioning All versioning is hard-coded (for safety). Stripe API versions specified in the HTTP headers of Stripe requests take precedence over the API version specified in your Stripe Dashboard. In an attempt to ensure API consistency and correct parsing of returned JSON, all Stripe versions are hard-coded, and are inaccessible to the end-users of this library. When a new Stripe API version is released this library will increment the hard-coded API version.

##Expansion Object expansion is supported on Stripe objects eligible for expansion though the ExpandParams type. Object expansion allows normal Stripe API calls to return expanded objects inside of other objects. For example, a Customer object contains a Card ID hash on the default_card field. This default_card hash can be expanded into a full Card object inside a Customer object. As an example:

import Web.Stripe
import Web.Stripe.Customer
    
main :: IO ()
main = do
  let config = StripeConfig "secret key"
  result <- stripe config $ getCustomerExpandable 
                                   (CustomerId "customerid")
                                   (["default_card"] :: ExpandParams)
  case result of
    Right customer -> print (defaultCard customer) -- Will be an `ExpandedCard`
    Left stripeError -> print stripeError

##MetaData Stripe objects allow the embedding of arbitrary metadata. Any Stripe object that supports the embedding of metadata is available via this API. As an example:

import Web.Stripe
import Web.Stripe.Coupon
  
main :: IO ()
main = do
  let config = StripeConfig "secret key"
  result <- stripe config $ updateCoupon (CouponId "couponid") [("key1", "value2"), ("key2", "value2")]
  case result of
    Right coupon -> print $ couponMetaData coupon
    Left stripeError -> print stripeError

##Issues Any API recommendations or bugs can be reported on the GitHub issue tracker. Pull requests welcome!

stripe's People

Contributors

creichert avatar dmjio avatar iand675 avatar matthewarkin avatar maxcan avatar stepcut avatar tdimiduk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.