DataData ModelSections
Data Model Designed
What the service keeps, how the pieces relate, and what every field means. The SQL is on the Schema tab.
Entities
Order
One request for payment.
Belongs to one user and one app, by ID and name. Matches one Stripe checkout session.
payment.orders
Stripe event
A message from Stripe already processed.
Refers to an order by ID.
payment.stripe_events
Processed event
A platform event already acted on.
Stands alone.
payment.inbound_events
Life of each record
- Order
- `pending` when created → `paid` when Stripe confirms, `expired` when Stripe closes the page unpaid, or `failed` when a delayed payment fails. A paid order never changes again; an expired or failed one is replaced by a new order if the person pays later.
- Checkout address
- Kept while the order is pending, so Pay can reuse it; cleared when the order settles.
Fields
payment.orders
One row per request for payment. The order, not Stripe, is the record an app checks before unlocking anything.
iduuid- The order's ID; also Stripe's
client_reference_idand idempotency key. - Primary key. UUIDv7
owner_iduuidcan be empty- Who pays. A plain ID.
- Empty only after the owner's account is deleted
apptext- Which app asked for payment, for example
docflow. - 1 to 50 characters, from the
appclaim of the delegated token referencetext- What is paid for, in the app's terms.
- 1 to 200 characters
descriptiontext- Shown on the checkout page and the receipt.
- 1 to 200 characters
amountinteger- The price in minor units (cents). Never a decimal.
- 50 to 100,000
currencytext- ISO 4217 code.
USDin version 1statustextdefault 'pending'- Where the payment is.
pending,paid,expiredorfailedstripe_session_idtextcan be empty- Stripe's checkout session, to match its events to this order.
- Unique. Starts
cs_ checkout_urltextcan be empty- Where the person pays; returned again if they click Pay twice.
- Stripe's address; kept only while pending
checkout_expires_attimestamptzcan be empty- When Stripe closes the checkout page.
- 1 hour after creation
paid_attimestamptzcan be empty- When Stripe confirmed payment.
- Set exactly when paid
created_attimestamptzdefault now()- When the order was created.
payment.stripe_events
One row per Stripe event received, written before the event is acted on, so a repeat changes nothing.
event_idtext- Stripe's event ID.
- Primary key. Starts
evt_ typetext- Stripe's event type.
- 1 to 100 characters
order_iduuidcan be empty- The order it concerned, when there was one.
created_attimestamptzdefault now()- When Payment processed it.
payment.inbound_events
One row per platform event Payment has acted on, so a repeat has no effect.
event_iduuid- The event's ID.
- Primary key
typetext- What happened.
- 1 to 100 characters
created_attimestamptzdefault now()- When Payment processed it.
The service template also gives Payment audit_events, idempotency_keys and outbound_events. Payment writes order.created, order.paid, order.expired and order.failed to audit_events and announces the same through outbound_events.
Data model level: business rules the service guarantees
- An order becomes paid only from a verified Stripe event, never from the browser's return.
- A paid order never changes status again.
- Charging twice for the same reference is impossible, even when requests or events repeat.
- An app learns of every change through a signed event, and can always confirm by reading the order.
- Deleting an account keeps its orders as payment records without the link to the person.
What is deliberately not stored
- Card numbers, expiry dates and CVCs: they go to Stripe only.
- Stripe's full event bodies: only the event ID and type.
- Prices: each app's server sets its own, per order.