【问题标题】:integrating Stripe.com and Parse.com with iOS - can't add a subscription to a customer将 Stripe.com 和 Parse.com 与 iOS 集成 - 无法向客户添加订阅
【发布时间】:2015-05-19 09:04:24
【问题描述】:

提前致谢!

我整天都在用头撞桌子,想弄清楚为什么我不能通过 Parse 向客户添加 Stripe 订阅。

这是我的字典在 Objective-C 中的样子:

NSDictionary *productInfo = @{ @"tokenId": token.tokenId,
                               @"plan": @"Test Plan",
                               @"email": currentUser.email };

我在后台调用这个 PFCloud 函数:

Parse.Cloud.define("createSubscription", function(request, response) {

var Stripe = require('stripe');

// Test
Stripe.initialize('abcdefghijklmnopqrstuvwxyz');

Stripe.Customers.create({

    card: request.params.tokenId,
    email: request.params.email,
    plan: request.params.plan

},  {

    success: function(httpResponse) {
        response.success("Success - subscription created");
    },

    error: function(httpResponse) {
        response.error("Error - subscription canceled");
    }

})

});

如 Stripe 的文档中所述,我已将“card”与“source”互换:https://stripe.com/docs/tutorials/subscriptions

我也尝试过使用计划 ID 而不是名称。有谁知道我做错了什么?

编辑:我忘了提到我收到了这个错误消息,其中一半是我写的 - [错误]:错误 - 订阅取消(代码:141,版本:1.6.3)。

【问题讨论】:

    标签: javascript ios objective-c parse-platform stripe-payments


    【解决方案1】:

    对于任何对集成 Parse 和 Stripe 感兴趣的人,这里是解决方案。我与 Stripe 客户支持的优秀人员进行了交谈,他们告诉了我两件重要的事情。

    首先,如果您使用的是最新的 Stripe API 版本 (2015-02-18),那么您将需要使用密钥“源”,但如果您使用的是旧版本,那么您将需要使用“卡”键。

    其次,请确保使用您的计划 ID 而不是密钥“计划”的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-28
      • 2020-12-26
      • 1970-01-01
      • 1970-01-01
      • 2019-10-27
      • 2020-08-30
      • 2017-02-14
      • 1970-01-01
      相关资源
      最近更新 更多