首页 > 解决方案 > 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}
    />

标签: react-nativepaypal-sandbox

解决方案


推荐阅读