欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2024-01-21 11:48:10
...
这是记录的日志:
[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

回复内容:

这是记录的日志:
[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

其实IPN才是推荐使用的,因为它是异步处理的,可以避免因为网络问题带来的交易状态更新失败等状况。

你接收到invalid的Response,官方的检查方法如下:

  1. Check that your are posting your response to the correct URL, which is https://www.sandbox.paypal.com/cgi-bi... or https://www.paypal.com/cgi-bin/webscr... depending on whether you are testing in the Sandbox or you are live, respectively.
  2. Verify that your response contains exactly the same IPN variables and values in the same order, preceded with cmd=_notify-validate.
  3. Ensure that you are encoding your response string and are using the same character encoding as the original message.

突然看到你的response里面,test_ipn=1,意思就是你是用来测试paypal的,可是你的response确是从paypal.com收到的,当然Invalid了。把你的接收地址改成sandbox.paypal.com再试试吧。

IPN并不安全,建议用PDT~

您好,您的这个IPN是怎么获取到的呢?我的一直无法获取。。麻烦您能告诉下我么?很急,谢谢!!

相关标签: paypal php