Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fixed missing subscription attribution on free to paid upgrade #21846

Merged
merged 6 commits into from
Dec 11, 2024

Conversation

sagzy
Copy link
Contributor

@sagzy sagzy commented Dec 10, 2024

closes https://linear.app/ghost/issue/ENG-1561

  • problem: when a free member upgraded to paid, we sometimes did not capture the subscription attribution data
  • cause:
    • after checkout, Stripe sends customer.subscription.created, customer.subscription.updated and checkout.session.completed webhook events
    • we want to create a subscription in our database based on the checkout.session.completed event, as it contains additional data (e.g. subscription attribution data)
    • but, we were sometimes creating a subscription based on a customer.subscription.* event during free → paid upgrades, which did not contain subscription attribution data
  • solution: we now ignore customer.subscription.* events until a member and its related subscription have been created in the database first, by the checkout.session.completed event

@sagzy sagzy force-pushed the fix/missing-attribution-on-upgrade branch from 5a44b36 to b946b05 Compare December 10, 2024 11:50
@sagzy sagzy enabled auto-merge (squash) December 11, 2024 02:36
@sagzy sagzy merged commit bd20ad3 into main Dec 11, 2024
21 checks passed
@sagzy sagzy deleted the fix/missing-attribution-on-upgrade branch December 11, 2024 02:49
allouis added a commit that referenced this pull request Feb 4, 2025
cmraible added a commit to cmraible/Ghost that referenced this pull request Feb 13, 2025
9larsons added a commit that referenced this pull request Feb 13, 2025
9larsons added a commit that referenced this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant