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 charge-succeeded.ts

Steven Teyd7b8575035c8
diff --git a/apps/web/app/api/stripe/webhook/charge-succeeded.ts b/apps/web/app/api/stripe/webhook/charge-succeeded.ts
index 4ccf26f1bf..c2abe344cc 100644
--- a/apps/web/app/api/stripe/webhook/charge-succeeded.ts
+++ b/apps/web/app/api/stripe/webhook/charge-succeeded.ts
@@ -16,14 +16,10 @@ export async function chargeSucceeded(event: Stripe.Event) {
console.log({ chargeId, receipt_url, transfer_group });
- const invoice = await prisma.invoice.update({
+ const invoice = await prisma.invoice.findUnique({
where: {
id: transfer_group,
},
- data: {
- status: "completed",
- receiptUrl: receipt_url,
- },
include: {
payouts: {
include: {
@@ -93,4 +89,14 @@ export async function chargeSucceeded(event: Stripe.Event) {
}),
]);
}
+
+ await prisma.invoice.update({
+ where: {
+ id: invoice.id,
+ },
+ data: {
+ status: "completed",
+ receiptUrl: receipt_url,
+ },
+ });
}