/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; /** * Create an Apple Pay transaction with a device or merchant token. */ export type ApplePayPaymentMethodCreate = { /** * The external identifier of the buyer to create a payment for. */ buyerExternalIdentifier?: string | null | undefined; /** * The ID of the buyer to retrieve billing details for. */ buyerId?: string | null | undefined; /** * The card holder name associated to the original card for the token. */ cardholderName?: string | null | undefined; /** * The URL to redirect a user back to after the complete 3DS in browser. */ redirectUrl?: string | null | undefined; /** * The last 4 digits of the original card used to generate the token. */ cardSuffix?: string | null | undefined; /** * The original card scheme for which the token was generated. */ cardScheme?: string | null | undefined; /** * The payment scheme of the card. */ cardType?: string | null | undefined; /** * Always `applepay` */ method: "applepay"; /** * The opaque token as received from the Apple Pay JS library. This format may change between JS library versions. */ token: { [k: string]: any }; }; /** @internal */ export type ApplePayPaymentMethodCreate$Outbound = { buyer_external_identifier?: string | null | undefined; buyer_id?: string | null | undefined; cardholder_name?: string | null | undefined; redirect_url?: string | null | undefined; card_suffix?: string | null | undefined; card_scheme?: string | null | undefined; card_type?: string | null | undefined; method: "applepay"; token: { [k: string]: any }; }; /** @internal */ export const ApplePayPaymentMethodCreate$outboundSchema: z.ZodType< ApplePayPaymentMethodCreate$Outbound, z.ZodTypeDef, ApplePayPaymentMethodCreate > = z.object({ buyerExternalIdentifier: z.nullable(z.string()).optional(), buyerId: z.nullable(z.string()).optional(), cardholderName: z.nullable(z.string()).optional(), redirectUrl: z.nullable(z.string()).optional(), cardSuffix: z.nullable(z.string()).optional(), cardScheme: z.nullable(z.string()).optional(), cardType: z.nullable(z.string()).optional(), method: z.literal("applepay"), token: z.record(z.any()), }).transform((v) => { return remap$(v, { buyerExternalIdentifier: "buyer_external_identifier", buyerId: "buyer_id", cardholderName: "cardholder_name", redirectUrl: "redirect_url", cardSuffix: "card_suffix", cardScheme: "card_scheme", cardType: "card_type", }); }); export function applePayPaymentMethodCreateToJSON( applePayPaymentMethodCreate: ApplePayPaymentMethodCreate, ): string { return JSON.stringify( ApplePayPaymentMethodCreate$outboundSchema.parse( applePayPaymentMethodCreate, ), ); }