Paypal form select - paypal

I'm confounded why this won't work - the first select works, the second one doesn't. The first one though, does not provide any textual info about the selection.
<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='business' value='payments#site.com'>
<select name='os0'>
<option value='25€ Individual'>Individual rate - 25€</option>
<option value='75€ Group'>Agency rate - 75€</option>
</select>
<input type='hidden' name='option_index' value='0'>
<input type='hidden' name='option_select0' value='25€ Individual'>
<input type='hidden' name='option_amount0' value='25.00'>
<input type='hidden' name='option_select1' value='75€ Group'>
<input type='hidden' name='option_amount1' value='75.00'>
<input type='hidden' name='currency_code' value='EUR'>
<input type='hidden' name='return' value='http://www.site.com/backtoyou/'>
<input type='submit' value='Pay with PayPal!'>
<img alt='' border='0' src='https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif' width='1' height='1'>
</form>

Related

PayPal donation button with price options dropdown sending empty/zero value

I am trying to generate a PayPal donation button with a price drop down and a Yes-No drop down. Button is working fine but the amount/price is going empty. Below is the html generated from PayPal's website. Could anyone please help? Thanks!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="my#email.com">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="IICC">
<input type="hidden" name="item_number" value="GT7">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://website.org/">
<input type="hidden" name="cancel_return" value="http://website.org/">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<table>
<tr><td><input type="hidden" name="on0" value="Select a donation category">Select a donation category</td></tr><tr><td><select name="os0">
<option value="Red">Red £50.00 GBP</option>
<option value="Bronze">Bronze £100.00 GBP</option>
<option value="Silver">Silver £200.00 GBP</option>
<option value="Gold">Gold £300.00 GBP</option>
<option value="Platinum">Platinum £500.00 GBP</option>
<option value="Diamond">Diamond £1,000.00 GBP</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Do you agree?">Do you agree?</td></tr><tr><td><select name="os1">
<option value="NO">NO</option>
<option value="YES">YES</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="option_select0" value="Red">
<input type="hidden" name="option_amount0" value="50.00">
<input type="hidden" name="option_select1" value="Bronze">
<input type="hidden" name="option_amount1" value="100.00">
<input type="hidden" name="option_select2" value="Silver">
<input type="hidden" name="option_amount2" value="200.00">
<input type="hidden" name="option_select3" value="Gold">
<input type="hidden" name="option_amount3" value="300.00">
<input type="hidden" name="option_select4" value="Platinum">
<input type="hidden" name="option_amount4" value="500.00">
<input type="hidden" name="option_select5" value="Diamond">
<input type="hidden" name="option_amount5" value="1000.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_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_GB/i/scr/pixel.gif" width="1" height="1">
</form>
AFAIK, option_index is not supported by donation buttons (cmd = _donations). You may try to use a BuyNow button (cmd = _xclick) instead, or change the amount field into a drop down menu, like
<select name="amount">
<option value="50">Red</option>
<option value="100">Bronze</option>
<option value="200">Silver</option>
...
</select>

Paypal IPN: notify_url is never called

I'm creating an online shop and all seems to be good but my specified notify_url seems to not get called after the payment succeeded.
<?php
echo "
<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='charset' value='utf-8'>
<input type='hidden' value='$price' name='amount' />
<input name='currency_code' type='hidden' value='EUR' />
<input name='shipping' type='hidden' value='0.00' />
<input name='tax' type='hidden' value='0.00' />
<input name='return' type='hidden' value='$nddaff/refill.php' />
<input name='cancel_return' type='hidden' value='$nddaff/refill.php' />
<input name='notify_url' type='hidden' value='http://domain.com/validationpaypal.php' />
<input name='cmd' type='hidden' value='_xclick' />
<input name='business' type='hidden' value='test-facilitator#gmail.com'/>
<input name='item_name' type='hidden' value='$name' />
<input name='custom' type='hidden' value='id=$id&type=$type' />
<input name='lc' type='hidden' value='FR' />
<input name='bn' type='hidden' value='PP-BuyNowBF' />
<input name='sub' value='Buy Now - $price"."€' type='submit' /></form>";
?>
Answer :
There were a bug in paypal sandbox yesterday, all works fine today !
Thanks all for helping !

Paypal _cart not showing tax and shipping in sandbox

I've got a paypal form to request a payment that I'm testing in www.sandbox.paypal.com.
It works as I expect, except for tax and shipping costs, that are ignored and not shown in paypal cart and not computed in cart total amount.
In this case I only have one product, but buyers can add more products to their carts.
I can't understand where I'm going wrong.
<form method="post" name="paypal_form" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type='hidden' name='cmd' value='_cart'>
<input type='hidden' name='business' value='myEmail'>
<input type='hidden' name='charset' value='utf-8'>
<input type='hidden' name='currency_code' value='EUR'>
<input type='hidden' name='notify_url' value='http://mysite/shop/ipn_url.php'>
<input type='hidden' name='custom' value='xxxaasxdfd'>
<input type='hidden' name='return' value='http://mysite/shop/confirm_url.php'>
<input type='hidden' name='lc' value='IT'>
<input type='hidden' name='email' value='buyer#mysite'>
<input type='hidden' name='first_name' value='Test name'>
<input type='hidden' name='last_name' value='Test surname'>
<input type='hidden' name='zip' value='00000'>
<input type='hidden' name='no_note' value='1'>
<input type='hidden' name='cbt' value='Return to mysite'>
<input type='hidden' name='rm' value='2'>
<input type='hidden' name='cancel_return' value='http://mysite/shop/cancel_url.php'>
<input type='hidden' name='upload' value='1'><input type='hidden' name='amount_1' value='129.00'>
<input type='hidden' name='item_name_1' value='23-PROD11'>
<input type='hidden' name='item_number_1' value='120'>
<input type='hidden' name='tax' value='39.37'>
<input type='hidden' name='shipping' id='shipping' value='67.87'>
</form>
I found that the VAT and the shipping cost are visible and computed if I pass them for every single item in my cart.
<input type='hidden' name='shipping_1' id='shipping' value='67.87'>
<input type='hidden' name='tax_1' value='39.37'>
I've charged them on the first item as shipping_1 and tax_1 in the cart for all my items, in this way I'm sure that it will work for cart with one or more items.

paypal options modify price

Was wondering if there's a way to have an drop-down option field modify a base price of an item? Something like this...
<input type="hidden" name="amount" value="$90" />
<input type="hidden" name="shipping" value="$10" />
<input type="text" name="quantity" value="1" style="width:15px;" />
<input type="hidden" name="on0" value="Options1" />
<select name="os0">
<option value="21 inches $5" >21 inches $5</option>
<option value="22 inches $5" >22 inches $5</option>
<option value="24 inches $10" >24 inches $10</option>
</select>
I'm guessing I'll have to make the amount field be a drop-down?
You can check the updated demo:
I have made a custom code to achieve base price + optional price scenario.
you will need to customise your own logic to build the amount value and pass to the amount variable and send it to paypal
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="S4X5XW328WAYY">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="currency_code" value="USD">
Base Price:<div id="base_price" value="100.00">100.00</div>
<input id="final_amount" name="amount" type="hidden" value="100">
<input type="hidden" name="weight_unit" value="lbs">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"><br>
Optional Prices
<table>
<tr><td>
<select name="os0">
<option class="optionVal" value="10.00">Option $10.00 USD</option>
<option class="optionVal" value="20.00">Option $20.00 USD</option>
<option class="optionVal" value="30.00">Option $30.00 USD</option>
</select>
</td></tr>
</table>
<input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
JavaScript:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script>
$(document).ready(function(){
var base_price = $('#base_price').text();
$('select').change(function(){
var amt = $(this).val();
final_amt = parseInt(amt)+parseInt(base_price);
$('#final_amount').val(final_amt);
});
});
</script>

PayPal HTML form with select drop menu

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="daniel_1329709715_biz#gmail.com"/>
<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.
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="Yourbiz#gmail.com">
<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>