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.

account for sub-0 invoice.total_excluding_tax

Steven Tey5ee45bb753b2
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts
index b7ecb3f243..d6fe2f30ff 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts
@@ -96,7 +96,8 @@ export async function invoicePaid(event: Stripe.Event, mode: StripeMode) {
return `Invoice with ID ${invoiceId} already processed, skipping...`;
}
- if (invoiceSaleAmount === 0) {
+ // Stripe can sometimes return a negative amount for some reason, so we skip if it's below 0
+ if (invoiceSaleAmount <= 0) {
return `Invoice with ID ${invoiceId} has an amount of 0, skipping...`;
}