import type { AgentbankMerchant } from '../client.js'; import type { X402PaymentRequirements } from '../types.js'; export type CheckoutLineItem = { /** Your product id / SKU. */ sku: string; quantity: number; /** Minor units (e.g. cents). YOU set this from your own catalog. */ unitPrice: number; name?: string; }; /** * How a CARDHOLDER should see this order, in the merchant's own words. * * ⚠️ NOT decoration, and not ours to invent. Rails that authenticate the * cardholder on their own page — UnionPay Agent Pay is the one here — show them * the merchant and the items before they confirm, and refuse an order that does * not carry them. Until 2026-09-07 these were string literals inside one * storefront ('Sinocare', 'https://www.sinocare.com'), which is correct for * exactly one merchant and wrong for the second: their cardholder would have * been shown someone else's shop name on UnionPay's confirm page. * * Carried on the payment intent, so every party that might have to build that * message — the storefront, the hosted approval page, the gateway — reads the * same answer instead of each holding its own copy. */ export type CheckoutDisplay = { /** The shop's name as the cardholder knows it. */ merchantName: string; /** Its public home page. */ merchantUrl: string; /** Per-sku: where this product lives, and one line about it. */ items?: Record; }; export type OpenCheckoutInput = { items: CheckoutLineItem[]; /** Must match your merchant account's currency (USD/EUR/USDT/USDC). */ currency: string; /** * UCP + stablecoin only: which chain for a multi-chain asset — 'base' (default, * EVM) or 'solana'. Freezes an x402 challenge for that chain on the session. */ chain?: string; /** Overrides the client's configured `merchantId` for this call. */ merchantId?: string; /** * How a cardholder should see this order. Required by any rail that shows * them the merchant and the items before they confirm — see CheckoutDisplay. */ display?: CheckoutDisplay; /** * Stripe-style idempotency key. Send the SAME value when retrying a checkout * you're unsure completed — the gateway returns the original session instead of * opening (and charging) a second one. Recommended for any retry-on-timeout * path. (The gateway also auto-dedups identical checkouts within a short window * even without a key, but an explicit key is exact-once.) */ idempotencyKey?: string; /** * Who is buying, when you know. Stored on the order and forwarded to the * payment provider, so the sale is attributable to a person rather than an * anonymous charge. Free-form, but `{ name, email }` is what the downstream * integrations read. * * Send it only if the buyer really gave it to you — an invented identity is * worse than none, and every consumer of this field treats it as fact. */ buyer?: Record; }; export type Checkout = { /** The checkout id the buyer agent completes to pay. */ id: string; status: string; /** Total in minor units. */ amount: number; currency: string; /** * UCP only: the merchant-signed AP2 CartMandate for this session. Hand it to * the buyer agent — it binds a PaymentMandate to `mandate.cartHash` to * complete programmatically (no human trusted-UI handoff). Undefined for ACP. */ mandate?: unknown; /** * UCP stablecoin sessions only: the frozen x402 challenge (payTo / asset / * network / amount) for a stablecoin-priced session. "UCP supports x402" is * chain-agnostic, so `currency` picks the chain: USDC (EVM) or RLUSD (XRP * Ledger). Hand `x402.accepts[0]` to the buyer agent to sign for that chain * (an EIP-3009 authorization for USDC, an XRPL Payment for RLUSD) and pay at * /complete (X-PAYMENT header), settled over the stablecoin rail. Undefined for * a card-priced session. */ x402?: { x402Version: number; accepts: X402PaymentRequirements[]; }; }; export declare class CheckoutResource { private readonly client; constructor(client: AgentbankMerchant); openACP(input: OpenCheckoutInput): Promise; openX402(input: OpenX402CheckoutInput): Promise; openUCP(input: OpenCheckoutInput): Promise; chargeSkyfire(input: SkyfireChargeInput): Promise; openMPP(input: OpenMppInput): Promise; } export type SkyfireChargeInput = { /** The KYAPay PAY token the buyer agent presented (an `eyJ…` JWT). */ token: string; /** * What you're selling, in human words (e.g. "Val d'Isère — ski week"). Skyfire is * token-driven (the gateway holds no catalog), so WITHOUT this your order shows a * bare "Skyfire KYAPay charge". Only honored from YOUR merchant credential — a * buyer can't set it. */ description?: string; /** Overrides the client's configured `merchantId` for this call. */ merchantId?: string; }; export type SkyfireCharge = { paymentIntentId: string; status: string; amount: number; currency: string; /** True when a seller-charge redeemed the token (real money moved); false = verify + record. */ settled: boolean; agent: { subject?: string; tokenType?: string; verified: boolean; }; }; export type OpenMppInput = { /** Authoritative amount in minor units (6-dp for stablecoins). YOU set this. */ amount: number; currency: string; /** Settlement method: 'agentbank' (default, your rail) or 'tempo' (on-chain TIP-20). */ method?: 'agentbank' | 'tempo'; /** Optional caller reference, signed into the challenge and echoed back. */ reference?: string; /** * What you're selling, in human words (e.g. "Val d'Isère — ski week"). MPP is * amount-driven (the gateway holds no catalog), so WITHOUT this your order shows * a generic "MPP charge" line item. Signed into the challenge, so a buyer can't * rewrite it. */ description?: string; /** * The buyer's `Payment …` credential. Omit on the FIRST call to get the * challenge; pass it on the retry to settle. */ credential?: string; merchantId?: string; idempotencyKey?: string; }; export type MppChallengeResult = { status: 'payment_required'; /** The `WWW-Authenticate: Payment …` value to return to the buyer agent as your 402. */ wwwAuthenticate: string; }; export type MppSettledResult = { status: 'settled'; paymentIntentId: string; amount: number; currency: string; /** The gateway PaymentIntent status ('captured' once the charge settled). */ paymentStatus?: string; /** True when the charge settled (tempo: on-chain verified). Derived from paymentStatus. */ settled?: boolean; }; export type OpenX402CheckoutInput = { items: CheckoutLineItem[]; /** Authoritative total in 6-dp minor units (USDC/RLUSD share the scale). YOU set this. */ amount: number; /** Stablecoin to receive: 'USDC' (default) or 'RLUSD' (XRP Ledger). */ currency?: string; /** Chain for a multi-chain asset: 'base' (default, EVM) or 'solana'. */ chain?: string; /** Overrides the client's configured `merchantId` for this call. */ merchantId?: string; /** Stripe-style idempotency key — send the same value on a retry to dedup. */ idempotencyKey?: string; }; export type X402Checkout = { /** The session id the buyer pays with `{ sessionId }`. */ sessionId: string; x402Version: number; /** The x402 challenge the buyer signs against (payTo = your USDC address). */ accepts: X402PaymentRequirements[]; amount: number; currency: string; payTo: string; network: string; }; //# sourceMappingURL=checkout.d.ts.map