在 C# MVC 中使用 Stripe api 兑换促销代码

Redeem a promotional code using Stripe api in C# MVC

我正在尝试弄清楚如何让用户在 Stripe 中兑换折扣/促销代码。

查看文档我认为应该使用 PromotionCodeService() 检索代码,这样我就可以获得折扣金额以应用于订阅,例如

var service = new PromotionCodeService();
service.Get("promo_1HMxuf2eZvKYlo2CmGXSyhRx");

但我似乎无法访问该服务,因为我可以访问 ProductService()、CouponService() 等。 任何人都可以指出我以前做过的任何示例代码,我相信这是很常见的事情。

提前致谢

一般来说,集成是

But I cannot seem to get access to that service as I can the ProductService(), CouponService() etc

这几乎可以肯定意味着您使用的是添加该服务之前的旧版本的 stripe-dotnet 库,因此升级应该可以解决该问题。 https://github.com/stripe/stripe-dotnet/blob/master/CHANGELOG.md#37290---2020-08-05