如何从 C# 中的 Stripe 订阅对象检索产品信息?
How do you retrieve Product information from a Stripe Subscription object in c#?
我可以从 Stripe 获取一个 Subscription 对象,但我需要检索它包含的 ProductID,而且我不知道如何解析对象来获取它。 Stripe 文档对此有点混乱。我将不胜感激任何帮助。我正在使用 C#。
我在 returns 一个 Stripe.Subscription 对象的函数中使用此代码获取订阅:
var service = new SubscriptionService();
return service.Get(subscriptionID);
获得 Subscription 对象后,如何在 C# 中解析它以获取 ProductID?
感谢您的帮助!
调用您的函数后,您应该已经拥有一个包含项目数组(代表订阅项目)的订阅对象。在每个项目中,您应该在其中包含 Price 对象及其 Product Id。 Here is the Subscription object structure down to ProductId。您只需要遍历 subscription.Items
并获得 Item.Price.Product
.
我可以从 Stripe 获取一个 Subscription 对象,但我需要检索它包含的 ProductID,而且我不知道如何解析对象来获取它。 Stripe 文档对此有点混乱。我将不胜感激任何帮助。我正在使用 C#。
我在 returns 一个 Stripe.Subscription 对象的函数中使用此代码获取订阅:
var service = new SubscriptionService();
return service.Get(subscriptionID);
获得 Subscription 对象后,如何在 C# 中解析它以获取 ProductID?
感谢您的帮助!
调用您的函数后,您应该已经拥有一个包含项目数组(代表订阅项目)的订阅对象。在每个项目中,您应该在其中包含 Price 对象及其 Product Id。 Here is the Subscription object structure down to ProductId。您只需要遍历 subscription.Items
并获得 Item.Price.Product
.