export type CreateApiAgentCommerceUcpCheckoutSessionsIdCompleteArgs = {id: string, body: {buyer?: ({email?: string | undefined, first_name?: string | undefined, last_name?: string | undefined, full_name?: string | undefined, phone_number?: string | undefined}) | undefined, payment_data?: ({handler_id: 'mondoir-usdc', instrument: {type: 'wallet', credential: {type: 'x402' | 'mpp', token: string}}} | {type: 'wallet', credential: {type: 'x402' | 'mpp', token: string}, id: string, handler_id: 'mondoir-usdc'}) | undefined}}; export type CreateApiAgentCommerceUcpCheckoutSessionsIdCompleteOptions = {baseUrl?: string | undefined, agentBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Negotiate x402 or MPP, then submit one signed proof; HTTP 202 means do not repay. * * POST /agent-commerce/ucp/checkout-sessions/{id}/complete */ export const createApiAgentCommerceUcpCheckoutSessionsIdComplete = async (args: CreateApiAgentCommerceUcpCheckoutSessionsIdCompleteArgs, options?: CreateApiAgentCommerceUcpCheckoutSessionsIdCompleteOptions) => { const {baseUrl = "https://mondoir.art", fetch: fetchFn = fetch, agentBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (agentBearer !== undefined) headers.set('authorization', `Bearer ${agentBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/agent-commerce/ucp/checkout-sessions/${encodeURIComponent(String(args.id))}/complete${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };