向 PayPal 等网站提交表单数据的可接受方式是什么?
我正在建立一个使用 PayPal 处理付款的网站。
实现结账表单的最简单方法是创建一个直接提交到 paypal 的 HTML 表单,发送订单详细信息并将用户重定向到 paypal 以完成交易。
但是,此过程存在安全漏洞。客户可以编辑提交给 paypal 的信息,例如将结帐价格更改为 0.00 美元。
处理这种情况的公认方法是什么?是不是将表单提交回我的服务器,然后在 PHP 中进行一些处理,然后将验证的数据提交到 paypal 并将用户重定向到 paypal?这可能吗?
谢谢!
I'm setting up a website that uses paypal to process payments.
The easiest way to implement the checkout form would be to create an HTML form that submits directly to paypal, sending the order details and redirecting the user to paypal in order to finalize the transaction.
However, there is a security vulnerability with this process. The client could edit the information submitted to paypal, such as changing the price of the checkout to $0.00.
What is an accepted way to handle this type of situation? Is it to submit the form back to my server, then do some processing in PHP, then submit verified data to paypal and redirect the user to paypal? Is this possible?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两种主要方法可以处理这个问题。
第一个有点像您所概述的:您将填写的表格发送到 PayPal,并提供回调 URL。当PayPal处理完付款后,他们会调用您提供的url,您可以检查该调用中提供的信息是否与您提供的信息相同。为此,您需要同时存储信息,就像存储在数据库中一样。然后,您将仅在验证发生后才授予对产品的访问权限。
您还可以对发送到 PayPal 的信息进行加密,这样就几乎不可能更改表单中的信息。
有关详细信息,请参阅 https://www.x.com/developers/paypal。
There are two main ways to handle this issue.
The first is somewhat like what you outline: You send the filled in form to PayPal, and provide a callback-url. When PayPal has processed the payment, they will call your provided url, and you can check whether or not the information given in that call is the same as what you provided. For this to work, you need to store the information in the meantime, like in a database. You will then only give access to the product after the validation has happened.
You can also encrypt the information you send to PayPal, making it practically impossible to alter information in your form.
See https://www.x.com/developers/paypal for details.