PHP-PHP paypal ipn 返回 INVALID,但是 payment_status=Completed,这是为什么呢?

PHP-PHP paypal ipn 返回 INVALID,但是 payment_status=Completed,这是为什么呢?

夜无邪 发布于 2017-09-25 字数 2359 浏览 1081 回复 2

****这个是日志记录****

[08/22/2012 9:53 PM] - FAIL: IPN Validation Failed.
IPN POST Vars from Paypal:
mc_gross=1.00, protection_eligibility=Eligible, address_status=confirmed, payer_id=N9MJ3E2F72RSA, tax=0.00, address_street=1 Main St, payment_date=21:53:35 Aug 22, 2012 PDT, payment_status=Completed, charset=windows-1252, address_zip=95131, first_name=buyer, mc_fee=0.33, address_country_code=US, address_name=buyer buyer, notify_version=3.6, custom=3ba049446d1a922fccf9233c32794f16, payer_status=verified, business=775357_1345694569_biz@qq.com, address_country=United States, address_city=San Jose, quantity=1, verify_sign=ALJkApMs7H6RB6yOv.fdCxcGTa-tANEn6Te6SHeQgyIYAwZVU3TIrY0A, payer_email=775357_1345694424_per@qq.com, txn_id=60Y885950A771745Y, payment_type=instant, last_name=buyer, address_state=CA, receiver_email=775357_1345694569_biz@qq.com, payment_fee=0.33, receiver_id=BPFVTFG92JFY4, txn_type=web_accept, item_name=xxx,
mc_currency=USD, item_number=, residence_country=US, test_ipn=1, handling_amount=0.00, transaction_subject=3ba049446d1a922fccf9233c32794f16, payment_gross=1.00, shipping=0.00, ipn_track_id=f9305268979,

IPN Response from Paypal Server:
HTTP/1.1 200 OK
Date: Thu, 23 Aug 2012 04:53:40 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Set-Cookie: c9MWDuvPtT9GIMyPc3jwol1VSlO=H9KuMTssqUu_tJf3Dam9rchmDS6GUQFouM5-KC3TtpHU199YtckVmNrqgSLfY9uIOFULbrXej6jtUILOdz4ImR-ruvjgSDh7RWeuAzPIVo40F7nN8Jxn1xVY2n-Ak8kFLmkUEm%7cSrCbIFQ6eG7qVUKiU5gXgRuZnXVRhIVr3AsqzO7z4At6yvgs588DjotxRox8tl_hJ4qi30%7cptKiyBJFIzge516dKd0-8zfnmTwVxF8Viz_QKeMZPIZPZ5Iu9OcdYiQyE8g861Be04KEt0%7c1345697620; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: cookie_check=yes; expires=Sun, 21-Aug-2022 04:53:40 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navlns=0.0; expires=Wed, 18-Aug-2032 04:53:40 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: Apache=10.72.109.11.1345697620182214; path=/; expires=Sat, 16-Aug-42 04:53:40 GMT
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

7
INVALID
0

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

偏爱自由 2017-10-18 2 楼

昨天刚解决了一个你遇到的这个问题,其实解决方法很简单,只是错误不易察觉。
收到payment_status=Completed,说明交易已经正确完成,之所以返回INVALID,是因为字符集编码不统一,导致你的数据提交至paypal服务器后,它无法识别。
你的编码为Content-Type: text/html; charset=UTF-8,而paypal服务器的编码为
charset=windows-1252
解决方法就是统一编码。在paypal form构造的时候添加参数 "charset":"utf-8"。

甜柠檬 2017-10-12 1 楼

上面的payment_status=Completed是客户端发送的数据,而不是服务端返回的数据。