3
votes

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
"I implemented a PayPal HTML button" -- show your work if you'd like help. And how are you "receiving" the information? Is this a question about the terribly ancient Payment Data Transfer (PDT) -- and if yes, why the heck are you integrating this stuff from the early 2000's ?Preston PHX
thank you for your comment! I added the code to my subscription button, and I receive the information from an IPN.vicki
"invoice" as you are passing it should work. However if there is a hosted_button_id and it's being used, values might be ignored because of that. The rest of your code looks like an unhosted button, so I'm not sure why you're including thatPreston PHX
Thank you for your advice. I've tried removing the line hosted_button_id but the invoice parameter is still not passed. I have also added the code for the non-subscription payments above for reference. The non-subscription button code did not contain the hosted_button_id and the "invoice" parameter was never passed.vicki
Uh-huh, well that's the only thing looking off and "invoice" is the right parameter to use. Can't say more with your button values in the above being "..." and you not including the corresponding text of an IPN message you receivedPreston PHX

2 Answers

0
votes

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

0
votes

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