Note that there are some explanatory texts on larger screens.

plurals
  1. POPaypal IPN return INVALID with no data
    primarykey
    data
    text
    <p>I had this question yesterday too but for sandbox but as some person suggested me that sandbox is buggy &amp; I should test with live paypal.</p> <p>Here is the condition --</p> <p>I have a Drupal form, where I am collecting some data, I make query from that &amp; send that to paypal with the URL like --</p> <pre><code>$form_state['redirect'] = 'https://www.paypal.com/cgi-bin/webscr?' .$query; </code></pre> <p>Where result of the query variable carry --</p> <pre><code>cmd=_xclick&amp;business=ctaep.austin%40gmail.com&amp;page_style=Primary&amp;bn=PP-DonationsBF&amp;item_name=Membership¤cy_code=USD&amp;no_shipping=1&amp;tax=0&amp;lc=US&amp;rm=1&amp;return=http%3A%2F%2Fctaep-test.kr001.us%2F%3Fq%3Dpaypal%2Fpayment&amp;cancel_return=http%3A%2F%2Fctaep-test.kr001.us%2F%3Fq%3Duser%2Fregister&amp;uname=Raj_vm&amp;email=rajeevkr.dei%40gmail.com&amp;user_type=General&amp;first_name=Rajeev&amp;last_name=Kumar&amp;comp_name=&amp;address1=sector+27&amp;address2=&amp;city=noida&amp;state=ca&amp;zip=201301&amp;phone=9650361380&amp;mobile=&amp;fax=&amp;amount=0.01&amp;item_number=1 </code></pre> <p>After filling the form &amp; submit I got forwarded to paypal, I paid there and then I had to press return button(though I sent return path too with the query),</p> <p>The status is INVALID as the condition in the function which get called to handle the IPN is always falling in the INVALID condition. Here is the code--</p> <pre><code>function paypal_payment_paypal_ipn_callback(){ header("Content-type: text/html"); header("Expires: Wed, 29 Jan 1975 04:15:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); watchdog('paypal', '1'); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key =&gt; $value) { $value = urlencode(stripslashes($value)); $req .= "&amp;$key=$value"; } // post back to PayPal system to validate $header = ''; $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Host: www.paypal.com\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { watchdog('paypal', 'HTTP error'); } else { fputs ($fp, $header . $req); watchdog('paypal-fp-else-', $header . $req); dpm($_POST['uname']); dpm($_POST['user_type']); while (!feof($fp)) { watchdog('paypal', '3'); watchdog('pay_status',$res); if (strcmp ($res, "VERIFIED") == 0) { watchdog("verified"); watchdog('paypal', '4'); //Information about you: $receiver_email = $_POST['business']; //Information about the transaction: $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $user_name = $_POST['uname']; $user_email = $_POST['email']; $user_type = $_POST['user_type']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $company_name = $_POST['comp_name']; $address_address_line_1 = $_POST['address1']; $address_address_line_2 = $_POST['address2']; $address_city = $_POST['city']; $address_state = $_POST['state']; $address_zip = $_POST['zip']; $user_phone = $_POST['phone']; $user_mobile = $_POST['mobile']; $user_fax = $_POST['fax']; // process payment $password = user_password(8); $fields = array( 'name' =&gt; $user_name, 'mail' =&gt; $user_email, 'pass' =&gt; $password, 'status' =&gt; 1, 'init' =&gt; $user_email, 'roles' =&gt; array( DRUPAL_AUTHENTICATED_RID =&gt; $user_type,), 'field_first_name' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $first_name))), 'field_last_name' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $last_name))), 'field_company_name' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $company_name))), 'field_address_line_1' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $address_address_line_1))), 'field_address_line_2' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $address_address_line_2))), 'field_user_city' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $address_city))), 'field_user_state' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $address_state))), 'field_user_zip' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $address_zip))), 'field_phone_number_' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $user_phone))), 'field_mobile_number_' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $user_mobile))), 'field_fax_number_' =&gt; array( LANGUAGE_NONE =&gt; array( array('value' =&gt; $user_fax))), ); $account = user_save('', $fields); watchdog("user registered"); } elseif (stripos($res, "INVALID") == 0) { watchdog('Res value--', stripos($res, "INVALID")); watchdog('paypal', 'INVALID'); } else{ watchdog("Not Verified nor Invalid"); } } fclose ($fp); } return 'Transaction Complete'; } </code></pre> <p>I believed, even if status is INVALID I should get the data which I sent in there in return but, when I tried to fetch it by <code>**$_POST**</code>(as you can see it before the while loop in else part), I am getting error "Undefined Index".</p> <p>EDIT---</p> <p>I tried dumping the $_POST variable &amp; it's just returning me return path in array which is of 14 character.</p> <p>I don't know what to do..</p> <p>Can I get any help from anybody about this ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload