PayPal IPN通知接收同一付款的多个通知 [英] PayPal IPN notification receiving multiple notification for the same payment

查看:357
本文介绍了PayPal IPN通知接收同一付款的多个通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么我会收到一个付款的多个IPN通知,以及如何阻止这一点。

I would like to know why I'm receiving multiple IPN notification for one payment, and how I can stop this. I would like keep only one notification.

// STEP 2: Post IPN data back to paypal to validate

//$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
$ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));

// In wamp like environments that do not come bundled with root authority certificates,
// please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set the directory path 
// of the certificate as shown below.
// curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
if( !($res = curl_exec($ch)) ) {
    // error_log("Got " . curl_error($ch) . " when processing IPN data");
    curl_close($ch);
    exit;
}
curl_close($ch);

// STEP 3: Inspect IPN validation result and act accordingly

if (strcmp ($res, "VERIFIED") == 0) {

    // my stuff goes here

} else if (strcmp ($res, "INVALID") == 0) {
    // log for manual investigation
}


推荐答案

两个可能性在我脑海中:

Two posibilities came to my mind:


  1. 如果处理脚本返回HTTP错误,PayPal重试通知。

  2. 对于某些事务,PayPal发送多个通知。喜欢支票。或者交易日后被取消/退款/撤销。您需要检查付款状态字段。

这篇关于PayPal IPN通知接收同一付款的多个通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆