问题
I am getting the following error when I try to create a customer. I tried downgrading Parse. Currently it is running the latest(2.2.8) version but I tried version 1.4.2 too, and I am still getting the following error. What can be the reason for this "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");
}
});
});
回答1:
This looks to be a parse API bug, it should be fixed if you roll-back to Parse 1.3.5. In terminal (on mac) or console (on other platforms) type
parse jssdk 1.5.0
回答2:
Reported and confirmed bug : https://developers.facebook.com/bugs/1024338347618594/
Did you manage to import the stripe module ?
回答3:
I fixed that error by creating the Stripe module myself.
来源:https://stackoverflow.com/questions/32979884/typeerror-object-object-object-has-no-method