当我尝试创建客户时,我收到以下错误。我试着降级Parse。目前它运行最新的(2.2.8)版本,但我也尝试了1.4.2版本,我仍然收到以下错误。这可能是“TypeError”的原因是什么?
TypeError: Object [object Object] has no method 'isString'
at request (stripe.js 49:25) at post (stripe.js:117:12) at
Object.module.exports.Customers.create (stripe.js:239:16) at main.js:15:22
Main.js:
//STRIPE
var Stripe = require("stripe")
Stripe.initialize = ("sk_test_XXXXX");
Parse.Cloud.define("saveCustomerId", function(request, response) {
Parse.Cloud.useMasterKey();
Stripe.Customers.create({
card : request.params.token,
email: request.params.email,
description: request.params.description,
}, {
success : function(customer) {
var Usr = request.user;
var newcust = Parse.Object.extend("Customer");
var newUsr = new newcust();
newUsr.set("sCID", customer.id);
newUsr.set("parent", Usr);
var pACL = new Parse.ACL();
pACL.setPublicReadAccess(false);
pACL.setPublicWriteAccess(false);
pACL.setReadAccess(Usr, true);
pACL.setWriteAccess(Usr, true);
newUsr.set("ACL", pACL);
newUsr.save(null, {
success : function(customer) {
response.success("customer saved to parse = " + Usr.get("username"));
},
error : function(customer, error) {
response.error("Ops failed to saved customer id ");
}
});
},
error : function() {
response.error("Fejl");
}
});
});
答案 0 :(得分:6)
这看起来是一个解析API错误,如果你回滚到Parse 1.3.5就应该修复它。在终端(在mac上)或控制台上(在其他平台上)输入
解析jssdk 1.5.0
答案 1 :(得分:0)
报告并确认错误:https://developers.facebook.com/bugs/1024338347618594/
您是否设法导入条带模块?
答案 2 :(得分:0)
我通过自己创建Stripe模块来修复该错误。