• Stars
    star
    175
  • Rank 218,059 (Top 5 %)
  • Language
    Haskell
  • Created over 10 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💰 Stripe API

stripe

Hackage Haskell Programming Language MIT LICENSE Join the chat at https://gitter.im/dmjio/stripe Build Status

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 (Deprecated)
  • Bitcoin
  • Application Fees
  • Application Fee Refunds
  • Account
  • Balance
  • Events and Tokens

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 (StripeKey "secret key") Nothing
  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

Optional Parameters

Stripe API calls can take multiple optional parameters. stripe-haskell supports optional parameters through the use of type-families and typeclasses. In practice, the function to use is (-&-) to specify optional parameters on a request. For a deeper dive into how this works, please see this blog post.

chargeCardByToken :: TokenId -> Currency -> Amount -> IO (Either StripeError Charge)
chargeCardByToken tokenId currency amount =
  stripe config $ createCharge amount currency
     -&- tokenId

Versioning

All versioning is hard-coded (for safety) to version 2014-10-07. 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 (StripeKey "secret key") Nothing
  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 (StripeKey "secret key") Nothing
  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!

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

More Repositories

1

miso

🍜 A tasty Haskell front-end framework
Haskell
2,091
star
2

envy

😠 Environmentally friendly environment variables
Haskell
147
star
3

Julio

Julia embedded in Haskell
Nix
53
star
4

google-translate

㊙️ Google Translate API
Haskell
51
star
5

hackernews

📰 HackerNews API
Haskell
40
star
6

LearnOpenGL.hs

LearnOpenGL.com examples ported to Haskell
Haskell
27
star
7

s3-signer

☁️ Presigned S3 URLs for Haskell
Haskell
24
star
8

bittrex

💸 Haskell bindings to the Bittrex cryptocurrency exchange
Haskell
24
star
9

graphql-meta

Lexing, parsing, pretty-printing, and metaprogramming facilities for dealing with GraphQL schemas and queries
Haskell
21
star
10

Assembler.py

Simple assembler written in Python that translates assembly code into binary. Based on the nand2tetris Hack platform specification
Assembly
21
star
11

LC3

💾 The LC3 virtual machine
Haskell
20
star
12

servant-from-scratch

Yet another Haskell servant talk
Haskell
12
star
13

c-ffi-example

Example usage of the Haskell C FFI with hsc2hs
Haskell
11
star
14

miso-from-html

Lex, parse and pretty print HTML as Miso View syntax
Haskell
9
star
15

AdventOfCode2018

Christmas code don't write itself
Haskell
9
star
16

ses-html

📧 SES SendEmail for Haskell
Haskell
9
star
17

typed-interpolation

Type-level interpolations in various forms
Haskell
9
star
18

tripletown

Console-based version of TripleTown
Haskell
8
star
19

ext-stg-interpreter-talk

Presentation on the external STG interpreter from Csaba Hruska
8
star
20

scythe

Fast, RFC-4180 compliant, CSV lexing.
Haskell
8
star
21

type-level-json

RFC8259 compliant JSON parser, at the type level.
Haskell
8
star
22

aoc2017

🎄 Advent of code 2017 ... ho' ho' ho', so much code' code' code', merry christmas!
Haskell
8
star
23

vm

A tiny virtual machine
Haskell
7
star
24

nixFromStack

Generate nix expressions from stack files
Nix
7
star
25

Jaskell

A compiler for the Jack Programming language, written in Haskell.
Haskell
7
star
26

miso-presentation

Presentation on miso - wip
7
star
27

servant-selda

Experiments with Servant and Selda
Haskell
7
star
28

servant-route

Type-safe web routes for servant DSLs
Haskell
7
star
29

call-swift-from-haskell

Call a Hello World Swift function from Haskell
Haskell
6
star
30

aoc2020

Advent of Code 2020
Haskell
6
star
31

grin-chat

Talk about GRIN
6
star
32

War

War in Haskell
Haskell
6
star
33

lens-th-rewrite

GHC plugin to rewrite lens Template Haskell splices into pure functions
Haskell
6
star
34

pg-query

Haskell bindings to libpg-query
Haskell
6
star
35

ghcjs-mithril

Haskell bindings to mithril.js
JavaScript
5
star
36

compiler-in-haskell

Just a toy compiler written in Haskell.
Haskell
5
star
37

aoc2021

Haskell
5
star
38

trie

This Trie is so fly
Haskell
5
star
39

Hello-HaLVM

Example "Hello World" HaLVM web-server running on the Xen Hypervisor
Haskell
4
star
40

FiveCardDraw

An implementation of 5 Card Draw Poker in C with Monte Carlo Simulations
C
4
star
41

tstack

A concurrent, thread-safe, transactional stack
Haskell
4
star
42

servant-wasm

Servant support for delivering WebAssembly
Haskell
4
star
43

csv-benchmarks

Benchmarking CSV lexing w/ various Haskell CSV libraries.
Haskell
4
star
44

bitpay

bitpay api
Haskell
3
star
45

hello-rust-haskell-nix

Calling statically linked Rust from Haskell, using a Nix environment
Nix
3
star
46

TinyMap

A pure, strict and extremely space efficient HashMap with good asymptotics
Haskell
3
star
47

ipopt-hs

ipopt-hs for GHC 8.6.3 ( I didn't write these bindings )
Haskell
3
star
48

gce-hydra-nixops-nginx

Hydra behind nginx running on GCE deployed via nixops
Nix
3
star
49

circleci

Haskell bindings to CircleCI's API
Haskell
3
star
50

hackage-dep-scrape

Pet project for scraping HTML off hackage
Haskell
3
star
51

file-io

File I/O experiments in Haskell
Haskell
3
star
52

static-warp

Simple server to deliver static files
Haskell
3
star
53

functional-lexing-and-parsing-talk

Functional lexing and parsing talk
Haskell
3
star
54

remote-iserv

Cross-compile TH splices on iOS
Nix
3
star
55

coinbase

Coinbase.com API for Haskell
Haskell
3
star
56

HaLVM-Lightning-Talk

A hypothetical HaLVM lightning talk
CSS
3
star
57

CompactMap

A mirror repo of Lemmih's compact-map, 7.8.2 compatible
Haskell
2
star
58

aoc2022

Haskell
2
star
59

adhocdb

In-memory databse on-the-fly
Haskell
2
star
60

bootstrap-datagrid

A datagrid for Twitter Bootstrap 3
JavaScript
2
star
61

www.haskellstudy.com

A static site created with Hakyll to house the progress of an independent haskell study
Haskell
2
star
62

99Haskell

My attempt at solving the 99 prolog problems in Haskell
Haskell
2
star
63

wai-streams

io-streams for WAI
Haskell
2
star
64

waffle

Haskell API bindings to the Waffle.io project management tool
Haskell
2
star
65

bounded-queue

An implementation of a bounded queue
Haskell
2
star
66

persistent-generic

Generic facilities for working with Persistent classes
Haskell
2
star
67

v4

Amazon v4 request generation
Haskell
2
star
68

libvirt-hs

Mirror of http://hackage.haskell.org/package/libvirt-hs
Haskell
2
star
69

advent-of-code-2019

Ho' ho' ho', all that code' code' code', merry christmas
Haskell
2
star
70

Hangman

Hangman Haskell
Haskell
1
star
71

snaplet-ses-html

A snaplet for the ses-html package
Haskell
1
star
72

z3-haskell

Mirror of https://bitbucket.org/iago/z3-haskell
Haskell
1
star
73

HilbertRTree

Hilbert R-Tree in Haskell
Haskell
1
star
74

io-streams-http

Deprecated, use https://github.com/vertigomedia/http-client-streams
Haskell
1
star
75

chess

Chess in Haskell
Haskell
1
star
76

LatestPkgVersion

Command line utility to get the latest version number of any package on hackage
Haskell
1
star
77

abc

Mirror of abc verifier
C
1
star
78

openarms

Web service for Open Arms ministry in Chicago
Haskell
1
star
79

network-prototype

Client server implementation in io-streams
Haskell
1
star
80

persistent-th-rewrite

Rewrite persistent Template Haskell into pure functions and definitions.
Haskell
1
star
81

cryptopals

Cryptopals challenges
Haskell
1
star
82

demo-jobset

Demo package to be built by hydra CI
Nix
1
star
83

wordfreq

Word frequency counter written in haskell
JavaScript
1
star
84

WebServer

Simple web server implementation written in Haskell
Haskell
1
star
85

oracle-simple

Modern bindings to Oracle odpic... WIP
C
1
star
86

ghcjs-benchmark-test

GHCJS and JS DOM text node benchmark test
Haskell
1
star
87

PurelyFunctionalDataStructures

Some purely functional data structures
Haskell
1
star
88

hpodder

A rendition of the hpodder project from RWH. Using xml instead of HaXml.
Haskell
1
star
89

snaplet-dynamo

Snaplet for the dynamo package
Haskell
1
star
90

BerkeleyDB

A mirror repo of Lemmih's BerkeleyDB, 7.8.2 compatible
Haskell
1
star
91

selection_sort

Selection sort implemented in Rust
Rust
1
star
92

angular-snap-jwt

A prototype of angular.js, snap and JWT authentication
Haskell
1
star
93

HaskellLessons

Haskell Learning
Haskell
1
star
94

supervise

Facilitate the spawning, maintenance and resolution of asynchronous operations running concurrently
Haskell
1
star