英文:
Connect PayPal user to custom shop system
问题
我想开发一个PHP的网页应用程序(商店插件),让网站访问者可以使用PayPal付款。我们已经使用PayPal的REST API大约2年了,并为此创建了客户端ID和密钥。
现在我想让我们的客户自己收到PayPal付款。我已经阅读了“使用PayPal登录”的文档,但仍然不明白如何从输出中提取用于通过REST API进行付款所需的数据(客户端ID和密钥)。我们希望实现的目标是让我们的客户只需连接一次应用程序到他们的PayPal帐户(这在网店系统中是通常的做法),而不必自己生成API访问。
对于如何获取实施所需数据的任何提示都将不胜感激!
英文:
I would like to develop a web application (shop plugin) in PHP where site visitors can pay for orders using PayPal. We have been using the PayPal REST-API itself for about 2 years, and have created a client ID and secret key for doing so.
Now I would like to enable our customers to receive PayPal payments themselves. I've read the documentation for the "Login with PayPal" function, but still don't understand how to extract the data needed for a payment via the REST API (client ID and secret key) from the output. What we would like to achieve is for our customers to connect the application to their PayPal account only once (as is usual with webshop systems), without having to generate the API access themselves.
Any hints on how to get the data required for implementation are greatly appreciated!
答案1
得分: 1
-
使用 PayPal 登录(可以)与合作伙伴推荐 API 一起用于第三方集成。这里是文档。在生产环境中使用需要得到 PayPal 的批准。
-
与上述讨论的第三方集成方法的替代方案是使用接收账户的客户端 ID 和密钥,也就是第一方凭证。您的客户必须拥有 PayPal 商业账户,并通过登录并在开发者控制台中创建 REST 应用程序来获取生产环境的客户端 ID 和密钥。
-
除了使用第三方凭证或第一方凭证之外,还可以仅使用您自己的凭证,并在设置支付时指定一个“收款人”来标识接收账户。请参阅Pay another account或create order API reference中的文档。
您提到了使用 PayPal REST API,这是如何进行订单创建和捕获的方法。您应该有两个后端路由来执行这些 API 操作并返回/输出 JSON 结果。对于支付人(买家)的批准,请将这两个路由与JS SDK配对。不要将用户重定向离开您的网站 - 如果这是您所说的“使用 PayPal REST-API 本身”,请停止进行该重定向,并在您的网站内添加 JS SDK 以进行批准。
英文:
-
Log in with PayPal (can be) used in conjunction with the Partner Referrals API for a third party integration. Here is the documentation. Using this in the live environment requires approval from PayPal.
-
An alternative to the third party integration method discussed above is to use the client-id and secret of the receiving account, aka first party credentials. Your customer must have a PayPal business account and obtain a live client id and secret by logging in with it and creating a REST App in the developer dashboard.
-
An alternative to using third party credentials or first party credentials is to use only your own, and specify a
payee
to identify the receiving account when setting up the payment. See the documentation at Pay another account or within the create order API reference.
You mentioned using the PayPal REST API, and that is how to do the order creation and capture. You should have two backend routes that do these API operations and return/output a JSON result. For payer (buyer) approval, pair those two routes with the JS SDK. Do not redirect away from your site -- if that is what you mean by "using the PayPal REST-API itself", stop doing that redirection and add the JS SDK for approval within your site.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论