I'm still learning about how Ionic works and currently using Ionic 2. After running:
npm install stripe
The stripe module was successfully added to my node_modules folder. Here is the code snippet from my payments page where I try to access Stripe:
'use strict';
declare var require: any;
var Stripe = require('stripe')('API_KEY');
When executing a function like this:
Stripe.tokens.create({
card: {
"number": '4242424242424242',
"exp_month": 12,
"exp_year": 2017,
"cvc": '123'
}
}, function(err, token) {
// asynchronously called
console.log("error: " + err);
console.log("token: " + token);
});
An error occurs:
TypeError: exec is not a function
The line causing the error in stripe.js is:
var exec = require('child_process').exec;
I'm unsure how to resolve this issue. Any suggestions or alternative methods for integrating Stripe with Ionic 2 would be greatly appreciated. Thank you!!