【发布时间】:2016-05-04 03:17:11
【问题描述】:
添加条带作为自定义js模块解析后的我的Parse云功能是-
main.js
Parse.Cloud.define("createCustomer", function(request, response) {
// var Stripe = require("stripe");
var Stripe = require("cloud/stripe.js")(kStripePrivateKey);
// Stripe.initialize(kStripePrivateKey);
Stripe.Customers.create(
{
description : request.params.description
},
{
success: function(httpResponse)
{
console.log(httpResponse);
response.success(httpResponse);
},
error: function(httpResponse)
{
console.log(httpResponse.message);
response.error(httpResponse.message);
}
}
);
});
我试图将此函数称为:
**
mCustomerUserName = ParseUser.getCurrentUser().getUsername();
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("description",mCustomerUserName);
ParseCloud.callFunctionInBackground("createCustomer", params, new FunctionCallback<Object>() {
@Override
public void done(Object object, ParseException e) {
if (e == null) {
Log.e("SUCCESS CREATE CUSTOMER", "" + object.toString());
} else {
e.printStackTrace();
Log.e("", "" + e.getCode() + "/" + e.getMessage());
}
}
});
**
现在我的错误是:
结果:TypeError:无法在 main.js:218:37 调用未定义的方法“创建”
请帮帮我。
【问题讨论】:
-
需要注意的一点是 Parse 不再支持他们的 Stripe 库。我建议使用基于最新版本的 Stripe Node.js 模块的github.com/matthewarkin/stripe-parse
-
有什么办法可以在解析云上使用stripe的旧版本?
-
旧版本不是 Stripe 的,它是 4 年前通过 parse 构建的。他们从中删除了支持和文档,这使得调试有点困难。有人说降级他们的云代码版本已经解决了问题。
-
@MatthewArkin 我使用了您的 gitHub 链接并将“stripe.js”文件导入我的云文件夹。我改变了行 var Stripe = require("stripe");到 var Stripe = require("cloud/stripe.js")(kStripePrivateKey);并评论了这两行 var Stripe = require("stripe");和 Stripe.initialize(kStripePrivateKey);现在我得到错误结果:TypeError: Cannot call method 'create' of undefined at main.js:218:37
-
@MatthewArkin 在这里我不确定我是否应该评论行“Stripe.initialize(kStripePrivateKey);”
标签: javascript android parse-platform stripe-payments