naoufal / react-native-payments

Accept Payments with Apple Pay and Android Pay using the Payment Request API.
https://www.npmjs.com/package/react-native-payments
1.59k stars 413 forks source link

undefined is not a constructor (evaluating 'new global.PaymentRequest(METHOD_DATA, DETAILS) #248

Open ghost opened 4 years ago

ghost commented 4 years ago

I defined PaymentRequest globally at entry point of my project.

And I wrote at Payment.js file like this. const paymentRequest = new global.PaymentRequest(METHOD_DATA, DETAILS);

But the app keeps giving this error.

TypeError: undefined is not a constructor (evaluating 'new global.PaymentRequest(METHOD_DATA, DETAILS)')

Can anyone tell me why? Thanks for reading.

nabilfreeman commented 3 years ago

Hey, does it work when you import the PaymentRequest into your components?

Sandeep155Vibhuti commented 3 years ago

try this Latest example for react-native https://github.com/freeman-industries/react-native-payments-example-ios @toplongguodev

dev224511 commented 1 year ago

I am also getting the same error. What is the solution for it as i only to integrate apple pay don't want stripe or anything else