【问题标题】:Can't cancel a stripe subscription through Parse API when user has more than one subscription当用户有多个订阅时,无法通过 Parse API 取消条带订阅
【发布时间】:2015-09-24 06:31:21
【问题描述】:

我正在构建允许用户注册多个订阅的网站。我们使用的 Parse.com / Stripe API 允许我为每个用户创建多个订阅。但是,如果用户拥有多个订阅,并且我尝试取消其中任何一个,我会收到一个错误,指出用户拥有多个订阅,并且我必须确定我指的是哪个订阅。问题是,我确实尝试将订阅 ID 传递给 API(见下文),但它似乎被忽略了。 Stripe 在其 API 中明确支持第二个参数,但 Parse 文档没有显示第二个“subscriptionId”参数。

以下 Parse Cloud 代码(只要用户只有一个订阅即可完美运行)

Parse.Cloud.define("cancelStripeSubscription", function(request, response) {
Stripe.Customers.cancelSubscription(request.params.customerId, request.params.subscriptionId, true, {
    success: function(httpResponse) {
        response.success("Cancellation Complete");
        },
           error: function(httpResponse) {
           response.error("Error: " + httpResponse.message);
       }
   });  
});

这里是相关的 Parse/Stripe Cloud Code API - https://parse.com/docs/js/api/symbols/Stripe.Customers.html#.cancelSubscription

这是等效的 Stripe API,清楚地显示了第二个“subscriptionId”参数。 https://stripe.com/docs/api/node#cancel_subscription

我希望 Parse/Stripe 模块确实支持多个订阅。

感谢您的帮助!

【问题讨论】:

    标签: parse-platform stripe-payments subscriptions


    【解决方案1】:

    不幸的是,Parse 的 Stripe API 库已经很老了,并且是针对 API 的旧版本构建的,当时只能订阅 1 个。您要么只需要为每个客户订阅 1 次,要么自己生成对 Stripe API 的 Web 请求,而不使用该库。

    【讨论】:

    • 谢谢马修。这就是我害怕的。衷心感谢您的帮助。
    猜你喜欢
    • 2015-07-17
    • 2012-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-07
    • 2020-03-22
    • 1970-01-01
    • 2020-08-29
    相关资源
    最近更新 更多