我正在尝试将我的应用程序连接到谷歌支付,但是当我尝试它时,我遇到了某种错误!
我已经尝试放入数组,但没有奏效。
global.PaymentRequest = require('react-native-payments').PaymentRequest;
export default class App extends Component<Props> {
render() {
const METHOD_DATA = [{
supportedMethods: ['android-pay'],
data: {
supportedNetworks: ['visa', 'mastercard', 'amex'],
currencyCode: 'USD',
environment: 'TEST', // defaults to production
paymentMethodTokenizationParameters: {
tokenizationType: 'NETWORK_TOKEN',
parameters: {
publicKey: 'my public key'
}
}
}
}];
const DETAILS = {
id: 'basic-example',
displayItems: [
{
label: 'Movie Ticket',
amount: { currency: 'USD', value: '15.00' }
}
],
total: {
label: 'Merchant Name',
amount: { currency: 'USD', value: '15.00' }
}
};
const paymentRequest = new PaymentRequest(METHOD_DATA, DETAILS);
return (
<View style={styles.container}>
<TouchableOpacity onPress={()=>paymentRequest.show()}>
<Text style={styles.welcome}>pay button!</Text>
</TouchableOpacity>
</View>
);
}
}
如果我做错了什么,请通知我。
错误是Possile Unhandled Promise Rejection (id:0)