ArunYogi / paytm-cordova-plugin

DEPRECATED Cordova plugin for Paytm application
6 stars 13 forks source link

Reference Error: can't find variable: paytm #8

Closed msuhaibk closed 6 years ago

msuhaibk commented 6 years ago

I am using ionic 3.9.2 and trying to integrate paytm payment gateway in my ionic app. There are no plugins available with proper integration guidelines and it seems like the road less travelled.

I followed your guidelines and have basic understanding of plugins.

but it showed error "paytm is undefined". After little research i wrapped my startPayment function in platform.ready then it showed "Error: Uncaught (in promise): ReferenceError: paytm is not defined"

Thanks in Advance.

ArunYogi commented 6 years ago

Paytm plugin is available as global variable. Add below lines as part of import in the .ts where you are triggering paytm.startPayment(...)

declare var paytm: any;

In application using ionic version <3, you can mention the same line in declaration.ts, then you can refer "paytm" anywhere in the application.

YaMo97 commented 6 years ago

For Ionic, try using this: -

(<any>window).paytm.startPayment(options, successCallback, failureCallback);

ArunYogi commented 6 years ago

@YaMo97 , there are two application currently in production using this plugin which are running without any issues.. Try removing the platform and add it again. Sometime the plugin is not installed properly might be causing this issue

ArunYogi commented 6 years ago

Closing this question issue, as @YaMo97 , has posted successful Paytm PG launch in this issue

gsabishek commented 5 years ago

still i am lagging on this issue...help me to sort out this issue.. "paytm is not defined"