The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update apps/web/lib/paypal/cancel-paypal-payout.ts
Steven Tey4e50112b8863
diff --git a/apps/web/lib/paypal/cancel-paypal-payout.ts b/apps/web/lib/paypal/cancel-paypal-payout.tsindex bd55438dd9..a02af9a851 100644--- a/apps/web/lib/paypal/cancel-paypal-payout.ts+++ b/apps/web/lib/paypal/cancel-paypal-payout.ts@@ -4,15 +4,26 @@ import { paypalEnv } from "@/lib/paypal/env";export const cancelPaypalPayout = async (paypalTransferId: string) => {const paypalAccessToken = await createPaypalToken();- const response = await fetch(+ const res = await fetch(`${paypalEnv.PAYPAL_API_HOST}/v1/payments/payouts-item/${paypalTransferId}/cancel`,{method: "POST",headers: {Authorization: `Bearer ${paypalAccessToken}`,+ "Content-Type": "application/json",},},- ).then((r) => r.json());+ );++ const body = await res.json();++ if (!res.ok) {+ console.error("[PayPal] Failed to cancel payout.", body);+ throw new Error("Failed to cancel PayPal payout.");+ }++ return body;+};return response;};