#Hemant-checkout-subs
1 messages · Page 1 of 1 (latest)
Do you have the Event ID (evt_xxx) for the checkout.session.completed event where you're not getting back a subscription?
But when i try to retrieve it says no subscription
i get back the subscription id , but not been able to retrieve subscriptiono with that subscription id
event id : evt_1KRiGNAEkdu20a8XF9sKANht
No such subscription: 'sub_1KRPS8AEkdu20a8X4YMqI0lf'
What event did you get sub_1KRPS8AEkdu20a8X4YMqI0lf from? Event evt_1KRiGNAEkdu20a8XF9sKANht is showing an entirely different subcription ID
my bad, yes the subscription id is different
Thanks @elder gulch let me correct it and come back to u , if i still get into some problem
Hi @elder gulch i updates the end date of subscription on event "checkout.session.completed". This is the code :
Subscription subscription = Subscription.retrieve(session.getSubscription());
subscription.setEndedAt(timeInMillis);
am i supposed to commit subscription back ? if yes, how can I do that ?
That code is just retrieve the subscription - you need to be making a request to update it (see https://stripe.com/docs/api/subscriptions/update)
Sure