function checkoutItem
checkoutItem(
listing:
PurchaseUnitFacts
& Pick<CheckoutItem, "name" | "slug">
& { id: number; }
,
quantity: number,
unitPrice: number,
purchase?: PurchaseContext,
): CheckoutItem

Build a CheckoutItem for one listing — the one constructor every real-listing checkout line is built from. purchase carries the purchase context that decides the unit (a renewal prices the same tier by its months per unit); absent means an ordinary purchase. Package provenance is not a listing fact, so a member line spreads its packageGroupId over the result.

Parameters

listing:
PurchaseUnitFacts
& Pick<CheckoutItem, "name" | "slug">
& { id: number; }
quantity: number
unitPrice: number
optional
purchase: PurchaseContext

Return Type

Usage

import { checkoutItem } from "docs/payments.ts";