Skip to content

Commit

Permalink
πŸ› Fixed missing subscription attribution on free to paid upgrade (#21846
Browse files Browse the repository at this point in the history
)

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
  • Loading branch information
sagzy authored Dec 11, 2024
1 parent dd9d3a6 commit bd20ad3
Show file tree
Hide file tree
Showing 4 changed files with 733 additions and 73 deletions.
Loading

0 comments on commit bd20ad3

Please sign in to comment.