Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could Not invoke ReactNativePayments.show Null #327

Open
Tanzeel-ur-rehman-git opened this issue Sep 1, 2021 · 2 comments
Open

Could Not invoke ReactNativePayments.show Null #327

Tanzeel-ur-rehman-git opened this issue Sep 1, 2021 · 2 comments

Comments

@Tanzeel-ur-rehman-git
Copy link

Tanzeel-ur-rehman-git commented Sep 1, 2021

Screenshot 2021-09-01 at 6 41 49 PM

Screenshot 2021-09-01 at 6 42 19 PM

in Ios payment console is working fine but in android i get error this is my code

`import React, {Component} from 'react';
import {Platform, View, Text, TouchableOpacity} from 'react-native';
import {PaymentRequest} from 'react-native-payments';

class App extends Component {
constructor(props) {
super(props);
this.state = {
};
}

showPaymentSheet = (succeed = true) => {
const paymentRequest = new PaymentRequest(METHOD_DATA, DETAILS);
paymentRequest
.show()
.then(paymentResponse => {
const card_token = paymentResponse.details.paymentToken;
// const paymentdetail = paymentResponse.details;
// const paymentresponce = paymentResponse;

    if (succeed) {
      paymentResponse.complete('success');
      console.log('Payment request completed with card token', card_token);
      // console.log('Payment detail', paymentdetail);
      // console.log('Payment request ', paymentresponce);
    } else {
      paymentResponse.complete('failure');
      console.log('Payment request failed');
    }
  })
  .catch(error => {
    if (error.message === 'AbortError') {
      console.log('Payment request was dismissed');
    }
  });

};

render() {
return (
<View style={{margin: 50}}>
<View style={{height: 44}}>

Pay Now

{/* */}


);
}
}

const APPLE_METHOD_DATA = [
{
supportedMethods: ['apple-pay'],
data: {
merchantIdentifier: 'merchant.com.your-app.namespace',
supportedNetworks: ['visa', 'mastercard', 'amex'],
countryCode: 'US',
currencyCode: 'USD',
paymentMethodTokenizationParameters: {
parameters: {
gateway: 'stripe',
'stripe:publishableKey':
'your key etc',
},
},
},
},
];

const ANDROID_METHOD_DATA = [
{
supportedMethods: ['android-pay'],
data: {
supportedNetworks: ['visa', 'mastercard', 'amex'],
currencyCode: 'USD',
environment: 'TEST', // defaults to production
paymentMethodTokenizationParameters: {
tokenizationType: 'NETWORK_TOKEN',
parameters: {
publicKey:
'you key etc,
},
},
},
},
];

const METHOD_DATA =
Platform.OS == 'ios' ? APPLE_METHOD_DATA : ANDROID_METHOD_DATA;

const DETAILS = {
id: 'basic-example',
displayItems: [
{
label: 'Movie Ticket',
amount: {currency: 'USD', value: '15.00'},
},
],
total: {
label: 'Merchant Name',
amount: {currency: 'USD', value: '15.00'},
},
};

export default App;`

i install android dependencies like give in document all good but when i click on pay now button it gives error
Screenshot 2021-09-01 at 6 39 16 PM

@dyrkow
Copy link

dyrkow commented Sep 7, 2021

Same issue on android, IOS work correctly.

@dyrkow
Copy link

dyrkow commented Sep 8, 2021

@Tanzeel-ur-rehman-git I find solution in this issue
Just downgrade to implementation com.google.android.gms:play-services-wallet:17.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants