fix(billing): a returning customer's subscription reaches their team

The provider reuses a customer it already has under the same email and
leaves our team id off it, so the subscription arrived with no team,
was acknowledged, and changed nothing: a paid plan never applied. The
checkout now carries the team in its metadata, which the subscription
keeps, and the webhook reads it there when the customer has none. A
paid delivery that still matches no team is logged instead of dropped
in silence.
This commit is contained in:
Wanjohi
2026-10-13 21:37:22 +03:00
parent 4d7e5d3b4e
commit 1301ff0806
3 changed files with 52 additions and 5 deletions
+5
View File
@@ -84,6 +84,11 @@ export namespace BillingApi {
// would have them retry it for days against a thing that will
// never become actionable.
if (!delivery.teamId || !delivery.standing) {
// Said, because a paid subscription that matches no team is
// somebody paying for nothing, and a 200 alone hides it.
if (delivery.standing?.plan === 'paid') {
console.error('a paid subscription matched no team', { type: delivery.type });
}
return c.json({ data: { applied: false, type: delivery.type } });
}