paypal amount 0 on order summery page - paypal

Amount $0 on order summery page.
My Code for Buy Now Button is
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="AF">
<input type="hidden" name="amount" value="10.10">
<table>
<tr><td><input type="hidden" name="on0" value="License Option">License Option</td></tr><tr><td><select name="os0">
<option value="Single User">Single User </option>
<option value="Site License">Site License </option>
<option value="Global License">Global License </option>
</select> </td></tr>
</table>
<input type="image" src="https://www.paypalobjects.com/en_GB/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_GB/i/scr/pixel.gif" width="1" height="1">
</form>

It looks like you have modified the button, which is what's probably causing the issue. When using a hosted button, typically the amount doesn't appear in the code. This is one of the reasons behind the hosted button, it keeps a person from viewing the code and modifying the amount. If you added the line of code in there for the amount, after creating your button this is probably the issue. Either you need to set the amount when creating the button in your account if you are wanting to use a hosted button. Otherwise if you want to be able to edit the amount in the code, you need to create a non hosted, clear text button. This can be done by setting your button not to be hosted on step 2 of the button creation process. Then once the code is generated, it will be encrypted. You have to then select clear text/un-encrypted to generate the HTML code that you can edit.

If you are trying to create button in your PayPal account, please do not change the name and value fields generated there. All data are saved in PayPal system and could not be modified in code line. If you are trying to create a customized button, please refer to below page for its details.
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/buynow_buttons/#id08A2G0920QN
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

Related

Paypal : hosted button payments fail with code=AMOUNT_ERROR

I've been using paypal buttons for years, using IPN to process the payment.
Some of these buttons have stopped working a couple of days ago. They produce an error as can be seen on the following image :
(screenshot)
These buttons have been created using Paypal online tools and their HTML code refers to some paypal UR3ZPGJAT7M data that is edited on the paypal site (and that should hopefully be correct ?)(Note : UR3ZPGJAT7M is an edited value).
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="UR3ZPGJAT7M">
<table>
<tr><td><input type="hidden" name="on0" value="Expédition">Expédition</td></tr><tr><td><select name="os0">
<option value="Expédition en France">Expédition en France €25,00 EUR</option>
<option value="Expédition en Europe">Expédition en Europe €27,00 EUR</option>
<option value="Reste du Monde">Reste du Monde €30,00 EUR</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="EUR">
<input type="image" src="https://www.paypalobjects.com/fr_FR/FR/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal, le réflexe sécurité pour payer en ligne">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>
As can be seen in the screenshot, the feedback url contains the following query string : "&code=AMOUNT_ERROR"
I tried to change the amount value in the paypal online button edit form that defines the UR3ZPGJAT7M code.
I tried various values for the decimal separator :
25.00
25,00
25
but all fail.
I have looked around but couldnt find any solution for this issue.
Paypal support doesnt answer at all.
How can i fix this ?
[EDIT]
Paypal changed their payment forms UI some days ago so it is probably related to this change.
When i create a new button from scratch and feeds it with all same parameters in Paypal's online button creation forms, the new button works fine. So there is a way to enable my buttons : create them anew from scratch as cart buttons. But I have 30+ such registered buttons and i'd appreciate to avoid to recreate all of them anew !
Some other buttons work fine. I notice some of the buttons that work lead to an english form, where decimal separator is '.' . In the "hosted buttons" creation page, the separator for EUR and french langage is automaticaly added as ','.
I found a related issue on paypal support site : https://www.paypal-community.com/t5/PayPal-HTML-Buttons/Update-your-PayPal-buttons-before-29th-March-2017/m-p/1127596 The user found out why his buttons failed : because of inventory. He had to cancel inventory request. But my buttons doent use inventory.
Paypal seems to have problems with special characters within the value fields by default. By adding the declaration for UTF-8 the form validation seems to work flawless. This did the trick for me:
<input type="hidden" name="charset" value="utf-8">
Another workaround could be the character cleanup of the values attribute like:
value="my_value_1">
I had the same problem and solved by changing the currency_code from "USA" to "USD". For example:
<input type="hidden" name="currency_code" value="USD">
Please refer the link https://www.paypal-knowledge.com/infocenter/index?page=content&id=FAQ2067&expand=true&locale=en_US for more details on the resolution of the issue.
Thanks,
Kavitha
As a conclusion i had to change all buggy buttons and create them anew.
Editing them in paypal online button creation forms did not help.
It looks like the oldest hosted paypal buttons are not compatible with new 2017 paypal API.
I had a similar problem recently.
I know PayPal made some changes on March 29th, but my site is brand new, i.e. I created my first PayPal button after March 29th.
The site went live April 6th, and the button stopped working after April 17th (the last payment came on that day).
I'm in Germany and my site is in German, so my payment options contain umlauts, and , as decimal separators.
My old button (the one that suddenly stopped working) looked like this:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="ABCDEFGHIJKLM">
<table>
<tr><td><input type="hidden" name="on0" value="Betrag:">Betrag:</td></tr><tr><td><select name="os0">
<option value="Gebühr">Gebühr €3,50 EUR</option>
<option value="Gebühr und Spende">Gebühr und Spende €5,00 EUR</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="EUR">
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="notify_url" value="https://example.com/notify/?id=xyz">
</form>
I contacted PayPal support, and at first, the guy advised me to change the decimal separators in the numbers from , (German decimal separators) to . (English decimal separators).
That didn't change anything...and I suspected the umlauts in Gebühr to be the culprit, so I asked if PayPal has any known problems with umlauts.
The answer was "yes, maybe sometimes" and I got the advice to re-create the buttons without umlauts.
This did help, and my current (working) button now looks like this:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="MLKJIHGFEDCBA">
<table>
<tr><td><input type="hidden" name="on0" value="Betrag">Betrag</td></tr><tr><td><select name="os0">
<option value="Gebuehr">Gebuehr €3,50 EUR</option>
<option value="Gebuehr und Spende">Gebuehr und Spende €5,00 EUR</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="EUR">
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="notify_url" value="https://example.com/notify/?id=xyz">
</form>
I just omitted the umlauts (ü is the same like ue).
Note that the prices still contain commas as decimal separators and the € sign.
I tried to enter the prices with ., but the German PayPal site didn't let me (because it's not correct in German).
The price in the €3,50 EUR format (including the € sign) was inserted into the HTML code by PayPal as a result of me just entering 3,50 and choosing EUR as the currency.
So in the end, it's working...for now.
I hope it won't silently stop working again, but frankly I'm not sure.
On one hand, the PayPal UI lets me create buttons with umlauts and commas, without any kind of warning that this could lead to problems.
But on the other hand PayPal's support suspects umlauts and commas to be an issue.
Then again, I thought about changing my HTML code from Gebuehr €3,50 EUR to Gebühr €3.50 EUR to make absolutely sure there will not be issues with umlauts/commas again.
But who knows what will happen when my site posts Gebühr €3.50 EUR, and PayPal has saved Gebuehr €3,50 EUR in the button definition in their systems...
I had the same error starting in late July, 2017. Found it to be caused by a comma in the amount, for example: <input type="hidden" name="amount" value="1,430">
Removing the comma corrected the PayPal error.
The form had been used for years with no such problem before.
I was using the dropdown option, with Hebrew text inside. Once I changed all the options to only read English text, everything worked fine (even though the PayPal website generated the Hebrew form for me).
I meet the issue because <input type="hidden" name="amount" value="$999">, change $999 to 999 and it fixed.
post it here in case someone else met the same issue
I had this error using BRL money. The issue was using 'ç' and accent(~/´)

Paypal Custom Link

Regarding paypal buttons, I see plenty of stuff online that talks about creating a custom button to use in place in lieu of their official buttons.
What if I skipped using a button entirely and just used its alt tag to say what the link is?
<form target="_blank" action="https://www.paypal.com/cgi­bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="item_name" value="Blah blah blah">
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="no_note" value="1" />
<input class="alty" type="image" src="" border="0" name="submit" alt="Donation to specific project">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Just realized this doesn't work in Chrome, but it does work in FF. I'm just asking, say it did work in all browsers, would this be allowed, ie, just using alt tags to make it clear that it's a link to paypal's page?
Are there are workarounds that allows you to use a word/sentence that's a link to paypal's page, short of using paypal's email link?
In case anyone asks why I'm not using paypal's email link - it's because I cannot change the email address for that that link, whereas if I use code as in above, I can change the email address so the notification can go the the right person. (there are multiple programs in one department).
Advice?
Yes you can do it in this way also . You are allowed to use your link or images to direct to the PayPal checkout page .
And as far as the above code is concerned its working fine in chrome too , just tested it out .

Amount is not displaying in paypal form

I am using the following paypal code but still the amount is not displayed in paypal form once the website redirect the page to paypal.
`<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXX">
<input type="hidden" name="amount_1" value="200">
<input type="image" style="width: 70px !important; padding: 0px !important;" src="http://www.merlioncricket.com/Login/static/images/payment.png" 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>`
Please let me know, why the amount is not displaying.
Thanks,
Gladiator
Finally I found the answer, & maybe it is useful to others, whenever you create the paypal button make sure in step 2 "Save Button At PayPal" is not clicked & second once you create the button, remove code protection & then select the code & copy the paypal generated code.
It will solve the problem.
Thanks....
When using a hosted button, you can not pass over an amount. The hosted buttons, prevents someone from directly modifying the code and passing over a different amount. If you are wanting a different amount, you would need to log into your account and edit the hosted button. If you want to dynamically populate the amount, then you would need to create a non hosted clear text button.

PayPal Donation Button: Adding 'Amount' and 'Currency'

I have the "normal" PayPal donation button. I want to add two multiple choice fields: Amount and Currency as the image below. So the user dont need to put the amount of the PayPal website:
This is the 'normal paypal donation button 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="XXXXXXXXXXXXX">
<input type="image" src="https://www.paypalobjects.com/es_ES/ES/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1">
</form>
I have read on this post that you have to add the following lines, but I dont know where or how to do it. It doesnt work.
<label for="amount">Select the amount you wish to donate:</label>
<select name="amount" id="amount">
<option value="5.00">$5.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
</select>
Can anyone tell me how to do it correctly? Thanks!
Hosted PayPal buttons allow you to send option variables, but when not for a donation button, be sure that the option values (for drop downs / text boxes) match exactly what is saved in your PayPal account. i.e. do not edit drop down boxes PayPal creates for you.
As for adding drop down boxes / text boxes to a hosted button, perfectly possible, as long as they do not alter the payment amount. So, for creating a hosted donation button that allows you to edit the amount, I advise the following:
Create a buy now button on PayPal, adding the drop down boxes and/or text boxes you wish to add to your donation button. Create this button as if you were creating your donation button, because that is exactly what we will be doing, changing this button into a donation button.
Copy the the whole buy now button HTML code, paste into notepad, or an editor where you can use 'find and replace'.
Replace all occurances of 'buynow' with 'donate' (This usually just changes the image). Also, replace '_xclick' with '_donations'. (to tell PayPal how to generate the checkout page)
You now have a donation button
I had the similar problem, I solved it by the following steps:
Created a basic 'Buy Now' button (without any options or text fields, just the bare button), made sure i unchecked 'save button at PayPal' before clicking 'create button'.
Then After the button is created, and code is generated, clicked 'Remove code protection' on the top-right where the generated code is shown.
added one additional text input with name 'amount'
replaced value _xclick with _donations (on the input field with name='cmd')
the result is the following code, and it works for me (for now) (you need to add some validations though)
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="XXXXXXXXXXXXX">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Sample Name Here">
<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">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHosted">
<input type="hidden" name="on0" value="Donate">
<input type="text" name="amount" value="23.00">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_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>
Paypal has specific HTML data requirements when you post to their page.
The 'host_button_id' can only be used for one specific value and it's data that paypal holds on their site as a convenience to their clients.
In order to pass variable data you have to pass all the information they need. The 'host_button_id' is no longer needed.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="herschelgomez#xyzzyu.com">
<label for="amount">Select the amount you wish to donate:</label>
<select name="amount" id="amount">
<option value="5.00">$5.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
</select><br/>
<label for="currency_code">Select the currency:</label>
<select name="currency_code" id="currency_code">
<option value="USD">USD</option>
<option value="GBP">GBP</option>
<option value="CAD">CAD</option>
</select><br/>
<input type="hidden" name="currency_code" value="USD">
<input type="image"
src="https://www.paypalobjects.com/es_ES/ES/i/btn/btn_donateCC_LG.gif" border="0"
name="submit" alt="PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif"
width="1" height="1">
</form>
You can find more currency codes here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_currency_codes
and more html info here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_buynow_buttons#id08A2G0920QN
Also for the hidden 'cmd' I'm not sure if that will have to change to '_xclick' only. You'll have to test it out and see what works.
Please try this :
<head>
<title>Get Selected Item - DevCurry.com</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js">
</script>
<script type="text/javascript" language="javascript">
$(function () {
$('#ddl').change(function () {
$('#divone').text($(this).find(":selected").val());
});
});
</script>
</head>
<body>
<select id="ddl">
<option value="Tomatoes">Tomatoes</option>
<option value="Potatoes">Potatoes</option>
<option value="Onion">Onion</option>
<option value="Olives">Olives</option>
</select>
<br />
<div id="divone" />
<input type="hidden" id="txt" />
</body>
</html>

How to make paypal button fields 'Required'?

i have created a pay now button using paypal button generator.
The button has 2 fields, and then you press pay now.
However, if you leave these fields empty, you can still pay
I want to make these fields "required", if a user didn't fill these fields, he should not be able to pay. How?
The button is not hosted on paypal, but the button protection is ON. I want the button to be encrypted.
EDIT
i tried javascript form validation, didn't work, any help?
here's the script
<form
action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<table>
<tr><td><input type="hidden" name="on0" value="first form">form 1</td></tr><tr><td><input type="text" name="os0" maxlength="200"></td></tr>
<tr><td><input type="hidden" name="on1" value="2nd form">2nd form</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="encrypted" value=" encryption here ">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_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>
any help making these field required? I'll give you 3 up votes because i have 3 stackoverflow accounts and an accepted answer - that's the least i can do :)
PS
i couldn't make the form validation work, so i tried to hide the submit button unless the forms are filled, so far, that didn't work as well.
UPDATE - #Last Rose Studios
I tried many validation ways, finally i used my friend's contact form validation lol
validation.js
function has_id(id){try{var tmp=document.getElementById(id).value;}catch(e){return false;}
return true;}
function has_name(nm){try{var tmp=cfrm.nm.type;}catch(e){return false;}
return true;}
function $$(id){if(!has_id(id)&&!has_name(id)){alert("Field "+id+" does not exist!\n Form validation configuration error.");return false;}
if(has_id(id)){return document.getElementById(id).value;}else{return;}}
function $val(id){return document.getElementById(id);}
function trim(id){$val(id).value=$val(id).value.replace(/^\s+/,'').replace(/\s+$/,'');}
var required={field:[],add:function(name,type,mess){this.field[this.field.length]=[name,type,mess];},out:function(){return this.field;},clear:function(){this.field=[];}};var validate={check:function(cform){var error_message='Please fix the following errors:\n\n';var mess_part='';var to_focus='';var tmp=true;for(var i=0;i<required.field.length;i++){if(this.checkit(required.field[i][0],required.field[i][1],cform)){}else{error_message=error_message+required.field[i][2]+' must be supplied\n';if(has_id(required.field[i][0])&&to_focus.length===0){to_focus=required.field[i][0];}
tmp=false;}}
if(!tmp){alert(error_message);}
if(to_focus.length>0){document.getElementById(to_focus).focus();}
return tmp;},checkit:function(cvalue,ctype,cform){if(ctype=="NOT_EMPTY"){if(this.trim($$(cvalue)).length<1){return false;}else{return true;}}else if(ctype=="EMAIL"){exp=/^[a-zA-Z0-9._%-]+#[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;if($$(cvalue).match(exp)==null){return false;}else{return true;}}},trim:function(s){if(s.length>0){return s.replace(/^\s+/,'').replace(/\s+$/,'');}else{return s;}}};
paypal.html
<script src="validation.js"></script>
<script>
required.add('os0','NOT_EMPTY','1st form');
required.add('os1','NOT_EMPTY','2nd form')
</script>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="return validate.check(this)">
<input type="hidden" name="cmd" value="_s-xclick">
<table>
<tr><td><input type="hidden" name="on0" value="1st form">1st form<span class="required_star"> * </span></td></tr><tr><td><input type="text" name="os0" maxlength="200" id="os0" class="required"></td></tr>
<tr><td><input type="hidden" name="on1" value="2nd form">2nd form<span class="required_star"> * </span></td></tr><tr><td><input type="text" id="os1" name="os1" maxlength="200" class="required"></td></tr>
</table>
<input type="hidden" name="encrypted" value=" encryption here
">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_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>
I have used JavaScript, and then i read your answer, but i'm not gonna change because it works now
i still have 2 small questions
1- is it possible to remove the description box from paypal page see this
2- paypal is not redirecting to the thank you page after the payment is done, i created many button, it's just not redirecting (i don't have a cancel page)
you could use the html5 input attribute 'required', and that would take care of some browsers, for the others you would have to use javascript to validate the form.
I'll use jQuery if you don't mind to give you a quick example.
$('form').submit(function(e){
flag = false;
$('[name="os0"], [name="os1"]').css('background','').each(function(){
el=$(this);
if(el.val().length == 0){
flag = true;
el.css('background','red');
}
});
if(flag){
return false;
}
});
this will prevent the form from being submitted unless both fields are filled out. I also added some feedback for the user by turning the background of the input red (optional).
Of course this will only work in modern browsers or older browsers with javascript enabled, there will still be a small percentage where it will pass through. In this case Robert's suggestion that you post to an in between page on your server might be a good idea.
Without modifying the button code, you'd need a client-side solution (like you mentioned), since the POST will go directly to PayPal (https://www.paypal.com/cgi-bin/webscr).
Alternatively, you could submit the POST to an inbetween page on your server, and forward from PayPal there on, in order to include a server-side check as well (only if the fields are absolutely required, in case JavaScript is disabled, for example).