1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

formail and paypal

Discussion in 'PHP' started by leeds1, Nov 15, 2004.

  1. #1
    I want users to be able to complete 4 different input boxes (that get verified complete) and then send them to paypal for payment of a specified amount to my paypal address.

    Any ideas for the code for this ?

    Thanks

    (ps: paypal only allows 2 input fields hence the question)
     
    leeds1, Nov 15, 2004 IP
  2. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    not sure I understand fully....

    paypal allows you to "pass through" as many variables as you want they just start with mc_ or something (it's in the definiton blurb from PP)

    The two you are reffering to are the ones visible during PP transaction.
    But you can use for example substr or concat to build these from seperate input fields.....

    Thus you can do all the verification you want before sending to PP have as many field as you need and anything you need back pass via the "specials".
    M
     
    expat, Nov 15, 2004 IP
  3. leeds1

    leeds1 Peon

    Messages:
    585
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want 4 maybe 5 fields to be completed and verified before sent to PP

    At PP it must have the £amount complete and my email address

    Ive read their blurb and played around but couldnt figure it out
     
    leeds1, Nov 15, 2004 IP
  4. Trance-formation

    Trance-formation Peon

    Messages:
    598
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The paypal code that relates to optional fields is as follows
    <table>
    <tr><td>
    <input type="hidden" name="on0" value="Option Field 1">Option Field 1
    </td><td>
    <input type="text" name="os0" maxlength="200">
    </td></tr>
    <tr><td>
    <input type="hidden" name="on1" value="Option Field 2">Option Field 2
    </td><td>
    <input type="text" name="os1" maxlength="200">
    </td></tr>
    </table>
    Code (markup):
    If you extended the table to include on2, os2, on3 and 0s3 I believe that would pass 4 option fields through pp for the transaction.

    As to verification I would probably settle for a two stage process, so on page one you have a bit of php that verifies the code and on verification passes the fields as variables to the paypal button code ready for payment.

    I haven't done this so have no guarantees, but is certainly the way I would initially look at it (I'm sure it could be made a one step process, but that would probably involve getting a little bit more into the guts of paypal data transfer than I am currently comfortable with)
     
    Trance-formation, Nov 15, 2004 IP
  5. leeds1

    leeds1 Peon

    Messages:
    585
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks Adam - I tried that and added my own fields but they never showed up on the PP pages (I thought that would do it, but reading PP again they do say a maximum of 4 fields)

    I am thinking of doing a standard formmail that redirects to PP using a PHP script
     
    leeds1, Nov 15, 2004 IP
  6. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #6
    just describe in a bit more detail what you actually want to do.


    PP has two options using their buybuttons or simply transfer a payment whilst processing all nessesary information beforehand (outside PP)

    Thius if you wish to process a orm with 4 information fields outside name and address you do that before hitting PP and do all the validation beforehand.

    You also have to set up return pages which will accept the variables comming back from PP (the return page is indicated in the PP payment stream)

    E.g. typical PP feed

    echo"<form target=\"_self\" action=\"https://www.paypal.com/cgi-bin/webscr\" name=\"SecureForm\" method=\"post\">
    <input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
    <input type=\"hidden\" name=\"business\" value=\"$cust1\">
    <input type=\"hidden\" name=\"item_name\" value=\"order $cart_order_id\">
    <input type=\"hidden\" name=\"item_number\" value=\"$cart_order_id\">
    <input type=\"hidden\" name=\"no_shipping\" value=\"1\">
    <input type=\"hidden\" name=\"return\" value=\"$site_url/confirmed.php?total=$payable&cart_order_id=$cart_order_id&session=$session\">
    <input type=\"hidden\" name=\"cancel_return\" value=\"$site_url/confirmed.php?total=$payable&cart_order_id=$cart_order_id&fail=fail&session=$session\">
    <input type=\"hidden\" name=\"amount\" value=\"$payable\">

    <input type=\"hidden\" name=\"lc\" value=\"$country_iso\">
    <input type=\"hidden\" name=\"first_name\" value=\"$first\">
    <input type=\"hidden\" name=\"last_name\" value=\"$name\">
    <input type=\"hidden\" name=\"address1\" value=\"$add_1\">
    <input type=\"hidden\" name=\"address2\" value=\"$add_2\">
    <input type=\"hidden\" name=\"city\" value=\"$town\">
    <input type=\"hidden\" name=\"state\" value=\"$county\">
    <input type=\"hidden\" name=\"zip\" value=\"$postcode\">
    <input type=\"hidden\" name=\"email\" value=\"$email\">
    <input type=\"hidden\" name=\"day_phone_a\" value=\"$phone\">
    <input type=\"hidden\" name=\"cn\" value=\"How Did You Hear About Us?

    \">
    <input type=\"hidden\" name=\"currency_code\" value=\"$sales_currency\">
    <input type=\"hidden\" name=\"upload\" value=\"1\">";

    lots more vars possible or more elgant hold the transaction in a database and retrive when the result comes back thus you get a first hand view of abandoned failed and success transactions and don't show any of your internal data to the outside.


    all vars plus additional information is passed back to the indicated page(s) that can than act ccordingly

    e.g insert into DB and send additional messages etc etc...

    The payment page of PP only allows two more fields to be shown so what just pass all the other requirements straight through!!

    Best of luck
    M

    PS before you ask to make this work
    echo"<form target=\"_self\" action=\"https://www.paypal.com/cgi-bin/webscr\" name=\"SecureForm\" method=\"post\">

    you need a java reload inserted as onload in the body tag of the page
     
    expat, Nov 16, 2004 IP