Skip to content

Fix payment history 500 error and sync subscription on Stripe link - #538

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-payment-history-500
Jan 4, 2026
Merged

Fix payment history 500 error and sync subscription on Stripe link#538
bokelley merged 1 commit into
mainfrom
bokelley/fix-payment-history-500

Conversation

@bokelley

@bokelley bokelley commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix payment history 500 error: The /api/admin/members/:orgId/payments endpoint was using incorrect column names (event_type, amount_cents, event_timestamp) that don't exist in the revenue_events table. Fixed by aliasing the correct columns (revenue_type, amount_paid, paid_at) to maintain API compatibility.

  • Auto-sync subscription on Stripe link: The Stripe customer linking endpoint now automatically syncs subscription data (status, amount, interval, renewal date) after linking. Previously, linking only set stripe_customer_id without syncing subscription info, causing inconsistent data between the Stripe billing page and member management page.

  • Improved error visibility: Added subscription_sync_error field to the link response for debugging failed syncs.

  • Defensive coding: Added optional chaining for subscription.items?.data?.[0]?.price.

Test plan

  • Click "Payment History" on a member with revenue events - should no longer 500
  • Link a Stripe customer on the billing page - subscription data should immediately appear on member management page without needing a separate sync
  • Verify subscription_synced field in link response

🤖 Generated with Claude Code

- Fix payment history query using wrong column names (revenue_type → event_type alias, amount_paid → amount_cents alias, paid_at → event_timestamp alias)
- Auto-sync subscription data when linking Stripe customer to org
- Add subscription_sync_error field for debugging failed syncs
- Add defensive optional chaining for subscription.items.data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley
bokelley merged commit 7ad0088 into main Jan 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant