import { APIResource } from "../core/resource.mjs"; import { APIPromise } from "../core/api-promise.mjs"; import { RequestOptions } from "../internal/request-options.mjs"; /** * Let an agent pay on a customer's behalf with a single-use virtual card. * Connect a customer once, then create a payment — a virtual card is minted * scoped to that purchase and the card details are handed back for checkout. */ export declare class Payments extends APIResource { /** * Advances the pay flow for a connected customer handle and returns a `status` * describing where it is (`needs_connection`, `awaiting_user_action`, `ready`, * ...). A payment `id` appears once a card is minted. Idempotent on the * `Idempotency-Key` header. * * @example * ```ts * const payment = await client.payments.create({ * amount_cents: 2500, * currency: 'usd', * handle: '+14155550123', * }); * ``` */ create(body: PaymentCreateParams, options?: RequestOptions): APIPromise; /** * Get a payment * * @example * ```ts * const payment = await client.payments.retrieve('paymentId'); * ``` */ retrieve(paymentID: string, options?: RequestOptions): APIPromise; /** * Closes the virtual card and cancels the payment. * * @example * ```ts * const payment = await client.payments.cancel('paymentId'); * ``` */ cancel(paymentID: string, options?: RequestOptions): APIPromise; /** * Returns a short-lived handoff for a `ready` payment. Fetch the card credentials * **directly from the provider** with the returned `user_token` at `fetch_url` — * the card number never passes through Linq. Do not persist PAN/CVC. * * @example * ```ts * const response = await client.payments.credentials( * 'paymentId', * ); * ``` */ credentials(paymentID: string, options?: RequestOptions): APIPromise; } export interface Payment { id?: string; amount_cents?: number; /** * Present when the customer must approve with a passkey. */ approval_url?: string; /** * Present when the customer must attach a card. */ attach_url?: string; currency?: string; description?: string; handle?: string; status?: 'needs_connection' | 'connecting' | 'awaiting_user_action' | 'ready' | 'authorized' | 'succeeded' | 'declined' | 'canceled' | 'expired'; } export interface PaymentCredentialsResponse { /** * Fetch the card directly from the provider with these — never through Linq. */ handoff?: PaymentCredentialsResponse.Handoff; } export declare namespace PaymentCredentialsResponse { /** * Fetch the card directly from the provider with these — never through Linq. */ interface Handoff { card_ref?: string; fetch_url?: string; provider?: string; /** * Short-lived bearer to fetch the card from the provider. */ user_token?: string; } } export interface PaymentCreateParams { amount_cents: number; currency: string; /** * Customer phone (E.164) or email. */ handle: string; description?: string; merchant?: PaymentCreateParams.Merchant; metadata?: { [key: string]: string; }; } export declare namespace PaymentCreateParams { interface Merchant { name?: string; url?: string; } } export declare namespace Payments { export { type Payment as Payment, type PaymentCredentialsResponse as PaymentCredentialsResponse, type PaymentCreateParams as PaymentCreateParams, }; } //# sourceMappingURL=payments.d.mts.map