/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CardScheme, CardScheme$inboundSchema } from "./cardscheme.js"; import { CheckoutSessionPaymentMethodDetails, CheckoutSessionPaymentMethodDetails$inboundSchema, } from "./checkoutsessionpaymentmethoddetails.js"; export type CheckoutSessionPaymentMethod = { /** * Always `payment-method` */ type: "payment-method"; /** * The ID of the payment method. */ id?: string | null | undefined; /** * Details for credit or debit card payment method. */ details?: CheckoutSessionPaymentMethodDetails | null | undefined; /** * The last 4 digits of the the card. */ label?: string | null | undefined; /** * Always `card` */ method: "card"; /** * The scheme of the card. */ scheme?: CardScheme | null | undefined; /** * The unique hash derived from the card number. */ fingerprint?: string | null | undefined; }; /** @internal */ export const CheckoutSessionPaymentMethod$inboundSchema: z.ZodType< CheckoutSessionPaymentMethod, z.ZodTypeDef, unknown > = z.object({ type: z.literal("payment-method").default("payment-method"), id: z.nullable(z.string()).optional(), details: z.nullable(CheckoutSessionPaymentMethodDetails$inboundSchema) .optional(), label: z.nullable(z.string()).optional(), method: z.literal("card").default("card"), scheme: z.nullable(CardScheme$inboundSchema).optional(), fingerprint: z.nullable(z.string()).optional(), }); export function checkoutSessionPaymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CheckoutSessionPaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CheckoutSessionPaymentMethod' from JSON`, ); }