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

I integrated your code in IONIC 4 mobile App but get error #31

Open gfavour opened 5 years ago

gfavour commented 5 years ago

Mr Tolu please assist me. I follow your steps on integrating paystack into ionic app. But get error..."missing command error"...

I import InAppBrowser import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';

Then I included the same in app.module.ts provider

See the real code during the ChargeCard:

cardNumber: string='';
expiryMM:any='';
expiryYY:any='';
cvc:any='';

async ChargeCardAndSubmit(form:NgForm){

this.cardNumber = "4084084084084081";
this.expiryMM = 11;
this.expiryYY = 2018;
this.cvc = "408";

    const loading = await this.loader.create({spinner: "dots",message: "Processing Charge..."});
    await loading.present();

    await this.platform.ready().then(() => {
        if (this.platform.is('cordova')) {
            (<any>window).window.PaystackPlugin.chargeCard(
              (resp)=>{
                loading.dismiss();
                console.log('charge successful: ', resp.reference);
                //this.api.postOrder(form).subscribe(res => {});
              },(resp)=>{
                loading.dismiss();
                console.log('charge failed: '+this.cardNumber+", "+this.expiryMM+", "+this.expiryYY+", "+this.cvc+", "+resp);
              },
              {
                cardNumber: this.cardNumber, 
                expiryMonth: this.expiryMM, 
                expiryYear: this.expiryYY, 
                cvc: this.cvc,
                email: 'chargeIOS@master.dev',
                amountInKobo: 150000
            });
        }else{
        this.api.ShowNotification("Payment plugins not supported on this device","danger");
        }
    });
}