2016-10-20 29 views
1

我正在使用ServiceStack.Stripe.dll在條帶中創建訂閱。此訂閱用於在我們的應用程序中創建新用戶。以下是使用VB.Net創建新訂閱的代碼。此訂閱將在用戶首次註冊我們的應用程序時創建。無法使用ServiceStack.Stripe創建多個訂閱

 Dim gateway = New StripeGateway(stripeKey) 
     If (list("CouponId").ToString() = "") Then GoTo Line1 Else GoTo Line2 

線路1中:Dim訂閱= gateway.Post(新澤西SubscribeStripeCustomer()同{_ .CustomerId = 「cus_96OuD7MM31KKR3」,_ 。計劃= 「IGmonthly」 })

 If subscription.Id = "" Then GoTo Line2 

線路2中:Dim subscription1 = gateway.Post(新澤西SubscribeStripeCustomer()同{_ .CustomerId = 「cus_96OuD7MM31KKR3」,_ 。計劃= 「IG-月刊」,_ .Coupon = 「choicefree2」 _ })

用戶在條帶中成功創建。同樣,我們的要求是,當他在我們的應用程序中購買「關於酸性的電子郵件」時,爲同一個客戶創建條帶化的另一個訂閱。爲了完成這個任務,我寫了下面的代碼。

  Dim subscription As ServiceStack.Stripe.Types.StripeSubscription 
      If list("CouponCode") <> "" Then 

       subscription = gateway.Post(New SubscribeStripeCustomer() With { _ 
          .CustomerId = "cus_96OuD7MM31KKR3K", _ 
           .Plan = "EOAMTH", _ 
           .Coupon = "testc2" 
          }) 
      Else 
       subscription = gateway.Post(New SubscribeStripeCustomer() With { _ 
          .CustomerId = "cus_96OuD7MM31KKR3K", _ 
           .Plan = "EOAMTHS" _ 
          }) 
      End If 

這裏再次訂閱成功創建,但它是結束現有的訂閱(IGMonthly)和新認購EOAMTHS創建。它正在壓倒現有訂閱。我們的要求是爲同一個客戶同時運行訂閱。如果用戶購買「電子郵件在酸性」然後與IG每月計劃他必須根據他的訂閱日期收取EOAMTH計劃。

我已經更新舊的條紋DLL,現在我使用ServiceStack.Stripe dll(Verson 4.5.0.0),但仍然沒有解決此問題。

請建議我如何滿足我的要求。

Thnaks &問候,

的Piyush

回答

2

似乎ServiceStack.Stripe使用舊/customers/cus_.../subscription端點:https://github.com/ServiceStack/Stripe/blob/5578df821acacfa56b9a18edc49dc8540a0835bc/src/Stripe/StripeGateway.cs#L242

因此,它只能管理每個客戶的單一訂閱。它需要更新以使用在API版本2014-01-31中添加的新的/customers/cus_.../subscriptions(複數)。

作爲替代,Stripe.net確實支持creating multiple subscriptions

+0

謝謝Ywain!我檢查了Stripe.net DLL –