将CodeIgniter PayPal IPN处理程序迁移到Payza IPN处理程序

将CodeIgniter PayPal IPN处理程序迁移到Payza IPN处理程序,codeigniter,paypal,Codeigniter,Paypal,对于这样一个新手的要求表示歉意,但我们非常感谢您的指导。我需要将Payza(以前的AlertPay)IPN处理程序集成到以前与PayPal一起使用的类/函数结构中 我的PayPal IPN处理程序具有以下结构: class PayPalIPN { public $paypal_url; public $socket_url; public $ipn_response; public $ipn_data; function __construct() { $this->pay

对于这样一个新手的要求表示歉意,但我们非常感谢您的指导。我需要将Payza(以前的AlertPay)IPN处理程序集成到以前与PayPal一起使用的类/函数结构中

我的PayPal IPN处理程序具有以下结构:

class PayPalIPN {

public $paypal_url;
public $socket_url;
public $ipn_response;
public $ipn_data;



function __construct() {
    $this->paypal_url       = 'https://www.paypal.com/cgi-bin/webscr';
    $this->socket_url       = 'www.paypal.com';
    $this->ipn_response     = '';
}



function validate_ipn($logId = null) {

Do stuff
}
Payza(以前的AlertPay)IPN处理程序示例代码如下所示:

define("IPN_V2_HANDLER", "https://secure.payza.com/ipn2.ashx");
define("TOKEN_IDENTIFIER", "token=");

// get the token from Payza
$token = urlencode($_POST['token']);

//preappend the identifier string "token=" 
$token = TOKEN_IDENTIFIER.$token;

/**
 * 
 * Sends the URL encoded TOKEN string to the Payza's IPN handler
 * using cURL and retrieves the response.
 * 
 * variable $response holds the response string from the Payza's IPN V2.
 */

$response = '';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, IPN_V2_HANDLER);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($ch);

curl_close($ch);
我从这个开始:

class PayzaIPN {

public $IPN_V2_HANDLER;
public $TOKEN_IDENTIFIER;
public $response;
public $ipn_data;
public $token;  


//define("TOKEN_IDENTIFIER", "token=");

//define("IPN_V2_HANDLER", "https://secure.payza.com/ipn2.ashx");
//define("IPN_V2_HANDLER", "https://sandbox.Payza.com/sandbox/IPN2.ashx");

function validate_ipn($logId = null)  { 
$this->IPN_V2_HANDLER = 'https://sandbox.Payza.com/sandbox/IPN2.ashx';
$this->token = TOKEN_IDENTIFIER.$token;

我很难在正确的结构中正确声明变量-获取T_函数的预期错误和未定义的常量错误

看看我们开发中心的信息

您将在那里找到大量信息,帮助您整理任何与IPN相关的内容

以下是我相信您正在寻找的代码的直接链接:


祝你一切顺利

我无法在注释中发布代码- 以下是我迄今为止实现的代码:

class PayzaIPN {  
function validate_ipn($payzaIPN ='',$logId = null)  {

define("IPN_V2_HANDLER", "https://secure.payza.com/ipn2.ashx");
define("TOKEN_IDENTIFIER", "token=");
$_POST['token'] = ''; 

$token = urlencode($_POST['token']);

$token = TOKEN_IDENTIFIER.$payzaIPN;



$response = '';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, IPN_V2_HANDLER);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($ch);

curl_close($ch);

if(strlen($response) > 0)
当我直接从浏览器运行代码以测试令牌处理时,它会显示在日志中,并得到正确的响应: 令牌=47TXHMVGDPRMV3N5AAUIZ5CC0MRYTYXWJID81PJVNQSEHKSUKLPX3CLXZ4SFUFOL5WQEPRUPBZ5SKOMOYPUDW==& 无效令牌


但是,当我从Payza生成一个事务或重新发送一个IPN时,它没有显示在日志中,我得到一个500内部服务器错误。Tony,听起来你和Payza在一起-很高兴在这里见到你:)

是的,我有一个示例处理程序,但由于我要把它放到现有的CI应用程序中,我需要做一些调整。我在迁移方面做得更进一步了,但仍然存在一些问题。如果您能更具体地说明抛出哪个错误的原因,并且更清楚地了解您实际尝试执行的操作,我可能会更好地帮助您。