Welcome Guest, Not a member yet? Register   Sign In
paypal validate_ipn() returning false
#1

[eluser]anstrangelover[/eluser]
i have used paypal_lib for paypal and my code is everything works fine but
Code:
$this->paypal_lib->validate_ipn()
returns false when ever i make a payment from sandbox. what is wrong here. plz succes me


Code:
function do_paypal($id){
      
        $total=$this->cart->total();
        $tax=$total*15/100;
      
       $gtotal=$total+$tax;
        
      
        
        $task='Web Task services';
        
        $this->paypal_lib->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
        $this->paypal_lib->add_field('business', '[email protected]');
     $this->paypal_lib->add_field('return', site_url(CLIENT_PATH.'/buy_management/success_pay'));
     $this->paypal_lib->add_field('cancel_return', site_url(CLIENT_PATH.'/buy_management/paypal_cancel'));
     $this->paypal_lib->add_field('notify_url', site_url('home/ipn')); // <-- IPN url
     $this->paypal_lib->add_field('item_name', $task);
                 $this->paypal_lib->add_field('item_number', $id);
     $this->paypal_lib->add_field('amount', $gtotal);
     $this->paypal_lib->paypal_auto_form();
}
function ipn() {
          
        if($this->paypal_lib->validate_ipn()){
  
               mail('[email protected]','ipnsuccess','hello this is');
           }
           else {
              mail('[email protected]','ipnfail','hello this is');
              
            
            }
           }
            
        
    }
#2

[eluser]anstrangelover[/eluser]
nobody answer my question .. plz can you juss tell me where m i wrong wat may be the problem.. i tried oout alot but can figure out wats wrong
Code:
if($this->paypal_lib->validate_ipn()){
  
               mail('[email protected]','ipnsuccess','hello this is');
           }
           else {
              mail('[email protected]','ipnfail','hello this is');
              
            
            }
it always send me mail with ipnfail...
#3

[eluser]Samus[/eluser]
what does the paypal error log say?
#4

[eluser]anstrangelover[/eluser]
the paypal_ipn.log look like this
Code:
[04/20/2012 1:23 AM] - FAIL: IPN Validation Failed.
IPN POST Vars from Paypal:
mc_gross=575.00, protection_eligibility=Eligible, address_status=confirmed, payer_id=8863Y6RYD8U88, tax=0.00, address_street=1 Main St, payment_date=22:23:50 Apr 19, 2012 PDT, payment_status=Completed, charset=windows-1252, address_zip=95131, first_name=limbu, mc_fee=16.98, address_country_code=US, address_name=limbu subba, notify_version=3.4, custom=, payer_status=verified, [email protected], address_country=United States, address_city=San Jose, quantity=1, verify_sign=Axfl2s6B7E9YnPzUS1g5ZmtU44TUAMWq7oNY4F5J2jZ-EuWOxZ4KXK9z, [email protected], txn_id=3UV29772T1273174E, payment_type=instant, last_name=subba, address_state=CA, [email protected], payment_fee=16.98, receiver_id=J2UY28KAJMF58, txn_type=web_accept, item_name=Web Task services, mc_currency=USD, item_number=72, residence_country=US, test_ipn=1, handling_amount=0.00, transaction_subject=Web Task services, payment_gross=575.00, shipping=0.00, ipn_track_id=7d8dca168cf68,
IPN Response from Paypal Server:
HTTP/1.1 200 OK
Date: Fri, 20 Apr 2012 05:23:55 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Set-Cookie: cwrClyrK4LoCV1fydGbAxiNL6iG=CR4ou4GTj0gEsWnfepp6LHFmsXpIdelUUuBPpCBH_A0M1z1ERixmca82l9HGpXLx5w2y42yXsUThpINTJf5yh32jeCiTsLhA6LG9yjsnx684aBskkvACnkSTVV2QXj7rhYqta0|_APRqRKF7_apJw-_2zL8FrEH5_xmumNL3yyfnSTIqCQvjWsSEKrmYDLbiBghahNbFvieuG|ov9Vc3HGdzIS3natV1i9w1nTgKuc_mrburYBc7JEcYHCjAkgLawCpCTUpTbENdzRKhiqZG|1334899435; domain=.paypal.com; path=/; HttpOnly
Set-Cookie: cookie_check=yes; expires=Mon, 18-Apr-2022 05:23:55 GMT; domain=.paypal.com; path=/; HttpOnly
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/; HttpOnly
Set-Cookie: navlns=0.0; expires=Thu, 15-Apr-2032 05:23:55 GMT; domain=.paypal.com; path=/; HttpOnly
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

7
INVALID
0
#5

[eluser]Unknown[/eluser]
I have the same problem, with the same result in the log,

any suggestions? thanks
#6

[eluser]anstrangelover[/eluser]
i was doing it wrongly .. first of all i was passing the
Code:
$this->paypal_lib->add_field('notify_url', site_url('home/ipn'));
notify_url where it need validation to enter to the controller home.
secondly changed the code

Code:
$fp = fsockopen($url_parsed['host'],"80",$err_num,$err_str,30);
to
Code:
$fp = fsockopen('ssl://www.sandbox.paypal.com',443,$err_num,$err_str,30);

and
Code:
function Paypal_Lib()
{
  $this->CI =& get_instance();
  $this->CI->load->helper('url');
  $this->CI->load->helper('form');
  $this->CI->load->config('paypallib_config');
  
  $this->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

here changed the paypal_url as
Code:
$this->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';




Theme © iAndrew 2016 - Forum software by © MyBB