在 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() 等。
任何人都可以指出我以前做过的任何示例代码,我相信这是很常见的事情。
提前致谢
一般来说,集成是
您接受用户输入的面向用户的代码
使用https://stripe.com/docs/api/promotion_codes/list#list_promotion_code-code查找相关的促销代码对象
创建用户的订阅,并在 SubscriptionCreateOptions 中使用对象之一的 ID 传递 PromotionCode(https://stripe.com/docs/billing/subscriptions/discounts/codes#applying-promotion-codes)
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
我正在尝试弄清楚如何让用户在 Stripe 中兑换折扣/促销代码。
查看文档我认为应该使用 PromotionCodeService() 检索代码,这样我就可以获得折扣金额以应用于订阅,例如
var service = new PromotionCodeService();
service.Get("promo_1HMxuf2eZvKYlo2CmGXSyhRx");
但我似乎无法访问该服务,因为我可以访问 ProductService()、CouponService() 等。 任何人都可以指出我以前做过的任何示例代码,我相信这是很常见的事情。
提前致谢
一般来说,集成是
您接受用户输入的面向用户的代码
使用https://stripe.com/docs/api/promotion_codes/list#list_promotion_code-code查找相关的促销代码对象
创建用户的订阅,并在 SubscriptionCreateOptions 中使用对象之一的 ID 传递 PromotionCode(https://stripe.com/docs/billing/subscriptions/discounts/codes#applying-promotion-codes)
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