Stripe::InvalidRequestError: Customer cus_xxx does not have a subscription with ID sub_xxx
When I log into the stripe dashboard I can see that this subscription is associated to the customer that it's trying to use. I think I see what's happening.
User creates a subscription.
Payments fail, using the default settings in stripe to retry 3 times then cancel subscription and after it is canceled the subscription is no longer "active", it's still associated with the customer on stripe but calling subscriptions.retrieve will fail because the subscription is now canceled:
I'm using the default retry failed payments strategy for Stripe subscriptions:
This might be causing the Payola::Subscriptions table to be out-of sync with the real stripe data. Is the following data I'm seeing correct?
A. Subscription is canceled by the user
Payola::Subscription state: "canceled"
Payola::Subscription stripe_status: "active"
Stripe Dashboard shows: "canceled"
B. Subscription has been canceled due to inability to collect payment
Payola::Subscription state: "canceled"
Payola::Subscription stripe_status: "past_due"
Stripe Dashboard shows: "canceled"
Are these the expected states for the above subscriptions^
In situation A it makes sense to let the user still have access to the application until the end of the billing cycle that they already paid for. In situation B, I want to block access to the application because they haven't paid for this billing cycle.
I'm seeing webhooks fail with this error.
When I log into the stripe dashboard I can see that this subscription is associated to the customer that it's trying to use. I think I see what's happening.
subscriptions.retrieve
will fail because the subscription is now canceled:I'm using the default retry failed payments strategy for Stripe subscriptions:
This might be causing the
Payola::Subscriptions
table to be out-of sync with the real stripe data. Is the following data I'm seeing correct?A. Subscription is canceled by the user
state: "canceled"
stripe_status: "active"
B. Subscription has been canceled due to inability to collect payment
state: "canceled"
stripe_status: "past_due"
Are these the expected states for the above subscriptions^
In situation A it makes sense to let the user still have access to the application until the end of the billing cycle that they already paid for. In situation B, I want to block access to the application because they haven't paid for this billing cycle.