www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25

Thread: PayPal IPN Response Blank

  1. #16
    Join Date
    Dec 2005
    Posts
    2,984
    It's happening in paypal_ipn.php, like I said. Post the current code from paypal_ipn.php and I can point it out to you.

    You have to have test mode enabled in 2 different places - during your initial checkout (which works because you said you are going to the sandbox site to checkout) AND ALSO in the script where you are asking PayPal to validate your IPN - this is paypal_ipn.php where test mode is not enabled, currently.

  2. #17
    Join Date
    Apr 2005
    Posts
    92
    PHP Code:
    <?php

    // include header
    include("../../header.php");

    // include the paypal library
    include_once("Paypal.php");

    // create an instance of the paypal library
    $p = new Paypal();

    if(
    $config['paypal_test'] == 'true'){ $p->enableTestMode(); } 

    // check validity and write down it
    if($p->validateIpn())
    {
        if(
    $p->ipnData['payment_status'] == 'Completed')
        {
            
    // get package id and user id from custom var
            
    list($user_id$package_id) = explode("_"$p->ipnData['custom']);
            
            
    // get package details
            
    $package mysql_fetch_assoc(mysql_query("SELECT * FROM packages WHERE package_id = '".$package_id."' LIMIT 1"));
            
            
    // update users fields
            
    mysql_query("UPDATE members SET premium = '1', premium_active = '1', premium_start = '".time()."', premium_end = '".strtotime("+" $package['package_length'] . "days")."' WHERE user_id = '".$user_id."'");
            
            
    // update sales log
            
    mysql_query("INSERT INTO sales_log (payer_id,
                                                payment_date,
                                                trans_id,
                                                first_name,
                                                last_name,
                                                payer_email,
                                                payer_status,
                                                payment_type,
                                                memo,
                                                item_name,
                                                item_number,
                                                quantity,
                                                mc_gross,
                                                mc_currency,
                                                address_name,
                                                address_street,
                                                address_city,
                                                address_state,
                                                address_zip,
                                                address_country,
                                                address_status,
                                                payer_business_name,
                                                payment_status,
                                                pending_reason,
                                                reason_code,
                                                txn_type
                                                )VALUES(
                                                '"
    .$p->ipnData['payer_id']."', 
                                                '"
    .$p->ipnData['payment_date']."', 
                                                '"
    .$p->ipnData['txn_id']."', 
                                                '"
    .$p->ipnData['first_name']."', 
                                                '"
    .$p->ipnData['last_name']."', 
                                                '"
    .$p->ipnData['payer_email']."', 
                                                '"
    .$p->ipnData['payer_status']."', 
                                                '"
    .$p->ipnData['payment_type']."', 
                                                '"
    .$p->ipnData['memo']."', 
                                                '"
    .$p->ipnData['item_name']."', 
                                                '"
    .$p->ipnData['item_number']."', 
                                                '"
    .$p->ipnData['quantity']."', 
                                                '"
    .$p->ipnData['mc_gross']."', 
                                                '"
    .$p->ipnData['mc_currency']."', 
                                                '"
    .$p->ipnData['address_name']."', 
                                                '"
    .nl2br($p->ipnData['address_street'])."', 
                                                '"
    .$p->ipnData['address_city']."', 
                                                '"
    .$p->ipnData['address_state']."', 
                                                '"
    .$p->ipnData['address_zip']."', 
                                                '"
    .$p->ipnData['address_country']."', 
                                                '"
    .$p->ipnData['address_status']."', 
                                                '"
    .$p->ipnData['payer_business_name']."', 
                                                '"
    .$p->ipnData['payment_status']."', 
                                                '"
    .$p->ipnData['pending_reason']."', 
                                                '"
    .$p->ipnData['reason_code']."', 
                                                '"
    .$p->ipnData['txn_type']."')");
        }
    }

    ?>
    also tried.......

    PHP Code:
    <?php

    // include header
    include("../../header.php");

    // include the paypal library
    include_once("Paypal.php");

    // create an instance of the paypal library
    $p = new Paypal();

    $config['paypal_test'] = true
    if(
    $config['paypal_test'] == 'true'){ $p->enableTestMode(); } 

    // check validity and write down it
    if($p->validateIpn())
    {
        if(
    $p->ipnData['payment_status'] == 'Completed')
        {
            
    // get package id and user id from custom var
            
    list($user_id$package_id) = explode("_"$p->ipnData['custom']);
            
            
    // get package details
            
    $package mysql_fetch_assoc(mysql_query("SELECT * FROM packages WHERE package_id = '".$package_id."' LIMIT 1"));
            
            
    // update users fields
            
    mysql_query("UPDATE members SET premium = '1', premium_active = '1', premium_start = '".time()."', premium_end = '".strtotime("+" $package['package_length'] . "days")."' WHERE user_id = '".$user_id."'");
            
            
    // update sales log
            
    mysql_query("INSERT INTO sales_log (payer_id,
                                                payment_date,
                                                trans_id,
                                                first_name,
                                                last_name,
                                                payer_email,
                                                payer_status,
                                                payment_type,
                                                memo,
                                                item_name,
                                                item_number,
                                                quantity,
                                                mc_gross,
                                                mc_currency,
                                                address_name,
                                                address_street,
                                                address_city,
                                                address_state,
                                                address_zip,
                                                address_country,
                                                address_status,
                                                payer_business_name,
                                                payment_status,
                                                pending_reason,
                                                reason_code,
                                                txn_type
                                                )VALUES(
                                                '"
    .$p->ipnData['payer_id']."', 
                                                '"
    .$p->ipnData['payment_date']."', 
                                                '"
    .$p->ipnData['txn_id']."', 
                                                '"
    .$p->ipnData['first_name']."', 
                                                '"
    .$p->ipnData['last_name']."', 
                                                '"
    .$p->ipnData['payer_email']."', 
                                                '"
    .$p->ipnData['payer_status']."', 
                                                '"
    .$p->ipnData['payment_type']."', 
                                                '"
    .$p->ipnData['memo']."', 
                                                '"
    .$p->ipnData['item_name']."', 
                                                '"
    .$p->ipnData['item_number']."', 
                                                '"
    .$p->ipnData['quantity']."', 
                                                '"
    .$p->ipnData['mc_gross']."', 
                                                '"
    .$p->ipnData['mc_currency']."', 
                                                '"
    .$p->ipnData['address_name']."', 
                                                '"
    .nl2br($p->ipnData['address_street'])."', 
                                                '"
    .$p->ipnData['address_city']."', 
                                                '"
    .$p->ipnData['address_state']."', 
                                                '"
    .$p->ipnData['address_zip']."', 
                                                '"
    .$p->ipnData['address_country']."', 
                                                '"
    .$p->ipnData['address_status']."', 
                                                '"
    .$p->ipnData['payer_business_name']."', 
                                                '"
    .$p->ipnData['payment_status']."', 
                                                '"
    .$p->ipnData['pending_reason']."', 
                                                '"
    .$p->ipnData['reason_code']."', 
                                                '"
    .$p->ipnData['txn_type']."')");
        }
    }

    ?>

  3. #18
    Join Date
    Dec 2005
    Posts
    2,984
    PHP Code:
    $config['paypal_test'] = true
    if(
    $config['paypal_test'] == 'true'){ $p->enableTestMode(); } 
    This will not execute because $config['paypal_test'] is equal to boolean true, not the string true.

    Why not just do

    PHP Code:
    $p->enableTestMode(); 
    With no conditional around it whatsoever so you are 100&#37; certain that it will request sandbox.paypal.com?

    Also, check your log file if it still doesn't work, the first line should have the URL:
    Code:
    www.sandbox.paypal.com
    NOT

    Code:
    www.paypal.com

  4. #19
    Join Date
    Apr 2005
    Posts
    92
    Now I cant even submit the payment. When I hit send payment it just reloads the payment details page.....

    Sometimes I will get this message

    Bad Request

    Your browser sent a request that this server could not understand.
    Size of a request header field exceeds server limit.

    Apache Server at www.sandbox.paypal.com Port 443
    Last edited by Master00; 04-25-2012 at 03:45 PM.

  5. #20
    Join Date
    Dec 2005
    Posts
    2,984
    Editing paypal_ipn.php has nothing to do with submitting the payment whatsoever.

  6. #21
    Join Date
    Apr 2005
    Posts
    92
    Everything went haywire due to a strange problem with cookies on my browser but I got that fixed.

    I added the code to paypal_ipn.php and it is now going to sandbox.paypal.com but the IPN is still failing!

    Code:
    [04/25/2012 12:30 PM] - FAIL: IPN Validation Failed . /cgi-bin/webscr : www.sandbox.paypal.com
    IPN POST Vars from gateway:
    mc_gross=0.99, protection_eligibility=Eligible, address_status=confirmed, payer_id=C2F3NJ48W5LMA, tax=0.00, address_street=1 Main St, payment_date=12:29:55 Apr 25, 2012 PDT, payment_status=Completed, charset=windows-1252, address_zip=95131, first_name=Test, mc_fee=0.33, address_country_code=US, address_name=Test User, notify_version=3.4, custom=2_1, payer_status=verified, business=seller_1316790187_biz@yahoo.com, address_country=United States, address_city=San Jose, quantity=1, verify_sign=AevuERd1dCumNdboEHmstKieggidAj2jG6GrcMnoJ46hkmuOA4wV7T--, payer_email=japani_1316789859_per@yahoo.com, txn_id=7UX00373KV703414J, payment_type=instant, last_name=User, address_state=CA, receiver_email=seller_1316790187_biz@yahoo.com, payment_fee=0.33, receiver_id=NNWHFKJGP9B22, txn_type=web_accept, item_name=OxiShare Premium Account (1 day), mc_currency=USD, item_number=1, residence_country=US, test_ipn=1, handling_amount=0.00, transaction_subject=2_1, payment_gross=0.99, shipping=0.00, ipn_track_id=7574919950b6, 
    IPN Response from gateway Server:
     HTTP/1.0 302 Found
    Location: https://www.sandbox.paypal.com
    Server: BigIP
    Connection: close
    Content-Length: 0

  7. #22
    Join Date
    Dec 2005
    Posts
    2,984
    Fantastic, you're getting much closer with the trivial errors out of the way. I found the following thread on stackoverlow which will help you:

    http://stackoverflow.com/questions/8...302-in-sandbox

    They apparently recently changed the URL's to use ssl:// and port 443. Post back here if you've got any questions on how to implement it.

    Thanks for sticking with me.

  8. #23
    Join Date
    Apr 2005
    Posts
    92
    Ahhh, yes!

    There we go, it works. Thanks a lot!

    Now, I just hope I don't run into this much trouble when I go live........

  9. #24
    Join Date
    Nov 2011
    Posts
    64
    http://www.amk-hg.com/rczone1/testing2.php
    My one seen don't work ? It don't show me the amount to be paid when I log into sandbox. The testing transaction is not executed.
    Last edited by stevengoh; 04-26-2012 at 02:11 AM.

  10. #25
    Join Date
    Dec 2005
    Posts
    2,984
    If you want us to look at code, you have to actually post it (not a link to it) - posting a link to a PHP script executes it.

    Also, start your own thread so your question can get it's own exposure rather than burying it in this thread.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles