PayPal将_cart格式的空格转换为加号 [英] PayPal Convertings Spaces in _cart Form to Plus Sign
问题描述
最近(从2017年3月开始),与PayPal付款标准的_cart
表单集成已开始将所有项目信息(名称和选项)中的空格编码为加号(+
).我确认这是在Chrome中发生的,并在表单中添加了enctype
属性,这似乎为我解决了这个问题.在Chrome和Firefox中,我可以将数据发送到PayPal,并且可以正确保留空格.也许这是a幸?
Recently (starting March 2017), the _cart
form integration with PayPal payments standard has started encoding spaces in all item info (names and options) to the plus sign (+
). I verified this was happening in Chrome and added the enctype
attribute to the form, which seemed to solve the issue for me. In Chrome and Firefox, I can send data to PayPal and spaces are preserved properly. Perhaps this is a fluke?
但是,几乎所有购买的客户的信息编码都不正确,这导致IPN请求无法验证他们购买的产品.
However, almost every customer that purchases is getting their info encoded improperly, which results in the IPN request not being able to verify the products they purchased.
表格:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="name@example.com">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="item_name_1" value="Product With Spaces">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="amount_1" value="30.00">
<input type="hidden" name="on0_1" value="Name">
<input type="hidden" name="os0_1" value="First Last">
<input type="hidden" name="on1_1" value="Email">
<input type="hidden" name="os1_1" value="customer@example.com">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px; margin-top: 2px;">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
提交给PayPal时,产品显示为Product+With+Spaces
,名称显示为First+Last
.因此,贝宝(PayPal)上的交易记录和IPN请求也具有错误编码的数据.
When submitted to PayPal, the product is shown as Product+With+Spaces
and the name as First+Last
. Thus the transaction record on PayPal and the IPN request have the incorrectly encoded data also.
我尝试将空格编码为%20
或+
(通常会导致双重编码,因此我不希望它提供帮助),但是这些文字字符已显示在PayPal上.
I tried encoding the spaces as %20
or +
(which would normally result in double-encoding, so I didn't expect it to help), but those literal characters were shown on PayPal.
我已经阅读了PayPal开发人员文档,并且似乎在使用最新的字段和URL.而且,此代码已经成功运行了好多年没有麻烦.
I've read over the PayPal developer docs, and I seem to be using the most up-to-date fields and URLs. Also, this code has been running successfully for years without trouble.
推荐答案
已解决!在Paypal按钮表单中添加了enctype ="multipart/form-data"属性,将返回到ipn的变量返回到与提交状态相同的状态
Solved! added the enctype="multipart/form-data" attribute to the paypal button form, return variables to ipn come back in same state as submitted
这篇关于PayPal将_cart格式的空格转换为加号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!