export type CreateApiAgentCommerceUcpCheckoutSessionsIdCancelArgs = {id: string}; export type CreateApiAgentCommerceUcpCheckoutSessionsIdCancelOptions = {baseUrl?: string | undefined, agentBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel an unpaid checkout; in-flight or settled payments cannot be canceled. * * POST /agent-commerce/ucp/checkout-sessions/{id}/cancel */ export const createApiAgentCommerceUcpCheckoutSessionsIdCancel = async (args: CreateApiAgentCommerceUcpCheckoutSessionsIdCancelArgs, options?: CreateApiAgentCommerceUcpCheckoutSessionsIdCancelOptions) => { const {baseUrl = "https://mondoir.art", fetch: fetchFn = fetch, agentBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (agentBearer !== undefined) headers.set('authorization', `Bearer ${agentBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/agent-commerce/ucp/checkout-sessions/${encodeURIComponent(String(args.id))}/cancel${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };