Paypal : hosted button payments fail with code=AMO

2019-07-14 04:30发布

问题:

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.

回答1:

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">



回答2:

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">


回答3:

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



回答4:

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.



回答5:

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>
  1. I just omitted the umlauts (ü is the same like ue).
  2. 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&uuml;hr &euro;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&uuml;hr &euro;3.50 EUR, and PayPal has saved Gebuehr €3,50 EUR in the button definition in their systems...



回答6:

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.



回答7:

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).



回答8:

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



回答9:

I had this error using BRL money. The issue was using 'ç' and accent(~/´)