#arrayappy

1 messages · Page 1 of 1 (latest)

dusk capeBOT
urban island
#

Sounds like the default integration path. Is that unexpected? Can you share a req_xxx of you creating the Subscription?

digital crag
#

req_VkvlP56oAV67CL

urban island
#

Ok, you're using Checkout. Yep, that's how it works. We create the Subscription (and that event fires), it's status is incomplete as a payment is due. Once the payment completes, you'll get a customer.subscription.updated event and status: 'active'

digital crag
#

Ok, But we are listening to customer.subscription.created and customer.subscription.updated and we create new document in our database if there is no object exists with the stripe subscription id, we will create new document with custom id ( we are not using stripe subscription id as document id ). But customer.subscription.created and customer.subscription.updated are getting called at the same time and creating two documents in the database.

#

There is a 2 seconds delay in both webhooks, but my backend server is not able create the document for customer.subscription.created.

raven gate
#

you can't assume any order of webhook delivery, so you need to robustly handle that. For example if you get the .updated event first, call the API to retrieve the Subscription object and create your database records based on its current state. Or push events into a queue system on your side and play through that based on the creation date of the events

#

but if you're using Checkout you sohuldn't even be using those events

digital crag
#

If I proceed to create document only when event.data.object.status === "incomplete" in created webhook object, it is working fine

raven gate
raven gate
digital crag
#

We are listening to checkout.session but we are not doing anything with that webhook.

digital crag
digital crag
#

Upon customer.subscription.deletion we are updating latest

digital crag
raven gate
#

depends on the use case! for knowing when a subscription is created and you need to add that to your database and provide access to your service, just checkout.session.completed

digital crag
#

Is there any call kind of options ??

raven gate
#

no

digital crag
#

Ok

#

If i can proceed with upon checkout.session

#

How do I handle autorenewing updates

#

again customer.subscription.updated right ??

raven gate
digital crag
#

In that case for first time subscription getting created via checkout session, I can depend on checkout session

#

OKK

#

For creation should i handle customer.subscription.created or checkout.session.completed is enough ?

raven gate
#

checkout.session.completed is enough

digital crag
#

In our use case we are not maintaining invoices, so finally checkout.session.completed for creation (first time)

#

And customer.subscription.updated and customer.subscription.deleted for after the first time updates

#

Will the flow works

raven gate
#

it should!

digital crag
raven gate
#

it's a field of the invoice specifically