export type CreateApiV1PayoutPayoutIdCancelArgs = {'x-api-key'?: string | undefined}; export type CreateApiV1PayoutPayoutIdCancelOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel a scheduled/recurring payout * * POST /v1/payout/{payout_id}/cancel */ export const createApiV1PayoutPayoutIdCancel = async (args: CreateApiV1PayoutPayoutIdCancelArgs, options?: CreateApiV1PayoutPayoutIdCancelOptions) => { const {baseUrl = "https://api.nowpayments.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/payout/${encodeURIComponent(String(args.payout_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 };