Paypal add to cart button html for handling_cart options - html

I am OK at html but new to PayPal.
I want to be able to use a Paypal button directly from my site without having to use a third party shopping cart.
The only problem I have is that I am in the UK and Paypal do not offer postage/shipping options here dependent on where you are shipping to. So for instance PayPal's standard buttons would not allow me to charge different postage whether I was sending the product to the US or just a nearby town.
They allow you to add postage/shipping dependent on the value of the cart only.
So I have been looking at the html variables available for the buttons here https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HH0D0TA and at posts on Stackoverflow
I wondered if there was any way of combining the option value.. and ="handling_cart" to do this – please see my working below.
So you would click the add to cart button and from the drop down select the shipping area e.g. UK, Europe, Rest of World. The handling charge on the cart would then reflect the option you chose. Instead of the handling cart value being NNNN it would be the value specified for the option, so for Europe £5.00.
<form target="paypal" 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="DLNKFJWJGHZFW">
<table>
<tr><td><input type="hidden" name="on0" value="Shipping Options">Shipping Options</td></tr><tr><td><select name="os0">
<option value="UK Second Class + £2.85">UK Second Class + £2.85 £2.85 GBP</option>
<option value="UK First Class + £3.85">UK First Class + £3.85 £3.85 GBP</option>
<option value="Europe + £5.00">Europe + £5.00 £5.00 GBP</option>
<option value="Rest of World + £7.00">Rest of World + £7.00 £7.00 GBP</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="or call us on +44(0)444444444">or call us on +44(0)444444444</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="handling_cart" value="NNNN">
<input type="image" src="https://www.paypalobjects.com/en_GB/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_GB/i/scr/pixel.gif" width="1" height="1">
</form>
Secondary question: this html gets a straight error from PayPal, probably – among other things - because I am still calling it a hosted button (I think I might need to remove this and somehow link it to the Merchant ID???).
Note I have altered the hosted button id here as I was concerned about security - I might not need to be.
Many Thanks
Allyson

Your hosted button is not formatted correctly to handle the shipping drop down. Also you cannot modify a hosted button it will not work. I have created some sample non-hosted button code as an example of what will work if the shipping calculator is not available in your region.
You will have to update the business value to reflect your merchant id or your email address to test the button code.
<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="youremail#email.com">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="Shipping Options">
<input type="hidden" name="button_subtype" value="products">
<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="GBP">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<table>
<tr><td><input type="hidden" name="on0" value="Shipping Options">Shipping Options</td></tr><tr><td><select name="os0">
<option value="UK Second Class">UK Second Class £2.85 GBP</option>
<option value="UK First Class">UK First Class £3.85 GBP</option>
<option value="Europe">Europe £5.00 GBP</option>
<option value="Rest of World">Rest of World £7.00 GBP</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="or call us on +44(0)444444444">or call us on +44(0)444444444</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="option_select0" value="UK Second Class">
<input type="hidden" name="option_amount0" value="2.85">
<input type="hidden" name="option_select1" value="UK First Class">
<input type="hidden" name="option_amount1" value="3.85">
<input type="hidden" name="option_select2" value="Europe">
<input type="hidden" name="option_amount2" value="5.00">
<input type="hidden" name="option_select3" value="Rest of World">
<input type="hidden" name="option_amount3" value="7.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>

Related

Paypal donation's notification going elsewhere instead of specified addressee

I have a question regarding paypal donation. This is the current paypal on a production site (excluding personal information which has been altered but otherwise identical).
The issue is that for some reason, it has randomly started sending the email notifications to the overall person in charge of the paypal's account here instead of specified email address written in the code beneath. And yes, the email addressee has received emails before, and is part of the paypal account.
Why would it suddenly just start sending emails to the overall account holder instead of the specified addressee?
Please let me know if there are further information I need to add. Thank you.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Specify a Donate button. -->
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="email_address">
<input type="hidden" name="item_name" value="Donation Program">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="return" value="URL">
<!-- Replace value with the web page you want the customer to return to after item cancellation -->
<input type="hidden" name="cancel_return" value="URL">
<!-- Note: shipping override variable is used with this example -->
<input type="hidden" name="no_note" value="0">
<!-- Specify details about the contribution -->
<input type="hidden" name="item_number" value="Donation Program">
<select name="amount" class="typl8-zeta">
<optgroup label="Donation Program">
<option value="200">$200</option>
<option value="250">$250</option>
<option value="300">$300</option>
<option value="350">$350</option>
<option value="400">$400</option>
<option value="450">$450</option>
<option value="500">$500</option>
</select>
<input type="hidden" name="currency_code" value="USD">
<br /><br />
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif"
alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1"
src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
</form>
PayPal will always send email notifications to whichever email address is marked as "Primary" in your email settings on the account, no matter which email address you list in the 'business' input.

Access custom variable without using IPN

Is it possible to get the value of the custom variable from without using IPN?
I have a very simple project that doesn't need auto payment verification or anything like that, everything is done manually. I just need to like one input from the payment page along with that payment.
So is it possible to get the info from the custom variable in the payment confirmation email from paypal or the paypal payment receipt?
Check out button example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal-form" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="paypal#email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Item Name">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="src" value="1">
<input type="hidden" name="a3" value="10.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="custom" id="payment-custom" value="CUSTOM VALUE">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHostedGuest">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
So I want to get that "CUSTOM VALUE" without using a ipn script, is it possible?
The GetTransactionDetails API will return it

Send note to seller with PayPal buy now button

I have generated a "buy now" button from the paypal sandbox website as follows :
<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="abc#xyz.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="BuyItNow">
<input id="paypalamount" type="hidden" name="amount" value="{{totalprice}}">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="img\paypal.png" border="0" name="submit" style="position:absolute;top:12px;left:10px">
</form>
When someone pays with the button, I want to send a default note to the seller. Is there a hidden field I can use?
Here's the code you are looking for. Check out variable list for all the acceptable variables.
You need to edit your security settings in paypal for the note itself to show up, then do
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_note" value="0">
A value of 1 will hide the box/prompt. It will appear on the checkout page. You can set up a buy now button to collect a text field entry, but you have to do that on set-up.
<input type="hidden" name="on1" value="Color" maxlength="200">Note
<input type="text" name="os1">
So if you have the no_note value correct (as you do in your code), you should look into your seller settings to make sure you are collecting instructions from customers.

Pass products detail via paypal

I'm creating a simple paypal checkout where the customer can check out via PayPal. Below is the sample code i am using for paypal checkout.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_name" value="kids t-shirt">
<input type="hidden" name="amount" value="200.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
As you can see, a simply form that passes product name and price which customer can see in their order summary.however how can i pass products details such as product size and color?
Just pass the some more hidden value.check the below code.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_name" value="kids t-shirt">
<input type="hidden" name="amount" value="200.00">
<input type="hidden" name="on0" value="Size" />
<input type="hidden" value="your size value" name="os0">
<input type="hidden" name="on1" value="color" />
<input type="hidden" value="your color value" name="os1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

Integrating PayPal buttons into site

I am trying to integrate PayPal buttons to a website. It was a really tough job making such a big number of buttons but I some how did it, but now I see that some of them work while some of them do not(and go to PayPal's homepage.) I am unable to determine what would have gone wrong which has caused this error.
The code was very big to fit in here so I am sharing to forms, the first one works while the second does not.
<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="xxxxx">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Sumission Order 1- 3 articles ">
<input type="hidden" name="amount" value="xxx">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="tax_rate" value="0.000">
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<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"></p>
</form> </p>
<p>Sumission Order 2- <strong>5 articles</strong></p>
<p>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd3" value="_cart">
<input type="hidden" name="business2" value="xxxxx">
<input type="hidden" name="lc2" value="US">
<input type="hidden" name="item_name2" value="Sumission Order 2- 5 articles">
<input type="hidden" name="amount2" value="xxxx">
<input type="hidden" name="currency_code2" value="USD">
<input type="hidden" name="button_subtype2" value="products">
<input type="hidden" name="no_note2" value="0">
<input type="hidden" name="tax_rate2" value="0.000">
<input type="hidden" name="shipping2" value="0.00">
<input type="hidden" name="add2" value="1">
<input type="hidden" name="bn2" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit2" 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"></p>
</form>
Please help me out. Thanks
You have changed the names of the inputfields in the second form. These are the variables that are send to PayPal. This means you are now posting other variables; PayPal does not understand cmd2 for example, but it understands cmd. So rename the inputfields inside the second form to cmd, business, lc, item_name .. etc and it should work.
BTW It is not illegal to have duplicate names in html-tags, only duplicate ID's are not allowed.
Success!
Since your buttons are in different forms, you don't need to mark your input's name with number at the end. This violates PayPal's convention. Change cmd2 to cmd, etc.