I have just began working on a project processing paypal payment on a web site, which does not work fine in the sense that the email notification is sent if and only if the user goes back to the site. The fact is that I didn't code it and I even don't know what kind of api it uses. I read the doc which is quite obscure to me (It understood there is a token needs to be sent from the site by get request method but I am really not sure). I understand from the code that, in the following, the op=dodons uri is used to mange the response of paypal and to send an email notification to the user. Here is the only thing I can tell you about the page from which I want to fetch up how the payment is processed :
<form action="{$payPalURL}" method="post" class="payPalForm" id="frmpp">
<input type="hidden" name="cmd" value="_donations" id="typedon"/>
<input type="hidden" name="item_name" value="Donation" />
<input type="hidden" name="business" value="{$myPayPalEmail}" />
<input type="hidden" name="notify_url" value="{$url}/index.php?op=dodons&donation=1&tid={$randomID}&payment=1" />
<input type="hidden" name="return" value="{$url}index.php?page=campaign&op=dodons&campaign_id={$campaign->getId()}&don=ok" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="cbt" value="Continue" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="txn_id" value="{$randomID}" />
<input type="hidden" name="tid" value="{$randomID}" />
{if $logged_user != null}
<input type="hidden" name="a_id" value="{$logged_user->getId()}" />
</form>
It looks like you're using Payments Standard in combination with Payment Data Transfer (PDT).
PDT only works if the user makes it back to the site which is never guaranteed, even with Auto-Return enabled.
Instead, use Instant Payment Notification (IPN). This is a simple POST of all transaction data to a listener script on your server, and this happens regardless of whether or not the user makes it back to your site or not. It's completely separate from the checkout flow.
Related
being a PP developer newbie, I used the PayPal documentation to set up this Business Starter integration:
<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="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="info#mybusiness.com" />
<input type="hidden" name="item_name_1" value="My product 1" />
<input type="hidden" name="amount_1" value="10" />
<input type="hidden" name="quantity_1" value="2" />
<input type="hidden" name="display" value="1" />
<input type="hidden" name="return" value="http://www.mybusiness.com/cgi-bin/gk.cgi?ppstatus=ppy" />
<input type="hidden" name="cancel_return" value="http://www.mybusiness.com//cgi-bin/gk.cgi?ppstatus=ppn" />
<input type="hidden" name="cbt" value="Back to MyBusiness" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="custom" value="MyID" />
<input name="submit" type="image" id="submit" src="../pics/b-pp_01.gif" width="200" height="30" border="0">
</form>
All I get after sending this form away is a blank page with the URL https://www.paypal.com/cgi-bin/webscr
Where did I go wrong?
Thanks for any help,
Emil
There are a few issues with your button (e.g. you don't specify a total amount; I don't think you are doing what you think you are doing with the custom field; etc.) but to start with: you are giving PayPal two different commands (cmd=_cart, cmd=_s_xclick), and likely neither of them is what you want. _cart is for using the PayPal cart, which is a little-used PayPal product where the cart is maintained by PayPal, not on your site. And _s-xclick is for secure, ie encrypted buttons, which you are not doing (your cart fields being plaintext in the form html).
Here's one overview of the button docs:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
... that I hope can help, but ultimately get the reference guide for the particular product you are trying to use, specify only that cmd, and use only the field supported by that product. I also recommend using one of PayPal's (non-javascript) button generators to generate your first few buttons, thus guaranteeing that you are getting valid button html, and then modifying from there rather than trying to write from scratch. Helps get you on the right path.
I'm trying to integrate Paypal payments on website and I got this form:
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" id="paypal_form">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="mail#mail.com" />
<input type="hidden" name="item_name" value="Test payment" />
<input type="hidden" name="item_number" value="777" />
<input type="hidden" name="amount" value="1.99" />
<input type="hidden" name="return" value="http://myhost.com//successpaypal.php" />
<input type="hidden" name="cancel_return" value="http://myhost.com/cancelpaypal.php" />
<input type="hidden" name="no_shipping" value="0" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="currency_code" value="USD" />
<input type="submit" value="Go to PayPal" />
</form>
And payments goes fine until users needs to confirm payment. There is no e-mail sending. I was trying in the sandbox with couple e-mail from couple computers and a couple of days. Is there any way to remove confirmation of payment by e-mail or what can be wrong with my that form?
The sandbox environment doesn't send emails externally. Since anyone can open (and confirm) any email address on any account in sandbox, it would be total chaos.
Instead, you can find all relevant messages that otherwise would've been sent as emails under 'Dashboard' > 'Sandbox notifications' on https://developer.paypal.com/
I have a problem with Payal ipn notifications: There are 2 different forms, one is live and works for a long time, then the other one is only implemented.
This will work perfect in my sandbox, but when trying with live it with PayPal, it fails. No notification request is sent to my server. I've checked apache logs - nothing.
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="business" />
<input type="hidden" name="item_name" value="name" />
<input type="hidden" name="item_number" value="1" />
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="amount" value="1" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="custom" value="AD::1" />
<input type="hidden" name="return" value="myurl" />
<input type="hidden" name="notify_url" value="notifyUrl" />
<div style="text-align: center">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" style="width: 147px" />
No firewall is installed
The script url is correct and works from outside
The script was developed on Zend Framework, so the URL is [domain]/module/controller/action I have also tried with regular [domain]/handler.php<br/>
The IPN is On in the pp settings
The currently working script is on [domain], the new script is on [subdomain].[domain]
Have you looked at the 'IPN History' within your account?
Hover over 'History' and click 'IPN History' (or Profile > My selling tools > Instant Payment Notification > History).
This will give you the status of each IPN message we generated. These must be marked as 'Sent' in order for us (PayPal) to mark them as having been delivered.
If they are marked as 'Sent', this means we've delivered them to your IPN handler (the URL of which will be available too) and we have successfully receive a HTTP 200 'OK' response from your IPN handler.
If we do not receive a HTTP 200 for whichever reason (ssl handshake validation, network timeout, script error (500), server error (503), then we will reattempt delivery of the IPN message up to an additional fifteen times.
I'm trying to use Paypal IPNs on the sandbox. I have a form that submits an express checkout:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="my-sandbox-merchant-account#test.com" />
<input type="hidden" name="item_name" value="Item 3" />
<input type="hidden" name="item_number" value="3" />
<input type="hidden" name="amount" value="5.00" />
<input type="hidden" name="shipping" value="0.00" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="cn" value="Comments" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input type="hidden" name="test_ipn" value="1" />
<input type="hidden" name="return" value="http://myhost/my-return-url" />
<input type="hidden" name="rm" value="2" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_SM.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
The payment goes through fine with my sandbox buyer account, however the IPN notifications are failing. When I click on the IPN messages in the sandbox I see that the correct notification endpoint is configured, however the message has failed, the http response code is blank, and IPN typeTransaction = "made". My logs show that my IPN endpoint hasn't received any messages (I know the endpoint is up because i've tried sending a manual POST). The message paypal is trying to send is:
handling_amount=0.00&payer_id=442H4KP3WRC9E&ipn_track_id=989ff3ead6a80&shipping=0.00
&charset=windows-1252&payment_gross=
&verify_sign=ABKgD9bUbQF9WahZwd8aOs6tdcUGAteKcEga-DtOd5oNAkSSSLAh33xt
&item_name=Item 3&test_ipn=1&txn_type=web_accept
&receiver_id=4W89DC8YDWBUG&payment_fee=&mc_currency=GBP&transaction_subject=
&custom=&protection_eligibility=Ineligible&payer_status=verified
&first_name=atest&mc_gross=5.00&payment_date=14:46:44 Aug 05, 2013 PDT
&payment_status=Completed&quantity=1&my-sandbox-merchant-account#test.com
&item_number=3&last_name=buyer&txn_id=91L22343JY671341E&mc_fee=0.40
&resend=true&payment_type=instant¬ify_version=3.7&payer_email=a-test#buyer.com
&receiver_email=my-sandbox-merchant-account#test.com&tax=0.00&residence_country=US
I've tried resending the IPN multiple times, and have also tried the IPN simulator too but this just spins until the connection resets. Is this a problem with Paypal's sandbox IPN system, or have I forgotten something/am sending the wrong data on my form submit?
If it's a problem with the sandbox IPN messaging system, what other options do I have for testing aside from on live?
As above, the solution was to use standard ports (80/443) rather than non-standard 8080/8443
what's the best way to simply get feedback from PayPal to confirm that your customer paid? It looks as if the answer is IPN - if so, my followup question is, can I enable IPN for only specific buttons? I don't want PayPal pinging my IPN listener for purchases that don't require any kind of IPN integration.
I'm all about Agile and YAGNI, and therefore I don't want to do anything that is unnecessary.
You should read the IPN Documentation that have provided by PayPal. To use IPN, the simple way is to have invoice id for a transaction that you want to track. In the IPN listener page, you will get ipn_data and one of the field is the invoice. Using this id, you should get the data from your own transaction database, then change the status to reflect the payment status in PayPal.
In my code, usually I set status to unpaid, direct the user to paypal to do payment, and in IPN listener I will set the status to paid.
PayPal provide sample code so you can start right away. You can also see other PayPal documentation in this page.
You can easily include which IPN listener to use for in a button's parameters.
If you don't have a default location set on PayPal's website, then your IPN listener will only get pinged for those buttons that do have one set.
The PayPal form variable in question is "notify_url".
Here's an example subscription button, same variable for anything else though.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-butcc-subscribe.gif"
border="0" name="submit" alt="PayPal - The safer, easier way to pay online."
onclick="_gaq.push(['_trackEvent', 'Click', 'PayPalMonthSub', 'SubscribePage']);" />
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1"
height="1" />
<input type="hidden" name="cmd" value="_xclick-subscriptions" />
<input type="hidden" name="business" value="paypal#yourdomain.com" />
<input type="hidden" name="item_name" value=" Monthly Subscription" />
<input type="hidden" name="item_number" value="1" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-SubscriptionsBF" />
<input type="hidden" name="a3" value="4.99" />
<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="return" value="http://yourdomain.com/subscribe/thanks.aspx" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="cancel_return" value="http://yourdomain.com/subscribe" />
<input type="hidden" name="notify_url" value="/http://yourdomain.com/IPN.aspx" />
</form>
If you need the default notification url set on your account then you will only be able to stop your handler being pinged by including a different handler in buttons that don't need it. If PayPal doesn't get an HTTP200 from a handler though it will keep trying it so I wouldn't advise setting anything to a non existent URI.