#NESH
1 messages · Page 1 of 1 (latest)
👋 happy to help
taking a look
since you're creating the subscription with a checkout session the payment_behavior https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_behavior defaults to allow_incomplete
when in fact what should be used is default_incomplete
but i am not creating a subscription manually, I am using stripe checkout session
how to change that behavior, but to use checkout session still ?
yes I'm aware
you can't really change the default behavior
instead what you need to do is to provision the subscription based on the async events
the issue is, that I need also to know when "pending/processing" started, since I am giving free access to user while bacs is processing
and this event you sent me, how to catch it with webhook, since I don't see it among events I received, for the checkout events only this one: checkout.session.completed
in that case once you receive checkout.session.completed you can start the free access
and if the payment failed in checkout.session.async_payment_failed you stop the provisioning
aha, I see, thanks
but just one more thing
it will work fine for the first subscription, since user will go into checkout session, and it could be async.succeeded or failed, but what after few months of using, bacs failed to process payment, these events will not catch that
this is why we recommend using invoice.paid event
instead of using the checkout or the customer.subscription events
what do you recommend exactly by invoice.paid event, I have a lot of cases to cover.
To give you more context, I'm using checkout session, for subscribing to some services with credit card or bacs, sepa, etc..., on my side, each of my services can be in the following states, where "+" means user can use service, and for "-" he cannot:
"subscribed+" (subscription active without any issues),
"notSubscribed-" (subscription deleted, cancelled, not exisiting),
"cancelled but active+" (sub cancelled, but valid until end of the current billing period),
"pending+" (while debit cards are processing),
"grace period+" (total 7 days with internal timer, for cases like when payment failed after few months of using service - so previous state had to be subscribed to go into this one)
invoice.paidevents happen each time an invoice has been successfully paid
each subscription cycle generates an invoice, and each change to the subscription generates an invoice
and when the invoice payment is successful or there's no amount to be paid on the invoice, the invoice.paid event fires
are you sure, invoice.paid would mean everything was suscessful?, but i have these other types of situations, where payment is processing, where payment failed, etc
which events would you catch for each of the states above I mentioned, for example. invoce.paid, to set my service to "subscribed" state, what for others states?
also bear in mind that, when I am creating a checkout session, i am passing metadata "service id" to the SubscriptionData field of the SessionCreateOptions, so I could have that "service id" available in the webhook. Without that I could not set the state of the particular service (since I have a list of services, independent of each other)
are you sure, invoice.paid would mean everything was suscessful?, but i have these other types of situations, where payment is processing, where payment failed, etc
invoice.paidmeans the payment succeeded
also bear in mind that, when I am creating a checkout session, i am passing metadata "service id" to the SubscriptionData field of the SessionCreateOptions, so I could have that "service id" available in the webhook. Without that I could not set the state of the particular service (since I have a list of services, independent of each other)
you can get to the subscription object from the invoice
which events would you catch for each of the states above I mentioned, for example. invoce.paid, to set my service to "subscribed" state, that's ok, what for other service's states (pending, graceperiod, cancelled until end of billing period)?