function enforceMetadataLimits
enforceMetadataLimits(
metadata: Record<string, string>,
maxValueLength: number,
maxEntries?: number,
): Record<string, string>

Only the fields that grow with what the buyer selected can realistically exceed the per-value limit. Form validation already holds every other field well below the smallest provider limit of 255.

thank_you_url is deliberately NOT handled here. It must never fail a checkout, so an over-cap URL is dropped before signing, in buildItemsMetadata. A cap here, after signPrice, would strip a key the proof covers, and the webhook would read the session as tampered.

Parameters

metadata: Record<string, string>
maxValueLength: number
optional
maxEntries: number

Return Type

Record<string, string>

Usage

import { enforceMetadataLimits } from "doc.ts";