Skip to content

Commit 65776ef

Browse files
steebchenclaude
andcommitted
fix: drop chat_plan_upgrade from refundable types
The mid-cycle chat upgrade path inserts chat_plan_upgrade without a Stripe invoice or payment intent id, so a refunded upgrade charge could never be resolved back to it. Keep only the flows that persist an invoice id (chat_plan_start, chat_plan_renewal) refundable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 150d82e commit 65776ef

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/api/src/stripe.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,14 +2669,17 @@ export async function handleChargeRefunded(
26692669
return;
26702670
}
26712671

2672+
// chat_plan_upgrade is intentionally omitted: the mid-cycle upgrade path in
2673+
// routes/chat-plans.ts inserts that transaction without a stripeInvoiceId or
2674+
// stripePaymentIntentId, so a refunded upgrade charge could never be resolved
2675+
// back to it here. Add it only once that insert persists the Stripe ids.
26722676
const refundableTypes: (
26732677
| "credit_topup"
26742678
| "dev_plan_start"
26752679
| "dev_plan_renewal"
26762680
| "dev_plan_upgrade"
26772681
| "chat_plan_start"
26782682
| "chat_plan_renewal"
2679-
| "chat_plan_upgrade"
26802683
| "subscription_start"
26812684
)[] = [
26822685
"credit_topup",
@@ -2685,7 +2688,6 @@ export async function handleChargeRefunded(
26852688
"dev_plan_upgrade",
26862689
"chat_plan_start",
26872690
"chat_plan_renewal",
2688-
"chat_plan_upgrade",
26892691
"subscription_start",
26902692
];
26912693

0 commit comments

Comments
 (0)