Closed designervoid closed 3 years ago
with code in App.tsx
:
import * as React from 'react';
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
import ApplePay, { MethodData, DetailsData, TransactionIdentifier } from "react-native-apple-payment";
export default function App() {
return (
<View style={styles.container}>
<TouchableOpacity
onPress={async () => {
const method: MethodData = {
countryCode: 'UA',
currencyCode: 'UAH',
merchantIdentifier: 'merchant.com.onipko',
supportedNetworks: ['Visa', 'MasterCard', 'AmEx'],
};
const details: DetailsData = {
total: {
label: 'Shoe-shop',
amount: 10,
},
};
const payment = new ApplePay(method, details);
const canMakePayment: boolean = await payment.canMakePayments()
if (canMakePayment) {
const paymentResponse: TransactionIdentifier = await payment.initApplePay();
console.log(paymentResponse);
}
}}
>
<Text>Apple Pay</Text>
</TouchableOpacity>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});
Hi, simulator cannot send you a paymentResponse https://developer.apple.com/forums/thread/44972
About this warning, im not overrides method "init" in that library
(optional for examples) You can run "yarn bootstrap" in console, maybe problem in dependencies...
and can you say what a problem you have? Did you get PaymentResponse?
@yevheniionipko we decided to use web view in our application, but thanks for the feedback
installed the package and shows this warning: