本文介绍了如果在C#中成功充电,如何从StripeEvents获取CustomerID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要StripeEvents中的CustomerID.我从strip webhook中获取json.我已经完成了一些代码,但是由于customerID得到了

I want CustomerID from StripeEvents.I have json retrieve from strip webhook. I have already done some code but since customerID get

               var bodyStream = new StreamReader(HttpContext.Current.Request.InputStream);
                bodyStream.BaseStream.Seek(0, SeekOrigin.Begin);
                var json = bodyStream.ReadToEnd();

                var stripeEvent = EventUtility.ParseEvent(json);

                // Handle the event
                if (stripeEvent.Type == Events.ChargeSucceeded)
                {
                    var CustomerID = stripeEvent.Data.Object as Customer;
                }

推荐答案

这应该得到它:

Event stripeEvent = EventUtility.ParseEvent(body, false);
Dynamic obj = stripeEvent.Data.Object;
string cust = obj.CustomerId;

这篇关于如果在C#中成功充电,如何从StripeEvents获取CustomerID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 00:18