Hello I am a developer who is new to developing for PayPal, and I've been handed a legacy application/website that has been running successfully for several years. Unfortunately, the person who was responsible for developing this website was not a strong believer in the value of documentation or future-proofing. I have had to make several major leaps of faith on the logic between sections of this ASP.NET MVC application and its calls to its supporting database.
But more to the point, the website has been utilizing PayPal buttons and its IPN functionality to communicate with a database for years. In those cases, we've only ever had a single product, associated with a single button ID. However, in the last month I've been asked to start supporting options as well so that users can select if they want certain things along with the product to modify their 'end price'.
The old section of the website that was serialized and submitted via jquery/javascript looked like this:
<form action="https://www.paypal.com/cgi-bin/webscr" id="paypal" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="@Drawn from Database and Model@">
<input type="hidden" name="custom" id="orderNumber" value="">
</form>
The changes that I've made were based on a new test button I created on the company's account which had the following fragment:
<table>
<tr><td><input type="hidden" name="on0" value="Item (Y/N)">Item (Y/N)</td></tr>
<tr>
<td><select name="os0">
<option value="No">No $1.00 CAD</option>
<option value="Yes">Yes $1.20 CAD</option>
</select> </td>
</tr>
</table>
So I added the following to the previous section to try to support that.
<form action="https://www.paypal.com/cgi-bin/webscr" id="paypal" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="@Drawn from Database and Model@">
<input type="hidden" name="on0" value="Yes">
<input type="hidden" name="custom" id="orderNumber" value="">
</form>
However, upon testing and attempting to retrieve the product that I'm 'buying' Paypal gives me a screen that says
"Things don't appear to be working at the moment. Please try again later."
With a URL that ends with code=AMOUNT_ERROR
As I said , these forms appear to be submitted in javascript/Jquery
, and more specifically in a webflow.js document, using submit()
.
Anybody have a guess as to why I'm receiving this error? Perhaps I should be rearranging the format of the form more substantially to be in line with the structure of the example button? Or maybe I should use os0 as a name for the item in the form instead of on0? I would contact PayPal support directly, but that is quite difficult to do, given that I don't own the account that I am supporting, and the person who does own it is hard to get on hand for a substantial stretch of time.
Edit: Sorry guys, I found it. It was the name of value I serialized that was wrong. Paypal couldn't figure it out. What I should have named that field was os0 and not on0.