Skip to content

Commit 1a69934

Browse files
fix: scope PayPal webhook processed update
1 parent bcec636 commit 1a69934

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

client/app/api/webhooks/paypal/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ export async function POST(request: NextRequest) {
232232
await supabase
233233
.from('webhook_events')
234234
.update({ processed: true, processed_at: new Date().toISOString() })
235-
.eq('id', newRecord.id)
235+
// Keep the state transition in the same provider/event namespace as
236+
// the idempotency check. This prevents an identical event ID from a
237+
// different provider ever being updated by this handler.
238+
.eq('provider', 'paypal')
239+
.eq('event_id', event.id)
236240

237241
return NextResponse.json({ received: true })
238242
} catch (error) {

0 commit comments

Comments
 (0)