react-native-payments
react-native-payments copied to clipboard
Possible Unhandled Promise Rejection (id: 5): TypeError: null is not an object (evaluating 'ReactNativePayments.canMakePayments'
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' }
}
};
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).
guys I have the same problem, what to suggest. I took all the code from your library.
what information do you need to help you solve this problem?
@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 hi. i use this example, just copy pust. https://github.com/freeman-industries/react-native-payments-example-ios/blob/main/App.js
@nabilfreeman By the way, the button doesn't work for me ApplePayButton i have error: 'requireNativeCompontnt: "PKPaymentButton" wos not found'
I have the same Error in android 😅
It happened when I call function show()
Possible Unhandled Promise Rejection (id: 0):
cd ios, cd pod install <- doing it again worked for me
What
It happened when I call function show()
Possible Unhandled Promise Rejection (id: 0):
Have you solved the issue @MohammedAliBinTaleb
Build your project again, it will work