PayPal HTML Button Missing Invoice Parameter

Viewed 260

I implemented a Paypal HTML button (payment and subscription) to direct the client to the Paypal site to make a payment. Also, I pass the invoice # as a parameter. According to the following documents, invoice is a pass-through variable.

https://developer.paypal.com/docs/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/# https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/archive/PP_subscriptions.pdf

In fact, I do receive all parameters (including invoice) as a POST call when testing on my sandbox account. However, when I test on live payments (non-sandbox account), the invoice is not received. However, I receive other payment information such as item_number, custom, transaction id, etc. Also, with live payments, the information is passed through a GET call instead of a POST call.

In summary, why do I receive the invoice parameter from sandbox payments but not with live payments.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
    <input type="hidden" name="return" value="<%= (request.isSecure() ? "https" : "http") + "://" + request.getServerName() + "/upgradepayment" %>">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="cmd" value="_xclick-subscriptions">
    <input type="hidden" name="hosted_button_id" value="...">
    <input type="hidden" name="business" value="...">
    <input type="hidden" name="item_name" value="...">
    <input type="hidden" name="notify_url" value="..."
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="a3" value="...">
    <input type="hidden" name="p3" value="1"> 
    <input type="hidden" name="t3" value="M">
    <input type="hidden" name="src" value="1">
    <input type="hidden" name="sra" value="1">
    <input type="hidden" name="invoice" value="...">
    <input type="hidden" name="custom" value="...">
    <input type="hidden" name="item_number" value="...">
    <input id="ok" type="submit" name="submit" value="Pay and Subscribe with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
    <input type="hidden" value="<%= (request.isSecure() ? "https" : "http") + "://" + request.getServerName() + "/upgradepayment" %>" name="return">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="...">
    <input type="hidden" name="item_name" value="...">                      
    <input type="hidden" name="amount" value="...">
    <input type="hidden" name="no_shipping" value="0">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="lc" value="CA">
    <input type="hidden" name="bn" value="PP-BuyNowBF">
    <input type="hidden" name="invoice" value="...">
    <input type="hidden" name="custom" value="...">
    <input type="hidden" name="item_number" value="...">
    <input id="ok" type="submit" name="submit" value="Pay with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form> 

edit: I receive the information about subscriptions with instant payment notification (IPN)

2 Answers

I just did a live payment using this code below (your HTML but modified a bit):

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="<BUSINESS_PAYPAL_EMAIL>">
    <input type="hidden" name="item_name" value="<ITEM_NAME>">
    <input type="hidden" name="notify_url" value="<CALLBACK_URL>"
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="p3" value="1"> 
    <input type="hidden" name="t3" value="M">
    <input type="hidden" name="src" value="1">
    <input type="hidden" name="sra" value="1">
    <input type="hidden" name="invoice" value="<INVOICE_ID>">
    <input type="hidden" name="custom" value="<CUSTOM_OPTIONAL>">
    <input type="hidden" name="item_number" value="<ITEM_NUMBER>">
    <input type="hidden" name="amount" value="<AMOUNT>">
    <input id="ok" type="submit" name="submit" value="Pay and Subscribe with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>

I used https://requestbin.com/ to collect the IPN Callbacks. Here is the screenshot with the invoice:

enter image description here

Make sure you are correctly implementing IPN listener request-response flow.

Your listener should return an empty 200 message back to Paypal to these addresses;

After that you get a VERIFIED message along with parameters. Make sure to include invoice input (which seems like you already did) in the form. The invoice is optional and is not passed back to you by default.

There is also an IPN simulator which you can try and make sure your listener is working correctly.

Here is a complete example on how to process IPN messages: https://gist.github.com/xcommerce-gists/3440401

Related