fix: make Stripe subscription events monotonic
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -137,7 +137,8 @@ RETURNING used_units;
|
||||
要求:
|
||||
- **验签**:使用 `STRIPE_WEBHOOK_SECRET` 校验 `Stripe-Signature`。
|
||||
- **事件幂等**:按 `provider_event_id` 去重(落库 `webhook_events`)。
|
||||
- **乱序容忍**:以 Stripe 事件时间 + 当前 DB 状态做“只前进不回退”更新。
|
||||
- **乱序容忍**:订阅对象按 `(event.created, 事件优先级, event.id)` 保存独立水位;`deleted` 即使先到也会保留 tombstone,旧 `created/updated` 不得恢复已取消订阅。
|
||||
- **并发一致性**:`subscriptions(provider, provider_subscription_id)` 唯一,订阅业务写入与 `webhook_events=processed` 在同一事务提交。
|
||||
- **可重放**:保存原始 payload(脱敏)用于排查。
|
||||
|
||||
建议首期处理的事件(示例):
|
||||
|
||||
Reference in New Issue
Block a user