export type DeleteApiV1CheckoutPaymentResourcesIdArgs = {id: string, 'Content-Type'?: string | undefined, 'PayPal-Auth-Assertion'?: string | undefined}; export type DeleteApiV1CheckoutPaymentResourcesIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a payment resource * * DELETE /v1/checkout/payment-resources/{id} * * Also accepts auth: Oauth2 */ export const deleteApiV1CheckoutPaymentResourcesId = async (args: DeleteApiV1CheckoutPaymentResourcesIdArgs, options?: DeleteApiV1CheckoutPaymentResourcesIdOptions) => { const {baseUrl = "https://api-m.paypal.com", fetch: fetchFn = fetch, Oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (args['PayPal-Auth-Assertion'] != null) headers.set("PayPal-Auth-Assertion", String(args['PayPal-Auth-Assertion'])) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/checkout/payment-resources/${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 };