Clojure client implementation for Mollie API.
See the clojars page for the latest version.
(require '[com.adgoji.mollie.api :as mollie.api]
(def mollie-client
(mollie.api/new-client {:api-key "your-api-key"}))
All functions are available in the com.adgoji.mollie.api
namespace:
(mollie.api/create-payment mollie-client
{:amount
{:value 100.00M
:currency "EUR"}
:description "Buying some good stuff"
:redirect-url "https://example.com"})
;; => {:com.adgoji.mollie.payment/status :open,
;; :com.adgoji.mollie.payment/redirect-url "https://example.com",
;; :com.adgoji.mollie.payment/resource "payment",
;; :com.adgoji.mollie.payment/id "tr_oXHpf8Rk8w",
;; :com.adgoji.mollie.payment/amount
;; #:com.adgoji.mollie.amount{:value 100.00M, :currency "EUR"},
;; :com.adgoji.mollie.payment/description "Buying some good stuff",
;; :com.adgoji.mollie.payment/created-at
;; #object[java.time.Instant 0x6e7855d9 "2023-06-29T20:36:32Z"],
;; :com.adgoji.mollie.link/self
;; #:com.adgoji.mollie.link{:href "https://api.mollie.com/v2/payments/tr_oXHpf8Rk8w",
;; :type "application/hal+json"},
;; :com.adgoji.mollie.payment/expires-at
;; #object[java.time.Instant 0x25f9a736 "2023-06-29T20:51:32Z"],
;; :com.adgoji.mollie.link/dashboard
;; #:com.adgoji.mollie.link{:href "https://my.mollie.com/dashboard/org_17446479/payments/tr_oXHpf8Rk8w",
;; :type "text/html"},
;; :com.adgoji.mollie.payment/mode :test,
;; :com.adgoji.mollie.link/documentation
;; #:com.adgoji.mollie.link{:href "https://docs.mollie.com/reference/v2/payments-api/create-payment",
;; :type "text/html"},
;; :com.adgoji.mollie.payment/profile-id "pfl_25emLDBma5",
;; :com.adgoji.mollie.payment/method nil,
;; :com.adgoji.mollie.link/checkout
;; #:com.adgoji.mollie.link{:href "https://www.mollie.com/checkout/select-method/oXHpf8Rk8w",
;; :type "text/html"},
;; :com.adgoji.mollie.payment/details nil,
;; :com.adgoji.mollie.payment/sequence-type :oneoff}
(require '[com.adgoji.mollie.payment :as payment])
(::payment/id *1)
;; => "tr_oXHpf8Rk8w"
(mollie.api/get-payment-by-id client "tr_oXHpf8Rk8w")
All functions in the com.adgoji.mollie.api
namespace are covered by
spec. If your editor supports spec (like CIDER), it's a very
convenient way to explore the library:
All responses are returned as hash maps with fully qualified keywords as keys. Please browse specs for more details.
:base-url
(string: optional, default https://api.mollie.com
) -
redefine Mollie API base URL.:api-key
(string: required):check-response?
(boolean: optional, default false
) - additionally
check if response conforms to spec. This is disabled by default, so
if response is changed on the Mollie side, client will continue
working (although results may be unpredictable).:throw-exceptions?
(boolean: optional, default true
) - throw
exceptions on faulty HTTP statuses (>=400) from Mollie API.All functions that return list of entities support pagination
parameters - from
and limit
. Both parameters are optional:
from
parameter is provided - return all entities from all
pages starting from the provided entity ID.limit
parameter is provided - return only requested number
of entities starting from the first entity.Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close