stripe-haskell-0.1.1.0: Stripe API for Haskell

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

Web.Stripe.Charge

Contents

Description

https://stripe.com/docs/api#charges

import Web.Stripe         
import Web.Stripe.Customer 
import Web.Stripe.Charge

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 <- chargeCustomer cid USD 100 Nothing
        return charge
  case result of
    Right charge      -> print charge
    Left  stripeError -> print stripeError

Synopsis

API

chargeCustomer Source

Arguments

:: CustomerId

The CustomerId of the Customer to be charged

-> Currency

Required, 3-letter ISO Code

-> Amount

Required, Integer value of 100 represents $1

-> Maybe Description

Optional, default is null

-> Stripe Charge 

Charge Customer`s by CustomerId, will charge the default Card if exists

chargeCardByToken Source

Arguments

:: TokenId

The TokenId representative of a Card

-> Currency

Required, 3-letter ISO Code

-> Amount

Required, Integer value of 100 represents $1

-> Maybe Description

Optional, default is null

-> Stripe Charge 

Charge a card by a TokenId

chargeCustomerByCardId Source

Arguments

:: CustomerId

The CustomerId of the Customer to be charged

-> CardId

CardId of Customer to charge

-> Currency

Required, 3-letter ISO Code

-> Amount

Required, Integer value of 100 represents $1

-> Maybe Description

Optional, default is null

-> Stripe Charge 

Charge Customers by CustomerId

chargeCard Source

Arguments

:: CardNumber

Required, Credit Card Number

-> ExpMonth

Required, Expiration Month (i.e. 09)

-> ExpYear

Required, Expiration Year (i.e. 2018)

-> CVC

Required, CVC Number (i.e. 000)

-> Currency

Required, 3-letter ISO Code

-> Amount

Required, Integer value of 100 represents $1

-> Maybe Description

Optional, default is null

-> Stripe Charge 

Charge a card by CardNumber

chargeBase Source

Arguments

:: Amount

Required, Integer value of 100 represents $1

-> Currency

Required, 3-letter ISO Code

-> Maybe Description

Optional, default is null

-> Maybe CustomerId

Optional, either CustomerId or TokenId has to be specified

-> Maybe TokenId

Optional, either CustomerId or TokenId has to be specified

-> Maybe StatementDescription

Optional, Arbitrary string to include on CC statements

-> Maybe Email

Optional, Arbitrary string to include on CC statements

-> Capture

Optional, default is True

-> Maybe CardNumber

Optional, Credit Card Number

-> Maybe ExpMonth

Card Expiration Month

-> Maybe ExpYear

Card Expiration Year

-> Maybe CVC

Card CVC

-> MetaData

Card MetaData

-> Stripe Charge 

Base method for creating a Charge

getCharge Source

Arguments

:: ChargeId

The Charge to retrive

-> Stripe Charge 

Retrieve a Charge by ChargeId

getChargeExpandable Source

Arguments

:: ChargeId

The Charge retrive

-> ExpandParams

The ExpandParams to retrive

-> Stripe Charge 

Retrieve a Charge by ChargeId with ExpandParams

getCharges Source

Arguments

:: Limit

Defaults to 10 if Nothing specified

-> StartingAfter ChargeId

Paginate starting after the following CustomerID

-> EndingBefore ChargeId

Paginate ending before the following CustomerID

-> Stripe (StripeList Charge) 

Retrieve all Charges

getChargesExpandable Source

Arguments

:: Limit

Defaults to 10 if Nothing specified

-> StartingAfter ChargeId

Paginate starting after the following CustomerId

-> EndingBefore ChargeId

Paginate ending before the following CustomerId

-> ExpandParams

Get Charges with ExpandParams

-> Stripe (StripeList Charge) 

Retrieve all Charges

getCustomerCharges Source

Arguments

:: CustomerId 
-> Limit

Defaults to 10 if Nothing specified

-> StartingAfter ChargeId

Paginate starting after the following CustomerId

-> EndingBefore ChargeId

Paginate ending before the following CustomerId

-> Stripe (StripeList Charge) 

Retrieve all Charges for a specified Customer

getCustomerChargesExpandable Source

Arguments

:: CustomerId 
-> Limit

Defaults to 10 if Nothing specified

-> StartingAfter ChargeId

Paginate starting after the following CustomerId

-> EndingBefore ChargeId

Paginate ending before the following CustomerId

-> ExpandParams

Get Customer Charges with ExpandParams

-> Stripe (StripeList Charge) 

Retrieve all Charges for a specified Customer with ExpandParams

updateCharge Source

Arguments

:: ChargeId

The Charge to update

-> Description

The Charge Description to update

-> MetaData

The Charge MetaData to update

-> Stripe Charge 

A Charge to be updated

captureCharge Source

Arguments

:: ChargeId

The ChargeId of the Charge to capture

-> Maybe Amount

If Nothing the entire charge will be captured, otherwise the remaining will be refunded

-> Maybe Email

Email to send Charge receipt

-> Stripe Charge 

a Charge to be captured

Types

newtype TokenId Source

Constructors

TokenId Text 

Instances

data ChargeId Source

ChargeId associated with a Charge

Instances

data Currency Source

Stripe supports 138 currencies

Constructors

AED

United Arab Emirates Dirham

AFN

Afghan Afghani

ALL

Albanian Lek

AMD

Armenian Dram

ANG

Netherlands Antillean Gulden

AOA

Angolan Kwanza

ARS

Argentine Peso

AUD

Australian Dollar

AWG

Aruban Florin

AZN

Azerbaijani Manat

BAM

Bosnia & Herzegovina Convertible Mark

BBD

Barbadian Dollar

BDT

Bangladeshi Taka

BGN

Bulgarian Lev

BIF

Burundian Franc

BMD

Bermudian Dollar

BND

Brunei Dollar

BOB

Bolivian Boliviano

BRL

Brazilian Real

BSD

Bahamian Dollar

BWP

Botswana Pula

BZD

Belize Dollar

CAD

Canadian Dollar

CDF

Congolese Franc

CHF

Swiss Franc

CLP

Chilean Peso

CNY

Chinese Renminbi Yuan

COP

Colombian Peso

CRC

Costa Rican Colón

CVE

Cape Verdean Escudo

CZK

Czech Koruna

DJF

Djiboutian Franc

DKK

Danish Krone

DOP

Dominican Peso

DZD

Algerian Dinar

EEK

Estonian Kroon

EGP

Egyptian Pound

ETB

Ethiopian Birr

EUR

Euro

FJD

Fijian Dollar

FKP

Falkland Islands Pound

GBP

British Pound

GEL

Georgian Lari

GIP

Gibraltar Pound

GMD

Gambian Dalasi

GNF

Guinean Franc

GTQ

Guatemalan Quetzal

GYD

Guyanese Dollar

HKD

Hong Kong Dollar

HNL

Honduran Lempira

HRK

Croatian Kuna

HTG

Haitian Gourde

HUF

Hungarian Forint

IDR

Indonesian Rupiah

ILS

Israeli New Sheqel

INR

Indian Rupee

ISK

Icelandic Króna

JMD

Jamaican Dollar

JPY

Japanese Yen

KES

Kenyan Shilling

KGS

Kyrgyzstani Som

KHR

Cambodian Riel

KMF

Comorian Franc

KRW

South Korean Won

KYD

Cayman Islands Dollar

KZT

Kazakhstani Tenge

LAK

Lao Kip

LBP

Lebanese Pound

LKR

Sri Lankan Rupee

LRD

Liberian Dollar

LSL

Lesotho Loti

LTL

Lithuanian Litas

LVL

Latvian Lats

MAD

Moroccan Dirham

MDL

Moldovan Leu

MGA

Malagasy Ariary

MKD

Macedonian Denar

MNT

Mongolian Tögrög

MOP

Macanese Pataca

MRO

Mauritanian Ouguiya

MUR

Mauritian Rupee

MVR

Maldivian Rufiyaa

MWK

Malawian Kwacha

MXN

Mexican Peso

MYR

Malaysian Ringgit

MZN

Mozambican Metical

NAD

Namibian Dollar

NGN

Nigerian Naira

NIO

Nicaraguan Córdoba

NOK

Norwegian Krone

NPR

Nepalese Rupee

NZD

New Zealand Dollar

PAB

Panamanian Balboa

PEN

Peruvian Nuevo Sol

PGK

Papua New Guinean Kina

PHP

Philippine Peso

PKR

Pakistani Rupee

PLN

Polish Złoty

PYG

Paraguayan Guaraní

QAR

Qatari Riyal

RON

Romanian Leu

RSD

Serbian Dinar

RUB

Russian Ruble

RWF

Rwandan Franc

SAR

Saudi Riyal

SBD

Solomon Islands Dollar

SCR

Seychellois Rupee

SEK

Swedish Krona

SGD

Singapore Dollar

SHP

Saint Helenian Pound

SLL

Sierra Leonean Leone

SOS

Somali Shilling

SRD

Surinamese Dollar

STD

São Tomé and Príncipe Dobra

SVC

Salvadoran Colón

SZL

Swazi Lilangeni

THB

Thai Baht

TJS

Tajikistani Somoni

TOP

Tongan Paʻanga

TRY

Turkish Lira

TTD

Trinidad and Tobago Dollar

TWD

New Taiwan Dollar

TZS

Tanzanian Shilling

UAH

Ukrainian Hryvnia

UGX

Ugandan Shilling

USD

United States Dollar

UYU

Uruguayan Peso

UZS

Uzbekistani Som

VND

Vietnamese Đồng

VUV

Vanuatu Vatu

WST

Samoan Tala

XAF

Central African Cfa Franc

XCD

East Caribbean Dollar

XOF

West African Cfa Franc

XPF

Cfp Franc

YER

Yemeni Rial

ZAR

South African Rand

ZMW

Zambian Kwacha

UnknownCurrency

Unknown Currency

Instances

newtype CardNumber Source

Number associated with a Card

Constructors

CardNumber Text 

newtype CVC Source

CVC for a Card

Constructors

CVC Text 

Instances

newtype ExpMonth Source

Expiration Month for a Card

Constructors

ExpMonth Int 

Instances

newtype ExpYear Source

Expiration Year for a Card

Constructors

ExpYear Int 

Instances

data StripeList a Source

Generic handling of Stripe JSON arrays

Constructors

StripeList 

Fields

list :: [a]
 
stripeUrl :: Text
 
object :: Text
 
totalCount :: Maybe Int
 
hasMore :: Bool
 

Instances

Eq a => Eq (StripeList a) 
Show a => Show (StripeList a) 
FromJSON a => FromJSON (StripeList a)

JSON Instance for StripeList

newtype Email Source

Email associated with a Customer, Recipient or Charge

Constructors

Email Text 

Instances

type Description = Text Source

Generic Description for use in constructing API Calls

type Amount = Int Source

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

type Capture = Bool Source

Capture for Charge