【问题标题】:Stripe Module in Parse Cloud Code WoesParse Cloud Code Woes 中的 Stripe 模块
【发布时间】:2015-12-08 15:17:39
【问题描述】:

我正在尝试使用 Parse Cloud Code Stripe 模块,但一直收到 400 错误请求错误,并显示以下消息:

代码:141,消息:“TypeError: Object [object Object] has no method 'i...es.create (stripe.js:157:16)↵ at main.js:11:31

只要我不引用 Stripe,云代码就会运行。令牌应该很好,因为我刚刚创建了它,尽管即使不是,我也希望得到一个截然不同的错误消息。在把头发扯了几个小时后,我迷失了其他想法,并且非常非常感谢任何帮助:

var Stripe = require('stripe');
Stripe.initialize('sk_test_oBhEeXgs9x...'); //dots added for confidentiality

Parse.Cloud.define("pay", function(request, response) {
    Stripe.Charges.create({
        amount: 100 * 10, // $10 expressed in cents
        currency: "usd",
        card: "tok_3TnIVhEv9..." // dots added for confidentiality
    },{
        success: function(httpResponse) {
            response.success("Purchase made!");
        },
        error: function(httpResponse) {
            response.error("Uh oh, something went wrong");
        }
    });
});

我的客户端代码是:

<script>
Parse.initialize("CGqOtFjaHZIs6vG57hAWc...", "j4hDZ7N0s4jwfQIl0t...");

Parse.Cloud.run('pay', {}, {
    success: function (result) {
        console.log(result);
    },
    error: function (error) {
        console.log(error);
    }
});
</script>

【问题讨论】:

  • 应该是 stripe.Charges 而不是 Stripe.Charges 以匹配第 1 行中的变量
  • 确实如此。谢谢你把它捡起来。不幸的是,当我在这里发布代码之前清理代码时,这只是一个愚蠢的错误,“i...es.create”的问题仍然存在。
  • 我相信他们删除了 1.6.X 版本中的所有模块。

标签: javascript parse-platform stripe-payments parse-cloud-code


【解决方案1】:

我有同样的问题。我在终端的项目目录中使用:parse jssdk 1.5.0 恢复到 1.5.0。这为我解决了问题。

【讨论】:

    猜你喜欢
    • 2016-11-12
    • 2015-01-27
    • 2017-02-01
    • 2016-04-17
    • 2015-06-20
    • 2016-01-23
    • 2023-03-13
    • 2015-10-25
    • 2015-03-20
    相关资源
    最近更新 更多