The hosted-checkout rail: the customer pays on the processor's page.
Correlation is by session id, and the money is read back from the session
itself. What differs between processors — which event names mean settled,
where the amount sits in the body, how a notice is authenticated — is a
READER, supplied as data. This namespace holds the behaviour every hosted
checkout shares; payments.stripe is one reader over it, and a second
processor is a second reader, not a second rail.
The hosted-checkout rail: the customer pays on the processor's page. Correlation is by session id, and the money is read back from the session itself. What differs between processors — which event names mean settled, where the amount sits in the body, how a notice is authenticated — is a READER, supplied as data. This namespace holds the behaviour every hosted checkout shares; `payments.stripe` is one reader over it, and a second processor is a second reader, not a second rail.
(->rail {:keys [gateway reader provider-id success-url cancel-url]
:or {provider-id (:provider/id default-profile)}})Build a hosted-checkout rail over an ICardGateway.
:gateway opens and re-reads hosted checkouts, :reader says how to read
that processor's notices, and :success-url/:cancel-url are where the
customer lands afterwards.
Build a hosted-checkout rail over an ICardGateway. `:gateway` opens and re-reads hosted checkouts, `:reader` says how to read that processor's notices, and `:success-url`/`:cancel-url` are where the customer lands afterwards.
(checkout-state reader session)The CheckoutState session is in. Pure.
A session is paid or it is not; expiry only means anything about one that never was.
The CheckoutState `session` is in. Pure. A session is paid or it is not; expiry only means anything about one that never was.
(currency-agrees? currency invoice)True when currency — a processor's code, or nil — is invoice's.
A missing code agrees, and so does an invoice carrying none: a value only reaches here behind a valid signature or an unprompted read of our own session, so it is one of ours.
True when `currency` — a processor's code, or nil — is `invoice`'s. A missing code agrees, and so does an invoice carrying none: a value only reaches here behind a valid signature or an unprompted read of our own session, so it is one of ours.
No confirmations to wait for, no underpayment tolerated, and notices that carry their own signature.
No confirmations to wait for, no underpayment tolerated, and notices that carry their own signature.
The shape of a processor notice, as data.
:reader/authentic? is the whole authentication boundary: a reader that
cannot check a signature returns false and the rail settles by polling
alone, which is always safe and merely slower.
The shape of a processor notice, as data. `:reader/authentic?` is the whole authentication boundary: a reader that cannot check a signature returns false and the rail settles by polling alone, which is always safe and merely slower.
(entry config)A registry entry {:profile :rail} for a hosted-checkout rail.
A registry entry {:profile :rail} for a hosted-checkout rail.
(event-amount reader object)The paid amount the event reports, or 0.
The paid amount the event reports, or 0.
(event-matches-invoice? reader payload invoice)True when the event's object names invoice — by the reference set when the
checkout was opened, or by the session id recorded on the invoice.
True when the event's object names `invoice` — by the reference set when the checkout was opened, or by the session id recorded on the invoice.
(parse-event reader provider-id payload expected-amount external-ref)Normalize a processor event into a Settlement. Pure.
expected-amount and external-ref come from the invoice, not the event.
external-ref is also the settlement's only reference, so the same money
seen as an event and as a polled session is one movement, not two.
Normalize a processor event into a Settlement. Pure. `expected-amount` and `external-ref` come from the invoice, not the event. `external-ref` is also the settlement's only reference, so the same money seen as an event and as a polled session is one movement, not two.
(session-settlement reader provider-id session invoice)Normalize a CheckoutSession into a Settlement for invoice.
Nil when the session is denominated in another currency. The amount owed comes from the invoice; only the amount paid comes from the session.
Normalize a CheckoutSession into a Settlement for `invoice`. Nil when the session is denominated in another currency. The amount owed comes from the invoice; only the amount paid comes from the session.
(subject-of reader notice)The invoice id notice claims, as a uuid, or nil.
The invoice id `notice` claims, as a uuid, or nil.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |