I have set the IPN hook to a PHP script on my site using
https://www.sandbox.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-ipn-notify
I have set a return page at
https://www.sandbox.paypal.com/businessmanage/preferences/website
Neither works. IPN is not called, transaction succeeds, but i am not redirected to "thank you" page.
Could you suggest what is wrong?
The page I use for payments at sandbox:
https://market.snowcron.com/cabinet_paypal.php
This question asks about 2 separate issues
For the IPN issue, check your sandbox IPN history at https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_display-ipns-history , and test your IPN listener using the simulator
As for the redirect URL you have set, this only applies to old-style HTML form payment standard integrations. That setting has absolutely no effect for newer API or JavaScript SDK based integrations. Any redirection you wish to perform should be in the onApprove javascript function.
Related
I'm trying to implement the PayPal checkout server flow described here and I'm a little bit confused about the role of the redirect urls required by the Create Payment REST API
With the PayPal checkout JavaScript components, I need to provide a onAuthorize hook in the JavaScript button initialization code like in the example on the page linked above. My understanding - and I've confirmed this in the sandbox environment - is that this callback gets called after user has successfully authorized the payment on PayPal and in this callback I'm supposed to execute the payment. This part is pretty clear and I've successfully implemented this. The confusion arises from the payload on the PayPal's Create Payment API.
This API expects a required parameter redirect_urls to be provided in the payload. Under this both return_url and cancel_url have to be provided. I understand from the documentation these URLs are where the user will be redirected after successfully authorizing the payment or if they cancel the payment.
In my tests in the sandbox environment, however, the user is never redirected to these redirect urls, as the "return" / "cancel" is handled by the callbacks provided to the button initialization. Now this leads to my question:
Despite this, is there any scenario where the user is redirected to these urls? What should happen if the user is redirected to these urls?
My concern is do I need to duplicate the on authorized / cancelled logic both in the JavaScript code and then upon entering the provided return urls?
The return and cancel url were important in cases where the PayPal experience is not in context (light box ) or if you want to take them to a completely different page once they approve the payment using continue or pay now or if you are using this in a mobile app where the checkout.js won’t work
With the checkout JS integration you don’t really need to pass the url as the experience is in context if that’s what you were trying to ask.
We are using SpiceLogic's BuyNowButton control with dedicated IPN_Notified event handler. Our payment processing logic requires buyer's redirection back to shopper site and we are interested to do it from IPN_Notified event handler after all verification there pass. We have noticed that Server.Transfer doesn't work there (gets suppressed) if you try to run it from inside event handler. Response.Redirect works as expected but raises non-braking exception "Thread was being aborted". Our question is: "Is there any known bad in redirecting buyer from IPN_Notified that way? Will it work in real PayPal environment as it works in our dev environment now?"
IPN happens completely separate from the checkout experience. A redirect will not work there because it's an entirely separate server session / communication. It's not anything happening in the browser.
It sounds like you must be working with PayPal Standard, so if you want the user to be returned to a specific page on your site after checking out with PayPal you can look into setting up Auto-Return in the PayPal account. Even with that enabled, though, there is no guarantee the user will make it back to your site because they could simply close the browser before it redirects.
If you want to guarantee the user always gets back to your site you should move to using the Express Checkout APIs instead of PayPal Standard. It will require more coding skill and working with web services, but it will give you much more freedom to do exactly what you want to do with your user experience.
In the SpiceLogic PayPal Control, the IPN_Notified event is completely a service type event, which is triggered by the PayPal IPN Notification service. The consumer of this event is a backend service from PayPal, not your customer. Your customer will never be redirected anywhere whatever you perform in your IPN_Notified event.
When PayPal IPN service calls your IPN URL, the IPN_Notified event is fired from your SpiceLogic PayPal control. But, PayPal does not care about that. PayPal simply calls that IPN Url and Post transaction data and then returns. So, if you issue a Response. Redirect, it will do nothing to PayPal IPN service. Response. Redirect is an instruction for the Browser, but PayPal IPN service is not a browser which will redirect.
If you want your user to redirect or convey a message, you need to use the PayPal_Returned event from the SpiceLogic PayPal Control.
In order to understand better the IPN and event workflow, please check these images.
I have a situation I am unable to fine the answer. I am using Paypal Express checkout method by simple form method not api . when user/buyer reaches the paypal payment page and after successful payment it give user/buyer two button option ( your paypal account ) - ( return to site) If user returns to site good enough get all the transaction details but incase he does not there is no way to capture the transaction result. Is there a return url that can be specified in the html express checkout method also does it require the seller to enable Ipin in his account or is it enable by default .
My issue is its a thirdparty application where seller adds his paypal account to accept payment but one successful payment it needs to return the website . issue cant ask seller to enable any specific things to his paypal account as if he does or does not there is no way for me to verify while he sets up the account to my service or platform .
You need to be using Instant Payment Notification (IPN) to handle that instead of Payment Data Transfer (PDT). They're essentially the same thing except that PDT only works on the return URL (which isn't guaranteed to get hit as you're finding out) and IPN will be triggered in the background regardless of whether or not the buyer makes it back to your return URL.
You can include the "notify_url" parameter in your HTML form code to pass the URL you'd like the IPN's to get sent to. This will override any setting the merchant might have setup in their own PayPal account.
I was trying to use the express checkout php api. Everything is working well in the sandbox environment. My question is regarding security.
After payment the sample code redirects to GetExpressCheckout.php?token=...$PayerID=.....; But after clicking "confirm payment" in my site and logging in to paypal account (did not confirm payment in paypal); I directly opened the same page in another tab, and it showed payment successful (which is not the case). Is there a way to prevent this or am I missing some thing.
I'm not following exactly what you're trying to say here.
The process needs to be...
1) Call SetExpressCheckout to retrieve your token and redirect to PayPal accordingly.
2) PayPal will return the user back to your ReturnURL if they confirm payment, at which point you can call GetExpressCheckoutDetails (optionally) and DoExpressCheckoutPayment to finalize the payment.
Not until DECP is completed does any transaction actually take place. The success message you're seeing probably came from GetExpressCheckoutDetails, which does nothing more than retrieve the buyer/order info so that you can finalize the payment on your site.
i am trying to implement paypal payment system on my website.
i am kinda stuck at receiving IPNs.
the website is developed in PHP, on ZendFramework and Doctrine 1.2.3
i used the example script located on paypal site for receiving IPNs, however it doesn't work.
for debugging purposes i left on the IPN page code that just inserts a new entry in a table in my mysql db, so every time i load the page, a new entry is inserted in the DB.
i tried again to use Instant Payment Notification (IPN) simulator from PayPal and try to send a new IPN to that page, however nothing is inserted in the DB, so my best guess is somehow paypal can't reach my page, even though it says IPN successfully sent.
the ipn url is something like: http://mydomain.com/shop/paypal/ipn
i finally got it.
as it seems, paypal does not send IPN data to urls like: domain.com/shop/ipn .
i created a separate php file, not related to the framework i use so the ipn url looks like: domain.com/ipn.php . now everything works.
I am getting back with a proper answer.
The reason it didn't work wasn't any paypal ipn url-form restriction.i used Zend_Translate for multilanguage suport and used as default language what the visitor browser was sending me back.problem was when paypal was sending me IPN it did not provide any default language, which generated an exception in my code and an application crash, so no IPN got received.
Furthermore, if anyone needs to have custom URLs in Zend they can use Zend_Controller_Router_Route_Regex, more information here:
http://framework.zend.com/manual/1.10/en/zend.controller.router.html#zend.controller.router.routes.regex