Hello everyone,
Please I will like to know if someone has successfully integrated paypal in an ionic 3 app. I keep getting ‘‘JSON error’’ in the console when I try to use the ionic-native paypal plugin.
here is my code.
sendPayment() {
PayPal.init({
PayPalEnvironmentProduction: Config.payPalEnvironmentProduction,
PayPalEnvironmentSandbox: Config.payPalEnvironmentSandbox
}).then(() => {
PayPal.prepareToRender(this.payPalEnvironment, new PayPalConfiguration({})).then(() => {
PayPal.renderSinglePaymentUI(this.payment).then((response) => {
alert(Successfully paid. Status = ${response.response.state}
);
console.log(response);
}, () => {
console.error(‘Error or render dialog closed without being successful’);
});
}, () => {
console.error(‘Error in configuration’);
});
}, () => {
console.error(‘Error in initialization, maybe PayPal isn’t supported or something else’);
});
}