Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update confirm-payouts.ts

Kiran K00c09d100edf
diff --git a/apps/web/app/(ee)/api/cron/payouts/confirm/confirm-payouts.ts b/apps/web/app/(ee)/api/cron/payouts/confirm/confirm-payouts.ts
index cb2cb98d37..bf0a9fd5e3 100644
--- a/apps/web/app/(ee)/api/cron/payouts/confirm/confirm-payouts.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/confirm/confirm-payouts.ts
@@ -27,8 +27,6 @@ export async function confirmPayouts({
Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1),
);
- const paymentMethod = await stripe.paymentMethods.retrieve(paymentMethodId);
-
const payouts = await prisma.payout.findMany({
where: {
programId: program.id,
@@ -73,6 +71,8 @@ export async function confirmPayouts({
return;
}
+ const paymentMethod = await stripe.paymentMethods.retrieve(paymentMethodId);
+
// Create the invoice for the payouts
const newInvoice = await prisma.$transaction(async (tx) => {
const amount = payouts.reduce((total, payout) => total + payout.amount, 0);