集成项目
首先安装 `@stripe/stripe-react-native`模块,详细配置请见官网。
初始化
// initPayemntScreens.tsx
// 初始化支付
useEffect(() => {
async function initialize() {
if (payKey) {
await initStripe({
publishableKey: payKey,
merchantIdentifier: 'merchant.com.stripe.react.native',
urlScheme: 'wechat_pay',
setUrlSchemeOnAndroid: true,
})
}
}
initialize();
}, [payKey])
return (
<SafeAreaView style={styles.paymentContainer}>
<View style={styles.paymentTopContainer}>
<Text style={styles.orderPrice}>{I18n.t('total_order_price')}</Text>
<Text style={styles.orderPriceNum}>RMB¥{orderOrgData.roomTotal}</Text>
</View>