#karuppasamy-events-subscriptions
1 messages ยท Page 1 of 1 (latest)
hi, do you have any details?
"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?"
do you have an example of an event ID evt_xxx you expected to be sent that wasn't?
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?
sub_1NYRdpLabf7E4J4F0zId8nBZ
we are sending it to you, but your server is rejecting it
you can see details on https://dashboard.stripe.com/test/events/evt_1NYRl4Labf7E4J4FUrJFTX1V , at the bottom where it shows delivery attempts
may i know that error
you can see it on the page I linked
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
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
we are using azure server
then maybe it's something in your Azure settings
hi now corrected but still not working
can u please check same sub_1NYRdpLabf7E4J4F0zId8nBZ
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
ok
Could you summarise the latest question for me please?
What did you fix here exactly?
hi once update or cancel my subscription it will go to web hook event
The last event was delivered successfully: https://dashboard.stripe.com/test/events/evt_1NYSt3Labf7E4J4FcVqGSrtt
Happy to help!
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();
I don't think there's a way to sort the lists.
ok but for this ID sub_1NYSyaLabf7E4J4FwLVZOJjO getting only one record
Are you expecting to get more?
i need recent checkout session id details .i dont know how to get it
How is it related to the Subscription?
This Subscription only had 1 related Checkout Session
if i update the plan mean subscription id should be change right?
No, it will stay the same
How do you update your Subscription?
Maybe you're just creating a new one?
Oh, you are looking for Billing Portal Sessions, not Checkout Sessions
But I don't think you can filter those by Subscription: https://stripe.com/docs/api/customer_portal/configurations/list
can i get session id here?
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
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);
}
}
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.
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.
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.
yes i am using that event in webhook
๐
but how to get following details here subscription ID, session ID, start date, and end date
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
if auto renewal also fire this event customer.subscription.updated?
Yes
ok thanks
Any time!