Paypal IPN 发回已验证但前后都有数字

标签 paypal paypal-sandbox paypal-ipn

Paypal documentation says :

PayPal sends a single word back, which is either VERIFIED if the message originated with PayPal or INVALID if there is any discrepancy with what was originally sent

但是,我从 Paypal 收到以下 IPN 通知(注意:我正在使用 Sandbox 进行测试):

HTTP/1.1 200 OK
.... [removed headers for brevity]
Content-Type: text/html; charset=UTF-8

8
VERIFIED
0

VERIFIED前后的数字8和0分别是什么?我猜 8 是已验证单词的长度,但这只是一个猜测。

更新 正如 PayPal_Robert 正确指出的那样,这是因为 HTTP 分块传输编码。来自 wikipedia page :

The size of each chunk is sent right before the chunk itself so that the receiver can tell when it has finished receiving data for that chunk. The data transfer is terminated by a final chunk of length zero.

最佳答案

这是因为 chunked HTTP data和一个常规的 fsockopen() 集成,包括在响应中。

您可以应用 trim() 来修剪它并具体查看 INVALID/VERIFIED,或者从 fsockopen() 切换到 cURL(假设您使用的是 PHP ).

就我个人而言,我建议您使用合适的 HTTP 库(例如 cURL)而不是 fsockopen(),因为它现在和将来都具有更大的灵 active 。

关于 Paypal IPN 发回已验证但前后都有数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18218657/

相关文章:

php - paypal支付后添加积分系统

web-applications - 如何将控制权传递给外部 Web 应用程序并接收响应

paypal - PayPal Adaptive Payments 中的付款状态 "EXPIRED"是什么意思?

paypal - 是否可以将金额传回我的网站

ios - Paypal iOS 总是返回相同的 Paypal ID

javascript - 处理完某件商品的付款后,您能否从 paypal 收到数据/代码?

paypal - 未调用动态 notify_url

php - Paypal PHP SDK Credications and Authentication,我无法让它工作

php - Paypal IPN,缺少 POST 数据

php - 如何在 PayPal 订阅按钮上设置开始日期