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

iOS: undefined paymentToken on real device. #104

Open pasha-iwanov opened 6 years ago

pasha-iwanov commented 6 years ago

Hi! May be I am doing something wrong, but I am really confused. I am trying to test Apple Pay on real device in release iOS build (through XCode Run), but got undefined paymentToken.

We set up ApplePay as it described in the Apple docs, got merchantId.

Here is the code:

const METHOD_DATA = [{
  supportedMethods: ['apple-pay'],
  data: {
    merchantIdentifier: MERCHANT_ID, // (not .test, real),
    supportedNetworks: ['visa', 'mastercard'],
    countryCode: 'RU',
    currencyCode: 'RUB',
  },
}];
  request ({ amount }) {
    const paymentRequest = new PaymentRequest(METHOD_DATA, {
      total: {
        label: 'Магазинчик',
        amount: {
          currency: 'RUB',
          value: String(amount),
        },
      },
    });

    return paymentRequest.show()
      .then((paymentResponse) => {
        setTimeout(() => {
          paymentResponse.complete('success');
        });

        return paymentResponse.details.paymentToken;
      })
      .catch(() => {});
  },

Everything works fine: appears ApplePay confirmation dialog, but after confirming by touchId, paymentToken is undefined. Thanks!

jangerhofer commented 6 years ago

Facing the same problem. I will devote some time to trying to trace the Swift Obj-C code in the library.

feraswfares commented 1 year ago

same issue here did you solve this problem ?