export type DeleteApiV3PaymentsIdArgs = {id: string}; export type DeleteApiV3PaymentsIdOptions = {baseUrl?: string | undefined, apiKeyPaymentProfile?: string | undefined, fetch?: typeof fetch | undefined}; /** * cancel a payment * * DELETE /v3/payments/{id} * * Also accepts auth: JWS-Request-Signature-Payment */ export const deleteApiV3PaymentsId = async (args: DeleteApiV3PaymentsIdArgs, options?: DeleteApiV3PaymentsIdOptions) => { const {baseUrl = "https://merchant.api.preprod.bancontact.net", fetch: fetchFn = fetch, apiKeyPaymentProfile} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKeyPaymentProfile !== undefined) headers.set("Authorization", apiKeyPaymentProfile) const url = `${baseUrl.replace(/\/+$/, '')}/v3/payments/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };