/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { CartItem, CartItem$Outbound, CartItem$outboundSchema, } from "./cartitem.js"; import { GuestBuyer, GuestBuyer$Outbound, GuestBuyer$outboundSchema, } from "./guestbuyer.js"; import { StatementDescriptor, StatementDescriptor$Outbound, StatementDescriptor$outboundSchema, } from "./statementdescriptor.js"; import { TransactionConnectionOptions, TransactionConnectionOptions$Outbound, TransactionConnectionOptions$outboundSchema, } from "./transactionconnectionoptions.js"; import { TransactionIntent, TransactionIntent$outboundSchema, } from "./transactionintent.js"; import { TransactionPaymentSource, TransactionPaymentSource$outboundSchema, } from "./transactionpaymentsource.js"; export type PaymentLinkCreate = { /** * The guest buyer for the payment link. */ buyer?: GuestBuyer | null | undefined; /** * The expiration date and time for the payment link. */ expiresAt?: Date | null | undefined; /** * Connection options for the payment link. */ connectionOptions?: TransactionConnectionOptions | null | undefined; /** * The merchant reference for the payment link. */ externalIdentifier?: string | null | undefined; /** * The statement descriptor for the payment link. */ statementDescriptor?: StatementDescriptor | null | undefined; /** * The locale for the payment link. */ locale?: string | null | undefined; /** * The merchant's display name. */ merchantName?: string | null | undefined; /** * The merchant's website URL. */ merchantUrl?: string | null | undefined; /** * The merchant's banner image URL. */ merchantBannerUrl?: string | null | undefined; /** * The merchant's brand color. */ merchantColor?: string | null | undefined; /** * A message from the merchant. */ merchantMessage?: string | null | undefined; /** * URL to the merchant's terms and conditions. */ merchantTermsAndConditionsUrl?: string | null | undefined; /** * URL to the merchant's favicon. */ merchantFaviconUrl?: string | null | undefined; /** * The amount for the payment link. */ amount: number; /** * The country code for the payment link. */ country: string; /** * The currency code for the payment link. */ currency: string; intent?: TransactionIntent | undefined; /** * The return URL after payment completion. */ returnUrl?: string | null | undefined; /** * The cart items for the payment link. */ cartItems?: Array | null | undefined; /** * Arbitrary metadata for the payment link. */ metadata?: { [k: string]: any } | null | undefined; /** * The way payment method information made it to this transaction. */ paymentSource?: TransactionPaymentSource | undefined; /** * Whether to store the payment method for future use. */ store?: boolean | undefined; /** * The ID of the buyer to associate the payment method with. Note: When `buyer_id` is provided, the payment link should be treated as a secret as it will allow the user to manage payment methods for the associated buyer. */ buyerId?: string | null | undefined; /** * The number of installments a buyer is required to make. */ installmentCount?: number | null | undefined; }; /** @internal */ export type PaymentLinkCreate$Outbound = { buyer?: GuestBuyer$Outbound | null | undefined; expires_at?: string | null | undefined; connection_options?: TransactionConnectionOptions$Outbound | null | undefined; external_identifier?: string | null | undefined; statement_descriptor?: StatementDescriptor$Outbound | null | undefined; locale?: string | null | undefined; merchant_name?: string | null | undefined; merchant_url?: string | null | undefined; merchant_banner_url?: string | null | undefined; merchant_color?: string | null | undefined; merchant_message?: string | null | undefined; merchant_terms_and_conditions_url?: string | null | undefined; merchant_favicon_url?: string | null | undefined; amount: number; country: string; currency: string; intent?: string | undefined; return_url?: string | null | undefined; cart_items?: Array | null | undefined; metadata?: { [k: string]: any } | null | undefined; payment_source?: string | undefined; store: boolean; buyer_id?: string | null | undefined; installment_count?: number | null | undefined; }; /** @internal */ export const PaymentLinkCreate$outboundSchema: z.ZodType< PaymentLinkCreate$Outbound, z.ZodTypeDef, PaymentLinkCreate > = z.object({ buyer: z.nullable(GuestBuyer$outboundSchema).optional(), expiresAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), connectionOptions: z.nullable(TransactionConnectionOptions$outboundSchema) .optional(), externalIdentifier: z.nullable(z.string()).optional(), statementDescriptor: z.nullable(StatementDescriptor$outboundSchema) .optional(), locale: z.nullable(z.string()).optional(), merchantName: z.nullable(z.string()).optional(), merchantUrl: z.nullable(z.string()).optional(), merchantBannerUrl: z.nullable(z.string()).optional(), merchantColor: z.nullable(z.string()).optional(), merchantMessage: z.nullable(z.string()).optional(), merchantTermsAndConditionsUrl: z.nullable(z.string()).optional(), merchantFaviconUrl: z.nullable(z.string()).optional(), amount: z.number().int(), country: z.string(), currency: z.string(), intent: TransactionIntent$outboundSchema.optional(), returnUrl: z.nullable(z.string()).optional(), cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(), metadata: z.nullable(z.record(z.any())).optional(), paymentSource: TransactionPaymentSource$outboundSchema.optional(), store: z.boolean().default(false), buyerId: z.nullable(z.string()).optional(), installmentCount: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { expiresAt: "expires_at", connectionOptions: "connection_options", externalIdentifier: "external_identifier", statementDescriptor: "statement_descriptor", merchantName: "merchant_name", merchantUrl: "merchant_url", merchantBannerUrl: "merchant_banner_url", merchantColor: "merchant_color", merchantMessage: "merchant_message", merchantTermsAndConditionsUrl: "merchant_terms_and_conditions_url", merchantFaviconUrl: "merchant_favicon_url", returnUrl: "return_url", cartItems: "cart_items", paymentSource: "payment_source", buyerId: "buyer_id", installmentCount: "installment_count", }); }); export function paymentLinkCreateToJSON( paymentLinkCreate: PaymentLinkCreate, ): string { return JSON.stringify( PaymentLinkCreate$outboundSchema.parse(paymentLinkCreate), ); }