/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; /** * Plaid Payment Method * * @remarks * * Plaid Payment Method to use in a transaction. */ export type PlaidPaymentMethodCreate = { /** * Always `plaid`. */ method?: "plaid" | undefined; /** * The public token obtained after using Plaid Link. */ token: string; /** * The Plaid account ID corresponding to the end-user account. If not provided will be fetched from Plaid API expecting to only have one. */ accountId?: string | null | undefined; /** * The ID of the Plaid payment service related to the provided public token. If not provided will be fetched from the currently active expecting to have a single one. */ paymentServiceId?: string | null | undefined; /** * The ID of the buyer to attach the method to. */ buyerId?: string | null | undefined; /** * The merchant reference for this payment method. */ buyerExternalIdentifier?: string | null | undefined; /** * The merchant identifier for this payment method. */ externalIdentifier?: string | null | undefined; }; /** @internal */ export type PlaidPaymentMethodCreate$Outbound = { method: "plaid"; token: string; account_id?: string | null | undefined; payment_service_id?: string | null | undefined; buyer_id?: string | null | undefined; buyer_external_identifier?: string | null | undefined; external_identifier?: string | null | undefined; }; /** @internal */ export const PlaidPaymentMethodCreate$outboundSchema: z.ZodType< PlaidPaymentMethodCreate$Outbound, z.ZodTypeDef, PlaidPaymentMethodCreate > = z.object({ method: z.literal("plaid").default("plaid" as const), token: z.string(), accountId: z.nullable(z.string()).optional(), paymentServiceId: z.nullable(z.string()).optional(), buyerId: z.nullable(z.string()).optional(), buyerExternalIdentifier: z.nullable(z.string()).optional(), externalIdentifier: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", paymentServiceId: "payment_service_id", buyerId: "buyer_id", buyerExternalIdentifier: "buyer_external_identifier", externalIdentifier: "external_identifier", }); }); export function plaidPaymentMethodCreateToJSON( plaidPaymentMethodCreate: PlaidPaymentMethodCreate, ): string { return JSON.stringify( PlaidPaymentMethodCreate$outboundSchema.parse(plaidPaymentMethodCreate), ); }