0

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.

Gyro Technologies
  • 47
  • 1
  • 2
  • 11
  • Maybe this helps: http://stackoverflow.com/questions/32544979/parse-stripe-ios-main-js – Mo Nazemi Jan 28 '16 at 14:52
  • This actually looks like the same issue as http://stackoverflow.com/questions/35032828/parse-com-cloud-code-android-stripe and I believe it comes from Parse no longer supporting the cloud code module's they developed. – Matthew Arkin Jan 28 '16 at 18:35

0 Answers0