export type DeleteApiBillingSubscriptionsSubscriptionIdPaymentMethodsPaymentMethodIdArgs = {subscription_id: string, payment_method_id: string}; export type DeleteApiBillingSubscriptionsSubscriptionIdPaymentMethodsPaymentMethodIdOptions = {baseUrl: string, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a payment method * * DELETE /billing/subscriptions/{subscription_id}/payment-methods/{payment_method_id} * * Also accepts auth: APIKeyAuth */ export const deleteApiBillingSubscriptionsSubscriptionIdPaymentMethodsPaymentMethodId = async (args: DeleteApiBillingSubscriptionsSubscriptionIdPaymentMethodsPaymentMethodIdArgs, options: DeleteApiBillingSubscriptionsSubscriptionIdPaymentMethodsPaymentMethodIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/billing/subscriptions/${encodeURIComponent(String(args.subscription_id))}/payment-methods/${encodeURIComponent(String(args.payment_method_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 };