1

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.

4

1 回答 1

0

对不起这些家伙,但这次我将不得不回答我自己的问题。我之前曾尝试在https://www.paypal.com/cgi-bin/webscr上将“on0”序列化并发布到 PayPal 。我的错误是 PayPal 不理解这一点,尽管您可以使用它来使用原始 URL 查询来触发按钮选项。我的更正如下:

<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="os0" value="Yes">
    <input type="hidden" name="custom" id="orderNumber" value="">
</form>

我知道这个问题没有太大意义。我很高兴在我的主管强调他对这个功能的需求之前找到了解决方案。我想在 IT 领域,我们都必须处理遗留代码,以及临时员工的笨拙变通办法。对于那个很抱歉。

于 2017-12-18T17:37:58.893 回答