react-native-payments icon indicating copy to clipboard operation
react-native-payments copied to clipboard

Possible Unhandled Promise Rejection (id: 5): TypeError: null is not an object (evaluating 'ReactNativePayments.canMakePayments'

Open dineshkokare123 opened this issue 3 years ago • 11 comments

const METHOD_DATA = [{ supportedMethods: ['apple-pay'], data: { merchantIdentifier: 'merchant.com.arganpackage.arganpackage', supportedNetworks: ['visa', 'mastercard', 'amex'], countryCode: 'US', currencyCode: 'USD' } }];

const DETAILS = { id: 'basic-example', displayItems: [ { label: 'Movie Ticketre', amount: { currency: 'USD', value: '15.00' } }, { label: 'Grocery', amount: { currency: 'USD', value: '5.00' } } ], shippingOptions: [{ id: 'economy', label: 'Economy Shipping', amount: { currency: 'USD', value: '0.00' }, detail: 'Arrives in 3-5 days' // detail is specific to React Native Payments }], total: { label: 'Enappd Store', amount: { currency: 'USD', value: '20.00' } } };

dineshkokare123 avatar Nov 20 '20 09:11 dineshkokare123

Hey @dineshkokare123, this is possibly because the native library is not linked properly, or due to your babel version. Can you try 0.8.1 which I just pushed to npm? Let me know if that resolves the error. Otherwise check that you did pod install (react-native link is not necessary any more).

nabilfreeman avatar Nov 20 '20 11:11 nabilfreeman

guys I have the same problem, what to suggest. I took all the code from your library.

Odinwan avatar Nov 27 '20 13:11 Odinwan

what information do you need to help you solve this problem?

Odinwan avatar Nov 27 '20 13:11 Odinwan

@Odinwan can you share an example file of how you are trying to invoke RN Payments?

I think I would need to see the import { PaymentRequest }... line, how you are doing const request = new PaymentRequest() and doing await request.canMakePayments() to help further.

When I have some time I'll also update the iOS example project to call canMakePayments so there's a working example. That might be the weekend though, in the meantime reply here and I'll try and help.

nabilfreeman avatar Dec 01 '20 14:12 nabilfreeman

@nabilfreeman hi. i use this example, just copy pust. https://github.com/freeman-industries/react-native-payments-example-ios/blob/main/App.js

Odinwan avatar Dec 03 '20 13:12 Odinwan

@nabilfreeman By the way, the button doesn't work for me ApplePayButton i have error: 'requireNativeCompontnt: "PKPaymentButton" wos not found'

Odinwan avatar Dec 04 '20 13:12 Odinwan

I have the same Error in android 😅

MohammedAliBinTaleb avatar Dec 07 '20 11:12 MohammedAliBinTaleb

It happened when I call function show()

Possible Unhandled Promise Rejection (id: 0):

MohammedAliBinTaleb avatar Dec 07 '20 11:12 MohammedAliBinTaleb

cd ios, cd pod install <- doing it again worked for me

martin-richter-uk avatar Jan 22 '21 11:01 martin-richter-uk

What

It happened when I call function show()

Possible Unhandled Promise Rejection (id: 0):

Have you solved the issue @MohammedAliBinTaleb

ankit-1337lab avatar Apr 07 '21 13:04 ankit-1337lab

Build your project again, it will work

renishmithani avatar Sep 30 '22 05:09 renishmithani