Handle Failed Payments
What happens when a customer's payment fails and how Commet retries charges automatically.
When a payment fails, Commet retries automatically while keeping the customer's access active during a grace period.
How the retry flow works
Commet uses Stripe's Smart Retries to attempt the charge multiple times over several days. During this period, the subscription moves to past_due status but the customer retains access.
If all retries fail after the grace period, the subscription is canceled automatically.
Check subscription status
const { data } = await commet.subscriptions.get('user_123')
if (data.status === 'past_due') {
// Payment failed, retries in progress
}Gate access based on status
Most apps should continue granting access during the past_due grace period to avoid disrupting customers who simply need to update a card.
const { data } = await commet.subscriptions.get('user_123')
const hasAccess = data.status === 'active'
|| data.status === 'trialing'
|| data.status === 'past_due'Prompt payment update
Customers in past_due can update their payment method through the Customer Portal.
const portal = await commet.portal.getUrl({ customerId: 'user_123' })
redirect(portal.data.portalUrl)Learn more
Related
- Invoices and Billing Cycles — Invoice types and charge timing
- Manage Subscriptions — Create and manage customer subscriptions
- Customer Portal — Self-service billing portal for customers
How is this guide?