Trouble verifying paypal notify data with PHP -
Trouble verifying paypal notify data with PHP -
i'm trying check info paypal sends notify_url after transaction has been paid (in case using sandbox).
i've tried sample code paypal fsockopen couldn't work properly. tried curl manually giving certificate, didn't turn out either.
however after changes, managed find solution :
<?php $_post = array('mc_gross' => '9.90', 'protection_eligibility' => 'eligible', 'address_status' => 'confirmed', 'payer_id' => '5pk5h93be5raq', 'tax' => '0.00', 'address_street' => '1 main st', 'payment_date' => '12:13:29 jan 12, 2012 pst', 'payment_status' => 'pending', 'charset' => 'windows-1252', 'address_zip' => '95131', 'first_name' => 'test', 'address_country_code' => 'us', 'address_name' => 'test user', 'notify_version' => '3.4', 'custom' => '523368657', 'payer_status' => 'verified', 'business' => 'seller_1326059109_biz@yahoo.fr', 'address_country' => 'united states', 'address_city' => 'san jose', 'quantity' => '1', 'verify_sign' => 'agilt0jx3itxd3xaujxrvupipg93atqsm88ml-pawaoa7xgkrswxhvr8', 'payer_email' => 'buyer_1326398444_per@yahoo.fr', 'txn_id' => '1c254380jg793833d', 'payment_type' => 'instant', 'last_name' => 'user', 'address_state' => 'ca', 'receiver_email' => 'seller_1326059109_biz@yahoo.fr', 'receiver_id' => 'fkbdh7fdleceq', 'pending_reason' => 'multi_currency', 'txn_type' => 'web_accept', 'item_name' => 'compte premium winker', 'mc_currency' => 'eur', 'item_number' => '', 'residence_country' => 'us', 'test_ipn' => '1', 'handling_amount' => '0.00', 'transaction_subject' => '523368657', 'payment_gross' => '', 'shipping' => '0.00', 'ipn_track_id' => '1v3owx6mbmqe6oe6-bsmca'); $req = '?cmd=_notify-validate'; foreach ($_post $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $url = 'https://sandbox.paypal.com/cgi-bin/webscr'.$req; echo '<p><a href="'.$url.'" target="_blank">browse link</a></p>'; $content = file_get_contents($url); var_dump($content);
i result "invalid", whereas if open link on browser (with exact same informations), "verified" !
any ideas ?
thanks in advance replies
php paypal
Comments
Post a Comment