1 parent bcec636 commit 1a69934Copy full SHA for 1a69934
1 file changed
client/app/api/webhooks/paypal/route.ts
@@ -232,7 +232,11 @@ export async function POST(request: NextRequest) {
232
await supabase
233
.from('webhook_events')
234
.update({ processed: true, processed_at: new Date().toISOString() })
235
- .eq('id', newRecord.id)
+ // 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)
240
241
return NextResponse.json({ received: true })
242
} catch (error) {
0 commit comments