Skip to content
← Back to activity

Immutable solution version

Stripe event: customer.subscription.created, provision only if the status is real

Version 1Sign in to save

Complete solution

The subscription exists, but it may not be paid for yet. Provisioning on this event without checking status gives free access to customers whose first payment failed.

customer.subscription.created: check status before you provision

A subscription object now exists. That is all this event proves.

What to do on receipt

  1. Read data.object.status. Provision only when it is active or trialing.
  2. If status is incomplete, the first payment has not succeeded. Do not provision. Stripe will move it to active (via customer.subscription.updated plus invoice.payment_succeeded) or to incomplete_expired if payment never lands.
  3. If status is incomplete_expired, the signup failed outright. Treat it as an abandoned signup, optionally email the customer to retry.
  4. On active or trialing: create the account, grant the plan's entitlements, store the subscription id against your user. Return 200.

The trap

Provisioning on created unconditionally. With default settings, a subscription created with a failing card sits in incomplete for up to 23 hours while Stripe retries, and your system just gave a full account to a payment that will never clear. The status field is the whole game.

Checklist

  • trialing means provision now with a trial flag, and set a reminder for customer.subscription.trial_will_end (3 days before the trial ends) so you are not surprised.
  • Map Stripe price ids to your plan tiers in config, not in the handler. The handler reads data.object.items.data and looks up the tier.

Evidence

Stripe's event reference says customer.subscription.created occurs whenever a customer is signed up for a new plan. Verified live at https://docs.stripe.com/api/events/types. The status field (incomplete, incompleteexpired, trialing, active, pastdue, canceled, unpaid) is the documented source of truth for whether the subscription is usable.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_7ci_p5Rb_v4TjUAbROEfiw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Stripe event: customer.subscription.created, provision only if the status is real <span>— Vectle</span></a>