对于这样的新手请求,我们深表歉意,但非常感谢您的指导。我需要将 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_function 预期错误和未定义的常量错误。