I am getting this error:
Result: TypeError: Object [object Object] has no method '_each'
at request (stripe.js:58:11)
at post (stripe.js:117:12)
at Object.module.exports.Customers.create (stripe.js:239:16)
at main.js:13:22
This is my swift function call:
let userId = PFUser.currentUser()?.objectId
let userEmail = PFUser.currentUser()?.email
PFCloud.callFunctionInBackground("createCustomer", withParameters: ["email": userEmail!, "objectId": userId!])
This is my cloud code for that specific function:
var Stripe = require('stripe');
Stripe.initialize('sk_test_***************');
Parse.Cloud.define("createCustomer", function(request, response) {
Stripe.Customers.create({
email: request.params.email,
description: 'new Gyro user',
metadata: {
//name: request.params.name,
userId: request.params.objectId, // e.g PFUser object ID
createWithCard: false
}
}, {
success: function(httpResponse) {
response.success(customerId); // return customerId
},
error: function(httpResponse) {
console.log(httpResponse);
response.error("Cannot create a new customer.");
}
});
});
I'm not sure where and why I am getting this error. Any help would be appreciated.