我想要来自 StripeEvents 的 CustomerID。我从 strip webhook 检索了 json。我已经完成了一些代码,但自从 customerID 得到
NULL
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;
}
对于 ChargeSucceeded 你会得到一个 Charge 对象,而不是 Customer,所以我会这样做:
if (stripeEvent.Type == Events.ChargeSucceeded)
{
var charge = stripeEvent.Data.Object as Charge;
var CustomerID = charge.CustomerId
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)