#shubhamjha

1 messages · Page 1 of 1 (latest)

terse cedarBOT
floral beacon
#

Hi! Let me help you with this.

#

Could you please share an example event ID? evt_xxx

surreal path
#

wait

#

evt_1Ml9W3SFtb35WIZNeMTsecY0

#

?

floral beacon
#

This one was sent only once

#

Do you have another example?

surreal path
#

in my case if any event occurs , if a chekout session is compelted webhook api calling twice

floral beacon
#

Are you sure it's the same event?

surreal path
#

yes

#

let me check

#

evt_1Ml9hESFtb35WIZNAqNAk2vc

#

this is the event id

terse cedarBOT
surreal path
#

?

#

?

floral beacon
surreal path
#

case 'checkout.session.completed':
session = await event.data.object
const c = await stripe.customers.retrieve(session.customer)
userId = c.metadata.Authtoken
const customerid = c.id
if (session.mode == 'payment') {
data = await getUserData(userId)
const id = _get(data, 'Item.user_subscriptionid', 0)
expiryDate = get(data, 'Item.user_current_plan_expiry', 0)
if (session.metadata.update == 'yes' || session.metadata.subid == id) {
let paylink = await session.metadata.updatelink
if (id == 'plancanceled') {
callWhenUdate({ customerid, expiryDate, paylink })
return
}
if (id.startsWith('sub_sched
')) {
await stripe.subscriptionSchedules.release(id)
callWhenUdate({ customerid, expiryDate, paylink })
} else {
const subscription = await stripe.subscriptions.retrieve(id)
await stripe.subscriptions.update(id, {
metadata: { Authtoken: userId, sub: '', s: 'cancel' },
cancel_at_period_end: true,
})
subscriptionid = id
pLink = paylink
retrievePrice = subscription
whenUpgrade({ subscriptionid, pLink, retrievePrice })
}
} else {
const a = await session.amount_total
const amount = a / 100
await addC(userId, amount)
}
} else {

    console.log('this ')
    console.log(session.metadata.newsubscription)
    await addPlan({ plan, subscriptionid, userId, expiryDate })
unkempt zenith
#

Hey! Taking over for my colleague. All event Ids you shared with use, were delivered only once by Stripe

#

What's making you telling that the event is been called twice ?