Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 使用带谷歌应用程序脚本的条带而不重定向_Google Apps Script_Stripe Payments - Fatal编程技术网

Google apps script 使用带谷歌应用程序脚本的条带而不重定向

Google apps script 使用带谷歌应用程序脚本的条带而不重定向,google-apps-script,stripe-payments,Google Apps Script,Stripe Payments,我正在尝试以这样一种方式设置条带支付,它不会将用户带出GAS定制模式。当用户单击按钮以成为附加模块提供的自定义侧栏中的高级成员时,会触发模式 据我所知,应用程序脚本不允许重定向,因此下面的stripe示例不起作用,因为它取决于用户被重定向到stripe的支付门户 例如: 在某一点上,它应该将用户重定向到支付网关的条带页面 <div class="container"> <div class="row"> <h5>Free

我正在尝试以这样一种方式设置条带支付,它不会将用户带出GAS定制模式。当用户单击按钮以成为附加模块提供的自定义侧栏中的高级成员时,会触发模式

据我所知,应用程序脚本不允许重定向,因此下面的stripe示例不起作用,因为它取决于用户被重定向到stripe的支付门户

例如:

在某一点上,它应该将用户重定向到支付网关的条带页面

<div class="container">
        <div class="row">
            <h5>Free</h5>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quae vitae illum, commodi facilis labore
                dicta? Culpa corporis qui veritatis exercitationem fuga cumque, ad ex ea quod dolorem esse
                consequuntur a?</p>
        </div>
        <div class="row">
            <h5>Premium</h5>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quia voluptatem nostrum nulla doloremque
                impedit obcaecati nesciunt illum quidem sapiente nihil, tempore suscipit error nam numquam, culpa
                facilis minus, eum repudiandae!</p>
            <button id="checkout-button-plan_" target="_top" class="btn-small">1 year
                - 12€</button>
            <label for="checkout-button-plan_">30 days free, cancel any time</label>
            <div id="error-message"></div>
        </div>
    </div>
    <script>
        (function () {
            var stripe = Stripe('pk_test_');

            var checkoutButton = document.getElementById('checkout-button-plan_');
            checkoutButton.addEventListener('click', function () {
                // When the customer clicks on the button, redirect
                // them to Checkout.
                stripe.redirectToCheckout({
                        items: [{
                            plan: 'plan_GGOGMuQ5nh',
                            quantity: 1
                        }],

                        // Do not rely on the redirect to the successUrl for fulfilling
                        // purchases, customers may not always reach the success_url after
                        // a successful payment.
                        // Instead use one of the strategies described in
                        // https://stripe.com/docs/payments/checkout/fulfillment
                        successUrl: 'https://demo.org/success',
                        cancelUrl: 'https://demo.org/canceled',
                    })
                    .then(function (result) {
                        if (result.error) {
                            // If `redirectToCheckout` fails due to a browser or network
                            // error, display the localized error message to your customer.
                            var displayError = document.getElementById('error-message');
                            displayError.textContent = result.error.message;
                        }
                    });
            });
        })();
    </script>

自由的
Lorem ipsum dolor sit amet,奉献精英。照明设备、仪表和劳动设备
格言?在实际工作中,必须遵守法律规定
消费a

保险费 我的同僚们都是精英。我的心愿是:我的心愿是美好的 阻碍了对知识的理解,暂时性的错误,罪过 脸上没有,真的

一年 - 12€ 30天免费,随时取消 (功能(){ 风险条带=条带(‘pk_测试’); var checkburgatton=document.getElementById('checkout-button-plan'); CheckExutton.addEventListener('click',函数(){ //当客户单击按钮时,重定向 //让他们结账。 stripe.redirectToCheckout({ 项目:[{ 计划:“计划”GGOGMuQ5nh“, 数量:1 }], //不要依靠重定向到successUrl来实现 //购买后,客户可能不会始终在 //成功的付款。 //相反,请使用中描述的其中一种策略 // https://stripe.com/docs/payments/checkout/fulfillment 成功URL:'https://demo.org/success', 取消URL:'https://demo.org/canceled', }) .然后(函数(结果){ if(result.error){ //如果“redirectToCheckout”由于浏览器或网络而失败 //错误,向您的客户显示本地化的错误消息。 var displayError=document.getElementById('error-message'); displayError.textContent=result.error.message; } }); }); })();
现在该操作被阻止,因为模态没有重定向用户的权限

  • 在GAS中完成付款的正确方式是什么(如果Stripe还可以),在modal中完成付款
  • 如果上述内容受阻或根本不可行,您建议采取什么方法
  • 我现在倾向于在一个单独的网页上处理付款问题。不过,我不赞成将用户从电子表格中删除,如果可能的话,我希望避免这样做,同时仍然保留允许SCA监管支付的可能性

    提前感谢您的任何见解

    更新:错误消息

    v3:1不安全的JavaScript试图启动带有源代码的框架的导航'https://docs.google.com'从带有URL的框架'https://n-xdlpqop7hu3az75jfccpm6uaaujayexlmqjnkoq-1lu-script.googleusercontent.com/userCodeAppPanel'. 尝试导航顶层窗口的框架已沙盒,但未设置“允许顶部导航”或“允许通过用户激活顶部导航”的标志。
    (匿名)@v3:1
    v3:1不安全的JavaScript尝试为具有源代码“”的帧启动导航https://docs.google.com'来自URL为'https://[…]script.googleusercontent.com/userCodeAppPanel'的框架'。尝试导航顶层窗口的框架已沙盒,但未设置“允许顶部导航”或“允许通过用户激活顶部导航”的标志。
    (匿名)@v3:1
    v3:1未捕获(承诺中)DOMEException:未能在“位置”上设置“href”属性:当前窗口没有将目标帧导航到的权限https://checkout.stripe.com/pay/ppage_[...]'.
    在https://js.stripe.com/v3:1:120966
    在新的承诺下(
    升级
    
    会员资格尽管我不确定是否能正确理解您的目标,例如,如何使用Web应用程序?如果您使用Google Docs,如何使用对话框和侧边栏?如果我误解了您的目标,我道歉。当您提供有关您的目标与使用Google Apps脚本之间关系的更多信息时,它可能有助于用户思考解决方案和解决办法。感谢@Tanaike的评论和礼貌,非常感谢。对于缺乏详细说明,我深表歉意-我已更新了问题,试图使其更清楚。请让我知道这是否更有意义。感谢您迄今为止的贡献-您已经提供了帮助非常感谢!谢谢你的回复。在你的情况下,你试图在Google Docs的附加组件上使用Stripe API。我可以这样理解。在这种情况下,可以使用Javascript。但是从你的问题来看,你说现在动作被阻止了,因为模态没有重定向用户的权限。
    。在这种情况下,f或者,例如,API中的这个方法可以用于您的情况吗?例如,您也可以检查。但我不确定这是否有用。因此,如果这没有用,我道歉。如果我有错误,请纠正我
    v3:1 Unsafe JavaScript attempt to initiate navigation for frame with origin 'https://docs.google.com' from frame with URL 'https://n-xdlpqop7hu3az75jfccpm6uaaujayexlmqjnkoq-1lu-script.googleusercontent.com/userCodeAppPanel'. The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set.
    
        (anonymous) @ v3:1
        v3:1 Unsafe JavaScript attempt to initiate navigation for frame with origin 'https://docs.google.com' from frame with URL 'https://[...]script.googleusercontent.com/userCodeAppPanel'. The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set.
    
    (anonymous) @ v3:1
    v3:1 Uncaught (in promise) DOMException: Failed to set the 'href' property on 'Location': The current window does not have permission to navigate the target frame to 'https://checkout.stripe.com/pay/ppage_[...]'.
        at https://js.stripe.com/v3:1:120966
        at new Promise (<anonymous>)
        at sc (https://js.stripe.com/v3:1:120728)
        at ws (https://js.stripe.com/v3:1:137767)
        at https://js.stripe.com/v3:1:139074