PayPal IPN仅适用于模拟器而非沙箱或直播

时间:2013-09-08 20:34:38

标签: php paypal paypal-ipn jigoshop

我的脚本与ipn模拟器完美配合,但它不适用于沙箱事务。如果我将网址更改为实际网站,则无法使用。模拟器将传入的帖子打印到文件中。使用交易时,没有任何反应。我怎样才能做到这一点?

编辑:我的wordpress插件通过设置自定义notify_url值来覆盖paypal的ipn。我尝试将我需要的功能放在Payment complete Jigoshop动作中,但是$ _POST变量要么已更改,要么不存在。如果我用字符串填写这些字段,它工作正常。这就是我需要解雇的问题。

$data = array();
$data['Name'] = $_POST['address_name'];
$data['Company'] = '';
$data['Address1'] = $_POST['address_street'];
$data['Address2'] = '';
$data['City'] = $_POST['address_city'];
$data['State'] = $_POST['address_state'];
$data['Zip'] = $_POST['address_zip'];
$data['Country'] = $_POST['address_country'];
$data['Ship_Method_MSID'] = '1STCLASS';
$data['SpecialInstr'] = $_POST['memo'];
$data['Items'] = array(array('Item_ESID' => 'EVENTBAG', 'Quantity' =>    intval($_POST['quantity'])));

$json_data = json_encode($data);
$post_data = array('AccountID' => 10019, 'SecretKey' ='jsjxb', 'Method' => 'AddShipment', 'JSON' => $json_data);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'example.com');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returndata = curl_exec ($ch);
file_put_contents('test.txt', $returndata);

这就是我提出的:

$data = array();
$data['Name'] = $paypal_args['first_name'] . " " . $paypal_args['last_name'];
$data['Company'] = '';
$data['Address1'] = $paypal_args['address1'];
$data['Address2'] = $paypal_args['address2'];
$data['City'] = $paypal_args['city'];
$data['State'] = $paypal_args['state'];
$data['Zip'] = $paypal_args['zip'];
$data['Country'] = $paypal_args['country'];
$data['Ship_Method_MSID'] = '1STCLASS';
$data['SpecialInstr'] = '';
$data['Items'] = array(array('Item_ESID' => 'EVENTBAG', 'Quantity' => intval($paypal_args['quantity_1'])));

$json_data = json_encode($data);
$post_data = array('AccountID' => 10019, 'SecretKey' => 'z1', 'Method' => 'AddShipment', 'JSON' => $json_data);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'example.com');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$returndata = curl_exec ($ch);
file_put_contents('test.txt', $returndata);

来自:

if ($this->send_shipping=='yes') :
                    $paypal_args['no_shipping'] = 1;
                    $paypal_args['address_override'] = 1;
                    $paypal_args['first_name'] = $order->shipping_first_name;
        $paypal_args['last_name'] = $order->shipping_last_name;
        $paypal_args['address1'] = $order->shipping_address_1;
        $paypal_args['address2'] = $order->shipping_address_2;
        $paypal_args['city'] = $order->shipping_city;
        $paypal_args['state'] = $order->shipping_state;
        $paypal_args['zip'] = $order->shipping_postcode;
        $paypal_args['country'] = $order->shipping_country;

0 个答案:

没有答案