| Copyright | (c) David Johnson, 2014 |
|---|---|
| Maintainer | djohnson.m@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Web.Stripe.Plan
Description
https://stripe.com/docs/api#plans
import Web.Stripe
import Web.Stripe.Plan
main :: IO ()
main = do
let config = SecretKey "secret_key"
result <- stripe config $ do
createPlan (PlanId "free plan")
(0 :: Amount)
(USD :: Currency)
(Month :: Interval)
("a sample free plan" :: Name)
([] :: MetaData)
case result of
Right plan -> print plan
Left stripeError -> print stripeError
- createPlan :: PlanId -> Amount -> Currency -> Interval -> Name -> MetaData -> Stripe Plan
- createPlanIntervalCount :: PlanId -> Amount -> Currency -> Interval -> Name -> IntervalCount -> Stripe Plan
- createPlanTrialPeriodDays :: PlanId -> Amount -> Currency -> Interval -> Name -> TrialPeriodDays -> Stripe Plan
- createPlanBase :: PlanId -> Amount -> Currency -> Interval -> Name -> Maybe IntervalCount -> Maybe TrialPeriodDays -> Maybe Description -> MetaData -> Stripe Plan
- getPlan :: PlanId -> Stripe Plan
- getPlans :: Limit -> StartingAfter PlanId -> EndingBefore PlanId -> Stripe (StripeList Plan)
- updatePlanName :: PlanId -> Description -> Stripe Plan
- updatePlanDescription :: PlanId -> Description -> Stripe Plan
- updatePlanBase :: PlanId -> Maybe Name -> Maybe Description -> MetaData -> Stripe Plan
- deletePlan :: PlanId -> Stripe StripeDeleteResult
- newtype PlanId = PlanId Text
- data Plan = Plan {}
- data Interval
- data StripeList a = StripeList {}
- newtype IntervalCount = IntervalCount Int
- newtype TrialPeriodDays = TrialPeriodDays Int
- data StripeDeleteResult = StripeDeleteResult {}
- data Currency
- = AED
- | AFN
- | ALL
- | AMD
- | ANG
- | AOA
- | ARS
- | AUD
- | AWG
- | AZN
- | BAM
- | BBD
- | BDT
- | BGN
- | BIF
- | BMD
- | BND
- | BOB
- | BRL
- | BSD
- | BWP
- | BZD
- | CAD
- | CDF
- | CHF
- | CLP
- | CNY
- | COP
- | CRC
- | CVE
- | CZK
- | DJF
- | DKK
- | DOP
- | DZD
- | EEK
- | EGP
- | ETB
- | EUR
- | FJD
- | FKP
- | GBP
- | GEL
- | GIP
- | GMD
- | GNF
- | GTQ
- | GYD
- | HKD
- | HNL
- | HRK
- | HTG
- | HUF
- | IDR
- | ILS
- | INR
- | ISK
- | JMD
- | JPY
- | KES
- | KGS
- | KHR
- | KMF
- | KRW
- | KYD
- | KZT
- | LAK
- | LBP
- | LKR
- | LRD
- | LSL
- | LTL
- | LVL
- | MAD
- | MDL
- | MGA
- | MKD
- | MNT
- | MOP
- | MRO
- | MUR
- | MVR
- | MWK
- | MXN
- | MYR
- | MZN
- | NAD
- | NGN
- | NIO
- | NOK
- | NPR
- | NZD
- | PAB
- | PEN
- | PGK
- | PHP
- | PKR
- | PLN
- | PYG
- | QAR
- | RON
- | RSD
- | RUB
- | RWF
- | SAR
- | SBD
- | SCR
- | SEK
- | SGD
- | SHP
- | SLL
- | SOS
- | SRD
- | STD
- | SVC
- | SZL
- | THB
- | TJS
- | TOP
- | TRY
- | TTD
- | TWD
- | TZS
- | UAH
- | UGX
- | USD
- | UYU
- | UZS
- | VND
- | VUV
- | WST
- | XAF
- | XCD
- | XOF
- | XPF
- | YER
- | ZAR
- | ZMW
- | UnknownCurrency
- type Limit = Maybe Int
- type StartingAfter a = Maybe a
- type EndingBefore a = Maybe a
- type Name = Text
- type Amount = Int
- type Description = Text
- type MetaData = [(Text, Text)]
API
Arguments
| :: PlanId | Unique string used to identify |
| -> Amount | Positive integer in cents (or 0 for a free plan) representing how much to charge on a recurring basis |
| -> Currency | |
| -> Interval | Billing Frequency |
| -> Name | Name of |
| -> MetaData | MetaData for the Plan |
| -> Stripe Plan |
Create a Plan
createPlanIntervalCount Source
Arguments
| :: PlanId | Unique string used to identify |
| -> Amount | Positive integer in cents (or 0 for a free plan) representing how much to charge on a recurring basis |
| -> Currency | |
| -> Interval | Billing Frequency |
| -> Name | Name of |
| -> IntervalCount | # of billins between each |
| -> Stripe Plan |
Create a Plan with a specified IntervalCount
createPlanTrialPeriodDays Source
Arguments
| :: PlanId | Unique string used to identify |
| -> Amount | Positive integer in cents (or 0 for a free plan) representing how much to charge on a recurring basis |
| -> Currency | |
| -> Interval | Billing Frequency |
| -> Name | Name of |
| -> TrialPeriodDays | Number of Trial Period Days to be displayed on |
| -> Stripe Plan |
Create a Plan with a specified number of TrialPeriodDays
Arguments
| :: PlanId | Unique string used to identify |
| -> Amount | Positive integer in cents representing how much to charge on a recurring basis |
| -> Currency | |
| -> Interval | |
| -> Name | Name of |
| -> Maybe IntervalCount | Number of intervals between each |
| -> Maybe TrialPeriodDays | Integer number of days a trial will have |
| -> Maybe Description | An arbitrary string to be displayed on |
| -> MetaData | |
| -> Stripe Plan |
Arguments
| :: Limit | Defaults to 10 if |
| -> StartingAfter PlanId | Paginate starting after the following |
| -> EndingBefore PlanId | Paginate ending before the following |
| -> Stripe (StripeList Plan) |
Retrieve a Plan
Arguments
| :: PlanId | The ID of the |
| -> Description | |
| -> Stripe Plan |
Arguments
| :: PlanId | The ID of the |
| -> Description | The |
| -> Stripe Plan |
Update a Plan Description
Arguments
| :: PlanId | The ID of the |
| -> Stripe StripeDeleteResult |
Delete a Plan
Types
Plan object
Constructors
| Plan | |
Fields
| |
Interval for Plans
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 |
data StripeDeleteResult Source
JSON returned from a Stripe deletion request
Instances
| Eq StripeDeleteResult | |
| Show StripeDeleteResult | |
| FromJSON StripeDeleteResult | JSON Instance for |
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 |
Pagination Option for StripeList
type StartingAfter a = Maybe a Source
Pagination Option for StripeList
type EndingBefore a = Maybe a Source
Pagination Option for StripeList
Amount representing a monetary value. Stripe represents pennies as whole numbers i.e. 100 = $1
type Description = Text Source
Generic Description for use in constructing API Calls