CodeIgniter Forums
using a paypal library but ipn validation is not working in codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: using a paypal library but ipn validation is not working in codeigniter (/thread-53375.html)



using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-21-2012

[eluser]dhananjay[/eluser]
using paypal library form here

http://www.amplio.ch/blog/web-development/paypal-integration-to-codeigniter/

the problem i am facing that its not validating ipn i have checked in logfile

this is the message

[07/16/2012 8:01 AM] - FAIL: IPN Validation Failed. IPN POST Vars from Paypal: mc_gross=2.00, protection_eligibility=Ineligible, address_status=confirmed, payer_id=JPL6YA8KDP9XU, tax=0.00, address_street=1 Main St, payment_date=06:01:05 Jul 16, 2012 PDT, payment_status=Pending, charset=windows-1252, address_zip=95131, first_name=dhananjay, mc_fee=0.38, address_country_code=US, address_name=dhananjay singh, notify_version=3.5, custom=1040, payer_status=verified, [email protected], address_country=United States, address_city=San Jose, quantity=1, verify_sign=AuX-fMg1xrQJhvjWRGDSXwAJ82uAAyxc63TOdI-Sp.-aqOD73m46FsWB, [email protected], txn_id=8NB38255AB165691V, payment_type=instant, last_name=singh, address_state=CA, [email protected], payment_fee=0.38, receiver_id=ZXFXNX7UFQTVE, pending_reason=paymentreview, txn_type=web_accept, item_name=Yearly paid membership, mc_currency=USD, item_number=, residence_country=US, test_ipn=1, handling_amount=0.00, transaction_subject=1040, payment_gross=2.00, shipping=0.00, ipn_track_id=5105e9658341, IPN Response from Paypal Server: HTTP/1.1 200 OK Date: Mon, 16 Jul 2012 13:01:11 GMT Server: Apache X-Frame-Options: SAMEORIGIN Set-Cookie: cwrClyrK4LoCV1fydGbAxiNL6iG=KQ_8n-WRpV21ve142cfDNKvEQA6NJ90ucEOHF05_qrbnLSc8ynOmDwZAXTO8FlxqSbzayxkMb3zrevSnFFbwlq4qZROyrZvO6f6x29Dony5Dh3Lfb5H0f1nxSkRD7JxGGil_rG|GNnGXKAoBJtGpTG-6lg3wp3OYY-0PoJdIp1rq-PTwF7OYIRTstev0ZpXeF_fQ9EJvIn0Bm|vG4vpKncFqJFU2ufHoMB3MbUDvkd_e77s-MQcMl4TDlZ3QZBq5E0W1tOteagTNxvm1BDsm|1342443671; domain=.paypal.com; path=/; HttpOnly Set-Cookie: cookie_check=yes; expires=Thu, 14-Jul-2022 13:01:11 GMT; domain=.paypal.com; path=/; HttpOnly Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/; HttpOnly Set-Cookie: navlns=0.0; expires=Sun, 11-Jul-2032 13:01:11 GMT; domain=.paypal.com; path=/; HttpOnly Vary: Accept-Encoding Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8

7 INVALID 0

can anyone help me please

Thanks a lot


using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-21-2012

[eluser]Rok Biderman[/eluser]
Are you by any chance doing this on a local server, not accessible from the web? IPNs fail in this case because PayPal's response can't be sent to your server.


using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-22-2012

[eluser]dhananjay[/eluser]
hi thanks for your reply i m using not local host but live hosting of hostgator and i have resolved my issue after pretty hard work , by the way thanks for ur reply.....


using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-22-2012

[eluser]Rok Biderman[/eluser]
Post here the details if you will, so other may benefit from your insight.


using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-22-2012

[eluser]dhananjay[/eluser]
i have changed one thing in his paypal library


// open the connection to paypal
$fp = fsockopen('ssl://'.$url_parsed[host],"443",$err_num,$err_str,30);
//$fp = fsockopen($url_parsed[host],"80",$err_num,$err_str,30);

the commented portion is previous one to which i have replaced with new code


second thing i was making mistake that in function i was handling i was not passing this value

if($results->type=='sandbox'){
$this->paypal_class->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url

}
else{
$this->paypal_class->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url
}


in his class he has used live ones url by defult and becuase i was not changing
$this->paypal_class->paypal_url

it was always sending validation to live one



but after making these two changes its working all fine






using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-22-2012

[eluser]dhananjay[/eluser]
i would like to ask one more question that

this i have set

$this->paypal_class->add_field('return', base_url().'user/regpaysuccess'); // return url
$this->paypal_class->add_field('cancel_return', base_url().'pages/regpaymentcancled'); // cancel url


so at success of payment it should return to first one and at cancel it should return to second one , but its not happening automatically

when i click that return to website it return to success page but i get an alert box like this page is not secure how i can avoid this alert and how it will be automatically rediretd back to my success page after payment done on paypal.....


using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-22-2012

[eluser]InsiteFX[/eluser]
This is why you setup and get yourself a PayPal Sandbox.



using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-22-2012

[eluser]dhananjay[/eluser]
i am using sanbox mode.......


using a paypal library but ipn validation is not working in codeigniter - El Forum - 07-22-2012

[eluser]Rok Biderman[/eluser]
[quote author="dhananjay" date="1342948106"]when i click that return to website it return to success page but i get an alert box like this page is not secure how i can avoid this alert and how it will be automatically rediretd back to my success page after payment done on paypal.....[/quote]

If you're using Chrome, this is a normal alert when redirected to non-ssl site. It can only be removed by installing SSL certificate. Other than that what you can do is to enable auto return, like described here.