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

Google Pay paymentToken always null #294

Open GFean opened 3 years ago

GFean commented 3 years ago

I'm trying to implement google pay. Everything seems fine, the payment goes through, but the paymentToken contains this kind of object : {\"error\":{\"message\":\"Record not found\"},\"fieldErrors\":[]}

Any help please ?

ahmed3ly commented 3 years ago

hello please can you tell me if it work with you ?

Tanzeel-ur-rehman-git commented 3 years ago

I'm trying to implement google pay. Everything seems fine, the payment goes through, but the paymentToken contains this kind of object : {\"error\":{\"message\":\"Record not found\"},\"fieldErrors\":[]}

Any help please ?

Screenshot 2021-09-02 at 6 05 48 PM

can you please help me out how you open the google play payment console I am getting this error and in your case people suggest this

const ANDROID_METHOD_DATA = [
  {
    supportedMethods: ['android-pay'],
    data: {
      supportedNetworks: ['visa', 'mastercard', 'amex'],
      currencyCode: 'USD',
      environment: 'TEST', // defaults to production
      paymentMethodTokenizationParameters: {
        // tokenizationType: "GATEWAY_TOKEN",
        tokenizationType: 'NETWORK_TOKEN',
        parameters: {
          publicKey:'pk_test_51I5wapmXmOyoqYiJvT9QU00JMWuQtpg'
          // gateway: "stripe",
          // 'stripe:publishableKey':
          //   'pk_test_51SjonY7g500rYY0D6YE',

        },
      },
    },
  },
];
  sendPaymentToServer(paymentResponse) {
        window.setTimeout(function() {
            console.log('...sendPaymentToServer(paymentResponse)');
                   // const { getPaymentToken } = paymentResponse.details;
            const token =Platform.OS == 'ios' ? paymentResponse.details.paymentToken : paymentResponse.details.getPaymentToken().then(console.log);
            // let token = paymentResponse.details.getPaymentToken().then(console.log);
            console.log('TOKEN: ', token);
            console.log('Payment Detail',paymentResponse);
        }, 2000);
        paymentResponse.complete('success');
    }
dselivanovvv commented 2 years ago

I'm trying to implement google pay. Everything seems fine, the payment goes through, but the paymentToken contains this kind of object : {\"error\":{\"message\":\"Record not found\"},\"fieldErrors\":[]} Any help please ?

Screenshot 2021-09-02 at 6 05 48 PM

can you please help me out how you open the google play payment console I am getting this error and in your case people suggest this

const ANDROID_METHOD_DATA = [
  {
    supportedMethods: ['android-pay'],
    data: {
      supportedNetworks: ['visa', 'mastercard', 'amex'],
      currencyCode: 'USD',
      environment: 'TEST', // defaults to production
      paymentMethodTokenizationParameters: {
        // tokenizationType: "GATEWAY_TOKEN",
        tokenizationType: 'NETWORK_TOKEN',
        parameters: {
          publicKey:'pk_test_51I5wapmXmOyoqYiJvT9QU00JMWuQtpg'
          // gateway: "stripe",
          // 'stripe:publishableKey':
          //   'pk_test_51SjonY7g500rYY0D6YE',

        },
      },
    },
  },
];
  sendPaymentToServer(paymentResponse) {
        window.setTimeout(function() {
            console.log('...sendPaymentToServer(paymentResponse)');
                   // const { getPaymentToken } = paymentResponse.details;
            const token =Platform.OS == 'ios' ? paymentResponse.details.paymentToken : paymentResponse.details.getPaymentToken().then(console.log);
            // let token = paymentResponse.details.getPaymentToken().then(console.log);
            console.log('TOKEN: ', token);
            console.log('Payment Detail',paymentResponse);
        }, 2000);
        paymentResponse.complete('success');
    }

@Tanzeel-ur-rehman-git hey, did you solve this issue? how?