I'm trying to charge a card on Stripe using the Stripe Cloud Code Module.
My code has worked previously, but suddenly I'm getting this error seemingly from within stripe.js
TypeError: Object [object Object] has no method 'isString'
at request (stripe.js:49:25)
at post (stripe.js:117:12)
at Object.module.exports.Charges.create (stripe.js:157:16)
at main.js:6:20
Here's my code (minus my key of course):
var Stripe = require('stripe');
Stripe.initialize('#################');
Parse.Cloud.define("preOrder", function(request, response) {
var tok = String(request.params.token)
Stripe.Charges.create({
amount: 100 * 40,
currency: "usd",
card: tok // the token id should be sent from the client
},{
success: function(httpResponse) {
response.success("Purchase made!");
},
error: function(httpResponse) {
response.error("Uh oh, something went wrong");
}
});
});