#karuppasamy-events-subscriptions

1 messages ยท Page 1 of 1 (latest)

hasty vaporBOT
barren ridge
#

hi, do you have any details?

waxen slate
#

"I have configured everything here, but when I update my subscription, the webhook event does not seem to be firing. Can you please help me check if my webhook event is working or not?"

barren ridge
#

do you have an example of an event ID evt_xxx you expected to be sent that wasn't?

waxen slate
#

how to get eventid?

barren ridge
#

for example by finding it in your Stripe dashboard

#

or if you can't get that, what is the ID sub_xxx of the subscription you updated?

waxen slate
#

sub_1NYRdpLabf7E4J4F0zId8nBZ

barren ridge
#

we are sending it to you, but your server is rejecting it

waxen slate
#

may i know that error

barren ridge
#

you can see it on the page I linked

waxen slate
#

405 (Method Not Allowed)?

#

how to rectify this one?

barren ridge
#

you fix your server's code or configuration to allow a HTTP POST

#

maybe I could give you a pointer if you shared the full code of what your webhook endpoint does

waxen slate
#

i send my code

barren ridge
#

hmm the code itself seems fine, with [HttpPost("WebhookEvent")] . So maybe it's a problem with your IIS server or where your server is deployed

waxen slate
#

we are using azure server

barren ridge
#

then maybe it's something in your Azure settings

waxen slate
#

hi now corrected but still not working

#

can u please check same sub_1NYRdpLabf7E4J4F0zId8nBZ

sleek pelican
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

waxen slate
#

ok

sleek pelican
#

Could you summarise the latest question for me please?

sleek pelican
waxen slate
#

hi once update or cancel my subscription it will go to web hook event

sleek pelican
waxen slate
#

i think now working fine.. let me check once

#

ok thnaks

sleek pelican
#

Happy to help!

waxen slate
#

var options = new SessionListOptions
{
Limit = 10,
Subscription = subscriptionData.SubscriptionDetailID
};
i need get latest session id how to get

#

var options = new SessionListOptions
{
Limit = 10,
Subscription = subscriptionData.SubscriptionDetailID
};
var service = new SessionService();
StripeList<Session> sessions = service.List(options);
Session session = sessions.FirstOrDefault();

sleek pelican
#

I don't think there's a way to sort the lists.

waxen slate
#

ok but for this ID sub_1NYSyaLabf7E4J4FwLVZOJjO getting only one record

sleek pelican
#

Are you expecting to get more?

waxen slate
#

i need recent checkout session id details .i dont know how to get it

sleek pelican
#

How is it related to the Subscription?

sleek pelican
waxen slate
#

if i update the plan mean subscription id should be change right?

sleek pelican
#

No, it will stay the same

waxen slate
#

when i update plan this event will fire

#

here i need get latest session id

sleek pelican
#

How do you update your Subscription?
Maybe you're just creating a new one?

waxen slate
sleek pelican
#

Oh, you are looking for Billing Portal Sessions, not Checkout Sessions

waxen slate
#

can i get session id here?

tidal ledge
#

Hi there ๐Ÿ‘‹ jumping in as my teammate needs to step away soon. I don't believe offhand there is a good way to associate a Subscription's update with the Customer Portal Session that made that update. Can you elaborate on what you're hoping to accomplish by making that association, maybe I can help find another approach for that?

#

karuppasamy-events-subscriptions

waxen slate
#

shall i share my code

#

i am trying to update plan details in my database

#

else if (stripeEvent.Type == Events.CustomerSubscriptionUpdated || stripeEvent.Type == Events.CustomerSubscriptionDeleted)
{
var subscription = stripeEvent.Data.Object as PaymentMethod;
SubscriptionData subscriptionData = new SubscriptionData();
subscriptionData.SubscriptionDetailID = ((Newtonsoft.Json.Linq.JProperty)((Stripe.StripeEntity)stripeEvent.Data.Object).RawJObject.First).Value.ToString();
var cust = ((Stripe.Subscription)stripeEvent.Data.Object).CustomerId;
var options = new SessionListOptions
{
Limit = 10,
Customer = cust
//Subscription = subscriptionData.SubscriptionDetailID
};
var service = new SessionService();
StripeList<Session> sessions = service.List(options);
Session session = sessions.FirstOrDefault();
if (session != null)
{
subscriptionData.SessionID = session.Id;
InsertSubscription(subscriptionData);
}

            }
tidal ledge
#

Sorry, I'm still not sure I understand what you're trying to accomplish. If your goal is to capture details about the change in the Subscription and store that on your end, why do you need to associated that with a session?

Additionally, the code you showed won't work for the screenshot that you shared. The screenshot is of a Customer Portal Session, but your code is listing Checkout Sessions, those are two distinct types of objects. There is not a way to list Customer Portal Sessions.

waxen slate
#

Step 1:
After clicking on any plan in the pricing table, we open the checkout page. Once the payment is completed, we receive a session ID. We then update the plan details, including the subscription ID, session ID, start date, and end date.

Step 2
After the user signs in to our application and updates their subscription, we call the webhook event "CustomerSubscriptionUpdated." In this event, we receive the subscription ID, session ID, start date, and end date. We then update this information in our database.

tidal ledge
#

I don't think trying to associated the Subscription's update with a Customer Portal Session is relevant there. I would recommend listening for customer.subscription.updated Events and using those to populate the details that you want to track on your end.

waxen slate
#

yes i am using that event in webhook

tidal ledge
#

๐Ÿ‘

waxen slate
#

but how to get following details here subscription ID, session ID, start date, and end date

tidal ledge
#

You won't get the session ID, that isn't relevant or present when the update is made by the Customer portal. The other values are all in the structure of the Subscription object that you receive.

ID: https://stripe.com/docs/api/subscriptions/object#subscription_object-id
current_period_start: https://stripe.com/docs/api/subscriptions/object#subscription_object-current_period_start
current_period_end: https://stripe.com/docs/api/subscriptions/object#subscription_object-current_period_end

waxen slate
#

if auto renewal also fire this event customer.subscription.updated?

tidal ledge
#

Yes

waxen slate
#

ok thanks

hasty vaporBOT
tidal ledge
#

Any time!