Fix payment history 500 error and sync subscription on Stripe link - #538
Merged
Conversation
- 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>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix payment history 500 error: The
/api/admin/members/:orgId/paymentsendpoint was using incorrect column names (event_type,amount_cents,event_timestamp) that don't exist in therevenue_eventstable. 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_idwithout syncing subscription info, causing inconsistent data between the Stripe billing page and member management page.Improved error visibility: Added
subscription_sync_errorfield to the link response for debugging failed syncs.Defensive coding: Added optional chaining for
subscription.items?.data?.[0]?.price.Test plan
🤖 Generated with Claude Code