react-native - react-native paypal 批准支付时,它只是刷新屏幕,它不会重定向到intent中指定的return_url
问题描述
我在 React Native Android 中的问题但是在批准付款时,它只是刷新屏幕,它不会重定向到意图中指定的 return_url。
我收到此错误:process3ds?originApp=weasley&resolve3ds=true&token=2P425750943574619:63 拒绝将字符串评估为 JavaScript,因为在以下内容安全策略指令中“unsafe-eval”不是允许的脚本来源:“script-src 'nonce-3Ueb1GANyt8zHg6MNBoXcls7QaEBTCLdPRwlD1pvRx1Kgvoa''自我' https://.paypal.com https://.paypalobjects.com 'unsafe-inline'"
1s9mPOHO.js:70 无法在“DOMWindow”上执行“postMessage”:提供的目标来源(“https://tpc.googlesyndication.com”)与收件人窗口的来源(“null”)不匹配
let amount = '100';
let currency = 'INR';
const dataDetail = {
intent: "CAPTURE",
purchase_units: [
{
amount: {
currency_code: currency,
value: amount
}
}
],
enableShippingAddress: false,
shippingAddressRequired:false,
redirect_urls: {
return_url: "http://www.google.com",
cancel_url: "http://www.google.com"
}
}
await axios.post('https://api.sandbox.paypal.com/v2/checkout/orders', dataDetail,
{
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer `+ token
}
}
)
.then(response => {
const { id, links } = response.data;
const approvalUrl = links.find(data => data.rel == "approve")
this.setState({
paymentId: id,
approvalUrl: approvalUrl.href,
})
})
/* Here's my WebView code*/
<WebView
source={{ uri: this.state.paypalLink }}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={false}
onNavigationStateChange={this.onNavigationStateChange}
/>
解决方案
推荐阅读
- grafana - grafana 警报在输出中显示 {},我们从哪里得到这个,无论如何都要更新它
- python - 在 django 中将 SQL 字符串转换为模型日期时间
- python-3.x - Slack Slash 命令 文本格式
- javascript - 如何访问 Vuex 动态状态属性?
- java - 使用 Spring Thymeleaf 从 Query 中填充 Select 下拉列表
- android - 如何衡量android中的布局性能?
- javascript - 如何在一定时间内向特定用户添加角色的命令?(仅限 Discord.js v12)
- ruby-on-rails - 委托类型继承
- laravel - livewire 变量得到一个我没有声明的查询结果
- javascript - 从createjs补间解析形状运动?