/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; export type CreatePriceTier = { /** * flat_amount is the flat amount for the given tier (optional) * * @remarks * Applied on top of unit_amount*quantity. Useful for cases like "2.7$ + 5c" */ flatAmount?: string | undefined; /** * unit_amount is the amount per unit for the given tier */ unitAmount: string; /** * up_to is the quantity up to which this tier applies. It is null for the last tier. * * @remarks * IMPORTANT: Tier boundaries are INCLUSIVE. * - If up_to is 1000, then quantity less than or equal to 1000 belongs to this tier * - This behavior is consistent across both VOLUME and SLAB tier modes */ upTo?: number | undefined; }; /** @internal */ export type CreatePriceTier$Outbound = { flat_amount?: string | undefined; unit_amount: string; up_to?: number | undefined; }; /** @internal */ export const CreatePriceTier$outboundSchema: z.ZodMiniType< CreatePriceTier$Outbound, CreatePriceTier > = z.pipe( z.object({ flatAmount: z.optional(z.string()), unitAmount: z.string(), upTo: z.optional(z.int()), }), z.transform((v) => { return remap$(v, { flatAmount: "flat_amount", unitAmount: "unit_amount", upTo: "up_to", }); }), ); export function createPriceTierToJSON( createPriceTier: CreatePriceTier, ): string { return JSON.stringify(CreatePriceTier$outboundSchema.parse(createPriceTier)); }