Integrated Apple Pay with my react-native app. It works in a simulator. When running on the device, things are a bit odd.
ApplePay.canMakePayments() returns true while ApplePay.canMakePaymentsUsingNetworks() returns false. While I am using a RN module and not Apple Pay directly, it appears that the code is right:
RCT_EXPORT_METHOD(canMakePaymentsUsingNetworks: (RCTResponseSenderBlock)callback)
{
NSArray *paymentNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa];
if ([PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks:paymentNetworks]) {
callback(@[@true]);
} else {
callback(@[@false]);
}
}
If I ignore canMakePaymentsUsingNetworks
, it returns a nil controller. That part makes sense.
The phone has a valid and verified card, which has been used with Apple Pay. We are still using a test stripe key. Can that be the problem? Please advise.
Please do not edit the text until you learn English.