On this page:
journal-record
journal-acceptance
journal-accept!
journal-ref

4 Durable event journal🔗ℹ

 (require commerce/journal) package: commerce

Server processes explicitly require commerce/journal. It is not re-exported from the default product-safe facade.

struct

(struct journal-record (sequence event payload received-at))

  sequence : exact-nonnegative-integer?
  event : payment-event?
  payload : bytes?
  received-at : exact-nonnegative-integer?
One durably accepted provider event: original sequence, canonical snapshot, the exact raw payload bytes, and the receive time.

struct

(struct journal-acceptance (disposition record))

  disposition : (or/c 'accepted 'replayed)
  record : journal-record?
The acceptance disposition is 'accepted for a newly committed row or 'replayed for an exact retry.

procedure

(journal-accept! storage 
  raw-payload 
  event 
  #:received-at received-at) 
 → journal-acceptance?
  storage : commerce-storage?
  raw-payload : bytes?
  event : payment-event?
  received-at : exact-nonnegative-integer?
Copies and hashes the exact authenticated bytes, then durably stores them with the canonical payment-event snapshot. The same provider event id with changed raw or canonical content raises an exn:fail:commerce whose code is 'event-conflict. Digest mismatch is rejected before persistence.

procedure

(journal-ref storage provider event-id)

 → (or/c journal-record? #f)
  storage : commerce-storage?
  provider : string?
  event-id : string?
Returns the original sequence, canonical event, immutable raw payload, and receive time.