No changes yet.
Stripe Java client was upgraded to 2.8.0
.
GitHub issue: elephant#6
Contributed by Robert Zuber.
The client has been updated for the most recent (as of July 2015) Stripe API version.
clojurewerkz.elephant.invoices
is a new namespace
for working with invoices. It follows
the API conventions found elsewhere in the library:
invoices/create
, invoices/list
, invoices/retrieve
behave very much like their counterparts
in clojurewerkz.elephant.plans
and so on.
clojurewerkz.elephant.charges/list
is a new function
that lists charges.
clojurewerkz.elephant.invoice-items
is a new namespace
for working with invoice items. It follows
the API conventions found elsewhere in the library:
invoice-items/create
, invoice-items/list
, and invoice-items/retrieve
behave very much like their counterparts
in clojurewerkz.elephant.plans
and so on.
clojurewerkz.elephant.coupons
is a new namespace
for working with coupons. It follows
the API conventions found elsewhere in the library:
coupons/create
, coupons/list
, coupons/retrieve
,
and coupons/update
behave very much like their counterparts
in clojurewerkz.elephant.plans
and so on.
clojurewerkz.elephants.subscriptions/retrieve
is a new function
that retrieves an individual subscription that belongs to a particular
customer:
(require '[clojurewerkz.elephant.customers :as ecr])
(require '[clojurewerkz.elephant.plans :as ep])
(require '[clojurewerkz.elephant.subscriptions :as esub])
(let [p (ep/create (unique-plan plan))
c (ecr/create customer)
s (esub/create c {"plan" (:id p)})]
(esub/retrieve s (:id s)))
clojurewerkz.elephants.customers/update
is a function that
updates attributes of an existing customer. Unspecified attributes
are left unchanged.
clojurewerkz.elephants.customers/update-default-source
marks
a source (e.g. a card) as default for its customer:
(require '[clojurewerkz.elephant.cards :as ecc])
(require '[clojurewerkz.elephant.customers :as ecr])
(let [cc {"number" "5555555555554444"
"exp_month" 12
"exp_year" 2019
"cvc" "123"
"name" "J Bindings MC Cardholder"
"address_line1" "140 2nd Street"
"address_line2" "4th Floor"
"address_city" "San Francisco"
"address_zip" "94105"
"address_state" "CA"
"address_country" "USA"}
c (ecr/retrieve "customer-id")
cm (ecc/create c cc)]
;; use this source as default
(ecr/update-default-source c (:id cm))
clojurewerkz.elephants.cards/list
is a function that
lists cards of a particular customer.
clojurewerkz.elephants.cards/delete
deletes a card
of a particular customer.
clojurewerkz.elephant.cards/retrieve
retrieves a customer card:
(require '[clojurewerkz.elephant.cards :as ecc])
(require '[clojurewerkz.elephant.customers :as ecr])
(let [cc {"number" "5555555555554444"
"exp_month" 12
"exp_year" 2019
"cvc" "123"
"name" "J Bindings MC Cardholder"
"address_line1" "140 2nd Street"
"address_line2" "4th Floor"
"address_city" "San Francisco"
"address_zip" "94105"
"address_state" "CA"
"address_country" "USA"}
c (ecr/retrieve "customer-id")
cm (ecc/create c cc)]
(ecc/retrieve c (:id cm))
clojurewerkz.elephant.cards/create
adds a new credit or
debit card to a customer:
(require '[clojurewerkz.elephant.cards :as ecc])
(require '[clojurewerkz.elephant.customers :as ecr])
(let [cc {"number" "5555555555554444"
"exp_month" 12
"exp_year" 2019
"cvc" "123"
"name" "J Bindings MC Cardholder"
"address_line1" "140 2nd Street"
"address_line2" "4th Floor"
"address_city" "San Francisco"
"address_zip" "94105"
"address_state" "CA"
"address_country" "USA"}
c (ecr/retrieve "customer-id")]
(ecc/create c cc))
clojurewerkz.elephant.cards/create-from-token
does the same thing
but takes a card token instead of a map.
Stripe Java client was upgraded to 1.27.1
.
Stripe Java client was upgraded to 1.23.0
.
clojurewerkz.elephant.customers/list
is a new function
that lists customers:
(require '[clojurewerkz.elephant.customers :as ecr])
(ecr/list)
(ecr/list {"limit" 100})
clojurewerkz.elephant.customers/retrieve-or-create
is a new function
that idempotently creates a customer:
(require '[clojurewerkz.elephant.customers :as ecr])
;; will create the customer on first invocation,
;; fetch and return it on subsequence ones
(ecr/retrieve-or-create "customer-id" customer)
The library now compiles with Clojure 1.7.
charge-
and transfer-enabled
values in customer maps now return false
instead of nil
.
Stripe Java client was upgraded to 1.19.1
.
clojurewerkz.elephant.plans/retrieve-or-create
is a new function
that idempotently creates a plan:
(require '[clojurewerkz.elephant.plans :as ep])
;; will create the plan on first invocation,
;; fetch and return it on subsequence ones
(ep/retrieve-or-create "plan-id" {"amount" 100
"currency" "usd"
"interval" "month"
"interval_count" 2
"name" "J Bindings Plan"})
clojurewerkz.elephant.plans/create
is a new function
that creates a subscription for provided customer:
(require '[clojurewerkz.elephant.customers :as ecr])
(require '[clojurewerkz.elephant.plans :as ep])
(require '[clojurewerkz.elephant.subscriptions :as esub])
(let [p (ep/create (unique-plan plan))
c (ecr/create customer)]
(esub/create c {"plan" (:id p)}))
clojurewerkz.elephant.plans/list
lists customer subscriptions:
(require '[clojurewerkz.elephant.customers :as ecr])
(require '[clojurewerkz.elephant.plans :as ep])
(require '[clojurewerkz.elephant.subscriptions :as esub])
(let [p (ep/create (unique-plan plan))
c (ecr/create customer)
x (esub/create c {"plan" (:id p)})]
(esub/list c))
clojurewerkz.elephant.plans/update
updates a subscription:
(require '[clojurewerkz.elephant.customers :as ecr])
(require '[clojurewerkz.elephant.plans :as ep])
(require '[clojurewerkz.elephant.subscriptions :as esub])
(let [p1 (ep/create (unique-plan plan))
p2 (ep/create (unique-plan plan))
c (ecr/create customer)
x (esub/create c {"plan" (:id p1)})]
(esub/update x {"plan" (:id p2)}))
clojurewerkz.elephant.plans/cancel
cancels a subscription:
(require '[clojurewerkz.elephant.customers :as ecr])
(require '[clojurewerkz.elephant.plans :as ep])
(require '[clojurewerkz.elephant.subscriptions :as esub])
(let [p (ep/create (unique-plan plan))
c (ecr/create customer)
x (esub/create c {"plan" (:id p)})]
(esub/cancel x))
clojurewerkz.elephant.plans/create
is a new function
that creates a (subscription) plan:
(p/create {"id" (str (java.util.UUID/randomUUID))
"amount" 10
"currency" "usd"
"interval" "month"
"interval_count" 2
"name" "Basic Plan"})
clojurewerkz.elephant.customers/create
is a new function
that creates a customer:
(c/create {"card" cc
"description" "A. N. Awesome Customer"})
clojurewerkz.elephant.customers/retrieve
fetches customer
information by id:
(c/retrieve "cus_4hnqECORF7glfI")
clojurewerkz.elephant.charges/refund
now supports
refund options, e.g. to perform partial refunds:
(let [x (ech/create opts)]
(ech/refund x {"amount" 50}))
clojurewerkz.elephant.charges/capture
is a new function that captures
a previously uncaptured charge:
(let [x (ech/create opts)]
(ech/capture x))
Initial release. Roughly 25% of the tests are ported.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close