Closed dhairyasenjaliya closed 3 years ago
Hi @dhairyasenjaliya , can you try and replicate by cloning the example project at https://github.com/freeman-industries/react-native-payments-example-ios?
It would be helpful to know if it's a configuration issue, an environment one or a bug in the code.
Please let me know how you get on and I can advise further. Feel free to post the arguments you are initializing paymentRequest with (careful not to share your Stripe/Braintree keys)
Hello @nabilfreeman im using basic details only and also let me try example so to get idea
const DETAILS = [{ id: 'basic-example', displayItems: [ { label: productName, amount: { currency: 'USD', value: this.props.orderType == '1' ? totalPrice : totalPrice, }, }, ], total: { label: 'Amount', amount: { currency: 'USD', value: this.props.orderType == '1' ? payAmount : payAmount, }, }, };]
const METHOD_DATA = [
{
supportedMethods: ['apple-pay'],
data: {
merchantIdentifier: 'test',
supportedNetworks: ['visa', 'mastercard', 'amex'],
countryCode: 'US',
currencyCode: 'USD',
},
},
];
Hello @nabilfreeman I have tried your example its not opening in real devices however its working in simulator [Error: AbortError] throwing this error while paymentRequest.show()
Not Working in device Device : iPhone 6s Os Version : 14.2
Working in simulator Simulator : iPhone 11 Pro Os Version: 14.2
possible unhandled promise rejection typeerror undefined is not an object ('ReactNativePayments.canMakePayments') check = () => { paymentRequest.canMakePayments().then((canMakePayment) => { if (canMakePayment) { Alert.alert( 'Apple Pay', 'Apple Pay is available in this device' ); } }) }
pay = () => { paymentRequest.canMakePayments().then((canMakePayment) => { if (canMakePayment) { console.log('Can Make Payment') paymentRequest.show() .then(paymentResponse => { // Your payment processing code goes here
paymentResponse.complete('success');
});
}
else {
console.log('Cant Make Payment')
}
}) }
@dineshkokare123 but im not able to open apple Pay menu and I'm getting canMakePayment === true
Hello @nabilfreeman I managed to figure out that issue was with merchantIdentifier was not correct 😆 and congratulation for the baby 🤗
@nabilfreeman I have this issue can help me to figure whats wrong happend with me thanks in advacne. possible unhandled promise rejection typeerror undefined is not an object ('ReactNativePayments.canMakePayments') check = () => { paymentRequest.canMakePayments().then((canMakePayment) => { if (canMakePayment) { Alert.alert( 'Apple Pay', 'Apple Pay is available in this device' ); } }) }
pay = () => { paymentRequest.canMakePayments().then((canMakePayment) => { if (canMakePayment) { console.log('Can Make Payment') paymentRequest.show() .then(paymentResponse => { // Your payment processing code goes here
paymentResponse.complete('success');
});
} else { console.log('Cant Make Payment') } }) }
Thanks mate!! That's really good to know. It would be better if this was easy to debug so I'll bear that in mind.
And I appreciate your congratulations 😍
Library version : "react-native-payments": "0.8.0", React Version : "react-native": "0.63.2",
when I try to open apple Pay with this method paymentRequest.show() it always throws error : [ AbortError ] also I have check for paymentRequest.canMakePayments() which returns true
Please any help would really appreciated I really need to add ApplePay in my app