tolu360 / cordova-plugin-paystack

This plugin allows to add Paystack Payments to your application using Paystack Native Mobile SDKs for Android & iOS
Other
34 stars 16 forks source link

Gettting [object Object] error #40

Open toptino opened 4 years ago

toptino commented 4 years ago

Hi, i am new to cordova and its development. I am having an issue with window.PaystackPlugin.chargeCard, my app is throwing the error of charge failed:[object Object]

My Code:

/ my form object / var orderObj = { myemail: email, amount: amt, firstname: fname, lastname: lname, password: password };

var posting = $.post( 'https://mysite.com/insert.php', orderObj ); posting.done(function(data) { alert(data); / check result from the attempt / payWithPaystack(data); });

function payWithPaystack(data){ ( window.PaystackPlugin.chargeCard( function(resp) { // charge successful, grab transaction reference - do your thang! console.log('charge successful: ', resp); alert("charged:" + resp); }, function(response) { // Something went wrong, oops - perhaps an invalid card. console.log('charge failed: ', resp); alert("charge failed:" + resp) }, { cardNumber: '507850785078507812', expiryMonth: '08', expiryYear: '21', cvc: '081', email: 'customer@email.yahoo', amountInKobo: 90000, }); alert(window.PaystackPlugin); }

So the alert(window.PaystackPlugin); gives [object Object] error

codeoftee commented 4 years ago

View the console logs, if you are getting [object Object] do console.log('charge failed: ', JSON.stringify(resp);