Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PayPal HTML form with select drop menu

Tags:

paypal

I am trying to figure this one out, but I need some help.

I want to offer multiple products in the select list for a customer to choose and buy one.

<FORM action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <INPUT TYPE="hidden" name="cmd" value="_xclick"/>
    <INPUT TYPE="hidden" name="charset" value="utf-8"/>
    <INPUT TYPE="hidden" NAME="return" value="http://www.albertamomentummassage.com/gift-certificate-thank-you/"/>
    <INPUT TYPE="hidden" NAME="rm" value="2"/>
    <INPUT TYPE="hidden" NAME="currency_code" value="CAD"/>
    <INPUT TYPE="hidden" NAME="business" value="[email protected]"/>

    <select name="os_0" value="Therapeutic Massage">
        <option value="2 Hour Masssage">2 Hour Massage $160.00 CAD</option>
        <option value="90 Minute Massage">90 Minute Massage $120.00 CAD</option>
    </select>

    <input type="hidden" name="option_amount0" value="160"/>
    <input type="hidden" name="option_amount1" value="120"/>

    <input type="submit" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" />
</FORM>

Once I got redirected to PayPal I am missing, both, item description and item price.

like image 745
daniel.tosaba Avatar asked Dec 05 '25 11:12

daniel.tosaba


1 Answers

You'll still need to send along an item_name field. The drop down list acts as a modifier for an item to add to the cart. In addition to the drop down list itself, you'll also need to send option_select(n) and option_amount(n) in your form. Check out the example below, it's from the Paypal button generator and should get you rolling.

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Massage service">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<table>
    <tr><td><input type="hidden" name="on0" value="Duration">Duration</td></tr>
    <tr><td>
    <select name="os0">
    <option value="90 minutes">90 minutes $120.00 CAD</option>
    <option value="2 hours">2 hours $160.00 CAD</option>
    </select>
    </td></tr>
</table>
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="option_select0" value="90 minutes">
<input type="hidden" name="option_amount0" value="120.00">
<input type="hidden" name="option_select1" value="2 hours">
<input type="hidden" name="option_amount1" value="160.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_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>
like image 111
JustinW Avatar answered Dec 07 '25 10:12

JustinW



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!