function validatedPaymentSession
validatedPaymentSession(fields: { amountTotal: number; createdAt: string | undefined; id: string; metadata: SessionMetadata; paymentReference: string; paymentStatus: ValidatedPaymentSession["paymentStatus"]; }): ValidatedPaymentSession

Assemble the one ValidatedPaymentSession shape every provider adapter returns. Owns the createdAt rule — the key is left out entirely when the provider gave no usable timestamp — and normalizes the guarded wire metadata into the canonical shape. metadata must already have passed hasRequiredSessionMetadata (or come from our own staged checkout row).

Parameters

fields: { amountTotal: number; createdAt: string | undefined; id: string; metadata: SessionMetadata; paymentReference: string; paymentStatus: ValidatedPaymentSession["paymentStatus"]; }

Return Type

Usage

import { validatedPaymentSession } from "doc.ts";