Spec the subscription webhook that grants plan access
Your task
Your app sells monthly plans through Stripe Billing. Today a nightly script updates each account's access, so a customer who pays at 9 am waits until midnight. You want a webhook to keep every account's plan in step with Stripe, and a coding agent will build it.
Write the spec you would hand the agent.
What you know:
- Python 3.12, FastAPI, Postgres and the official
stripepackage - each Stripe customer carries
metadata.account_id, which matchesaccounts.id accountshasplan,access_untilandstripe_subscription_idcolumns, and the app grants the paid plan whileaccess_untilis in the future- a failed renewal keeps access for a 7-day grace period, then the account drops to the free plan
Then, in a few sentences: what would "update the account when a subscription webhook arrives" get wrong?