Paypal IPN Variables

This is a discussion on Paypal IPN Variables within the Off Topic Forum forums, part of the Off Topic Discussions category; Don't know a ton about web development lol not really my cup of tea but i started working on my site Init 2 Winit Applications ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Paypal IPN Variables

  1. Developer
    gflam's Avatar
    Member #
    77717
    Join Date
    Jun 2010
    Location
    Jersey
    Posts
    1,841
    Liked
    14 times
    Twitter
    @init2winitapps
    Phone
    Moto Droid/HTC Evo 3D
    DroidForums.net Developer
    DroidForums.net Theme Developer
    #1

    Question Paypal IPN Variables

    Don't know a ton about web development lol not really my cup of tea but i started working on my site Init 2 Winit Applications and trying to work with the ipn so that we can accept payments for boot manager through that.

    Anyone have any knowledge using the ipn? Don't really need to do much just looking to pass two variables and write it to a text file on my server. I've written text files with php just can't figure out how to pass the variables from the ipn to the script and write to the file. I tested on with the sandbox and the ipn was successful and i've ensured the link in my paypal button is right to go to this script but it's just not working correctly for some reason.

    Code looks like this

    Paypal Form
    Code:
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="5ES3TSKJNLJ24">
    <table style="text-align: right; width: 100%;">
    <tr><td><input type="hidden" name="on0" value="Amount you'd like to donate">Amount you'd like to donate</td></tr><tr><td><select name="os0">
        <option value="Just the license">Just the license $2.99 USD</option>
        <option value="A bit more">A bit more $5.99 USD</option>
        <option value="Two bits more">Two bits more $8.99 USD</option>
        <option value="A lot more">A lot more $15.00 USD</option>
        <option value="We love you :)">We love you :) $50.00 USD</option>
    </select> </td></tr>
    <tr><td><input type="hidden" name="on1" value="Primary Phone Gmail">Primary Phone Gmail</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
    </table>
    <input type="hidden" name="currency_code" value="USD">
    <input type="image" align="right" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form>
    PHP Script
    Code:
    <?php
    $req = 'cmd=_notify-validate';
    
    foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
    }
    
    $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
     
    $header .= "Host: ipnpb.paypal.com:443\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
    
    $fp = fsockopen ('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30);
    
    $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'];
    $payer_firstName = $_POST['first_name'];
    $payer_lastName = $_POST['last_name'];
    $gmail = $_POST['on1'];
    
    $From_email = "From: support@init2winitapps.com";
    $Subject_line = "Thanks for your purchase";
    
    $email_msg = "\n\nThe details of your order are as follows:";
    $email_msg .= "\n\n" . "Transaction ID: " .  $txn_id ;
    $email_msg .= "\n" . "Payment Date: " . $payment_date;
    $email_msg .= "\n\nThank you for the purchase!\n\nInit 2 Winit Apps";
    
    if (!$fp) {
    } else {
    fputs ($fp, $header . $req);
    while (!feof($fp)) {
    $res = fgets ($fp, 1024);
    if (strcmp ($res, "VERIFIED") == 0) {
    $mail_From = $From_email;
    $mail_To = $payer_email;
    $mail_Subject = $Subject_line;
    $mail_Body = $email_msg;
    
    mail($mail_To, $mail_Subject, $mail_Body, $mail_From);
    
    $data = "$payer_firstName $payer_lastName $gmail";
    
    $fh = fopen("./paypal/test.txt", "a");
    fwrite($fh, $data);
    fclose($fh);
    
    }
    else if (strcmp ($res, "INVALID") == 0) {
    
    $mail_From = $From_email;
    $mail_To = $receiver_email;
    $mail_Subject = "INVALID IPN POST";
    $mail_Body = "INVALID IPN POST. The raw POST string is below.\n\n" . $req;
    
    mail($mail_To, $mail_Subject, $mail_Body, $mail_From);
    
    }
    }
    fclose ($fp);
    }
    ?>
    Any help would be appreciated I'll send whoever can help a free copy of boot manager as well just to sweeten the deal a little lol
  2. Sponsor
    DF Advertising
    Join Date
    Nov 2008
    Location
    DroidForums.net
     
     
     
     
  3. Developer
    gflam's Avatar
    Member #
    77717
    Join Date
    Jun 2010
    Location
    Jersey
    Posts
    1,841
    Liked
    14 times
    Twitter
    @init2winitapps
    Phone
    Moto Droid/HTC Evo 3D
    DroidForums.net Developer
    DroidForums.net Theme Developer
    #2
    Spent a few hours today teaching myself some php its currently 3:40 in the end I figured it all out and got the whole thing working ipn is no fun but it works and is pretty versatile

    Sent from my evo 3d at 1.8ghz

Sponsors

Posting Permissions

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

Similar Threads

  1. Tasker Variables...Guide?
    By Yonahinthewhale in forum Droid Applications
    Replies: 5
    Last Post: 12-01-2011, 12:06 PM
  2. will paypal for droid pro help
    By edward85251 in forum Droid Hacks
    Replies: 1
    Last Post: 09-05-2011, 02:57 PM
  3. [APK] PayPal
    By raidzero in forum Raidzero
    Replies: 4
    Last Post: 03-19-2011, 07:07 PM
  4. Apps w/ paypal?
    By gmvirtual in forum Droid Applications
    Replies: 0
    Last Post: 01-15-2011, 05:32 PM
  5. Will pay $10 through paypal if someone helps
    By dredge in forum Droid Hacks
    Replies: 55
    Last Post: 01-03-2010, 08:47 PM

Search tags for this page

https://ipnpb.paypal.com/cgi-bin/webscr

,

ipn paypal last name post

,
ipn phone
,
paypal html code prepopulated value first name last name
,
paypal ipn phone variable
,

paypal ipn variables

,
paypal-ipn-evolution-10-08-2011
,
ssl://ipnpb.paypal.com
,
what are paypal ipn variables
Click on a term to search our site for related topics.

Tags for this Thread