【问题标题】:How to get CustomerID from StripeEvents if ChargeSucceeded in c#如果 ChargeSucceeded 在 c# 中如何从 StripeEvents 获取 CustomerID
【发布时间】:2020-01-09 21:54:59
【问题描述】:

我想要来自 StripeEvents 的 CustomerID。我从 strip webhook 中检索 json。我已经完成了一些代码,但是因为 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;
                }

【问题讨论】:

    标签: c# asp.net stripe-payments


    【解决方案1】:

    这应该得到它:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-15
      • 1970-01-01
      • 2012-09-01
      • 2021-11-13
      • 2017-01-06
      • 2014-10-09
      • 1970-01-01
      相关资源
      最近更新 更多