英文:
PayPal Standard Integration Testing Fine While Running Locally on Web Server, Not Over Web
问题
我对PayPal集成以及与支付系统和网关相关的任何事情都很陌生。我只是刚刚入门 - 只是为了提供一些背景。
话虽如此,我已经按照PayPal的指示很好地实施了他们的按钮。它们在公共网站上显示得很好。只是当我尝试选择其中任何一个按钮(比如Venmo)时,会弹出一个框,然后迅速消失。
如果我直接在服务器上加载相同的网页,该框会正常加载,我可以完美地完成整个沙盒交易。
我不希望我的网站访问者不得不远程桌面连接到我的Web服务器来发起付款;这会带来一些摩擦。有人知道可能是什么问题吗?我离成功很近了。
我已经考虑过一些事情了...
当我查看PayPal在其集成指南中要求我复制/粘贴的代码时,我看到了对“localhost”调用的引用,所以我猜那可能是问题的一部分。当PayPal向你提供代码并建议你只需复制/粘贴时,并没有明确说明在他们的脚本正常工作之前,我的Web服务器需要先运行Node JS(这一点根本没有明确说明,但无论如何,我明白他们认为每个人都是开发人员),以及在本地工作的安装。因此,我对IIS在Windows服务器上与Node JS一起工作的理解几乎为零。
如果你想自己体验一下故障,这里有一个链接到网站。
我复制/粘贴了PayPal的标准按钮集成代码。最终我学到了这个代码需要Node JS才能工作,所以我安装了它,并设法在本地加载浏览器时使按钮正常工作。
英文:
I'm new to PayPAl integration and really, anything to do with payment systems and gateways. I'm just getting my feet wet here - just to give perspective.
That being said, I've followed PayPal's instructions for implementing their buttons just fine. They show up great at the public facing website. It's just that, when I go to select any of the buttons (say, Venmo), there is a box that pops up, then disappears quickly.
If I load the same web page up in a browser on the server directly, the box loads fine and I am able to complete an entire sandbox transaction perfectly.
I don't want my web visitors to have to RDS in to my web server to initiate a payment; the friction on that would be kind of high. <grin> Does anyone have a lead on what might be the issue. I am so close.
I've contemplated a few things already...
When I look at the code that PayPal instructed me to copy/paste in its integration guide I see references to "localhost" calls, so I'm guessing that's part and parcel of the problem. It took me all night to figure out that my web server needed to be running Node JS first before their scripts would work (a point not made clear at all when PayPal throws code at you and suggests all you need to do is copy/paste, but whatever, I get that they figure everyone is a developer), and to get it installed to a point where everything at least worked locally. So my understanding of how that framework works with IIS on a Windows server is just about non-existent.
If you want to experience the break yourself, here is a link to the website.
I copy/pasted PayPal's integration code for their standard buttons. Eventually I learned that code needed Node JS to work, and so I installed that and managed to get the buttons working fine when loaded in a browser locally.
答案1
得分: 0
> 跨域请求被阻止:同源策略不允许读取远程资源 http://localhost:9597/orders。 (原因:CORS 请求未成功)。
理想情况下,您希望它托管在相同的域(包括 www.)和相同的标准 HTTP :80 或 HTTPS :443 端口上,然后使用相对路径,那么就不需要CORS,例如:
const response = await fetch("orders", {
method: 'POST',
});
或 fetch("/orders")
,或 fetch("/api/orders")
或类似的方式。
PayPal提供的示例Node.js只是一个示例,因为JavaScript是最广泛理解的语言。您不必使用Node.js,相同的后端功能/逻辑可以在任何语言环境中实现,例如.NET C#或其他语言,只要您为适当的语言进行重写即可。
英文:
From the console:
> Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:9597/orders. (Reason: CORS request did not succeed).
Ideally you want it to be hosted on the same domain (including www.) and same standard HTTP :80 or HTTPS :443 port as the site itself and use a relative path, then CORS will not be necessary, i.e.
const response = await fetch("orders", {
method: 'POST',
});
, or fetch("/orders")
, or fetch("/api/orders")
or similar.
The sample node.js that PayPal provides is just an example, since JavaScript is the most widely understood language. You don't have to use node, the same backend functions/logic can be implemented in any language environment, e.g. .NET C# or whatever, as long as you rewrite them for the appropriate language obviously.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论