javascript - Parse.com + Cloud code + Android + Stripe -


my parse cloud function after adding stripe custom js module parse is-

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);                                            }                                            }                                            );                    }); 

and trying call function as:

**

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());                 }             }         }); 

**

and error is:

result: typeerror: cannot call method 'create' of undefined @ main.js:218:37

please me out here.

since you're using stripe library based on stripe-node instead of parse version, code function call looks bit different resemble node callback style

stripe.customers.create({   description: request.params.description, }, function(err, customer) {   if(err){     console.log(err);     response.error(err);   }   else{     console.log(customer);     response.success(customer);   } }); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -