Just a minor feature request... I do think this change would help clear up confusion about running multiple e-commerce websites on the one allowed IPN url (configurable in a paypal profile).
Paypal allows multiple IPN url's to be used; however, each additional url (beyond the ONE configurable on paypal) must be sent to the paypal payment screen as the variable 'notify_url' (on a per-transaction basis).
I've commented on what the applicable change is to the 4.6 paypal.module here (51181#comment-98406).
It seems like this could be added for 4.7 as well (I guess $base_url wouldn't be used for 4.7?). I suppose an administrative toggle could be included so site admin could decide whether to override the IPN with the variable, but honestly, it seems to me it wouldn't hurt anything to just send the IPN url on a default basis. So what if it's the same one the admin has configured in his/her paypal profile? And if it's different, well then, it lets a drupal user install as many paypal sites as desired without worrying about the limit on configurable IPN url.
Sorry, I'm not skilled enough (yet) to create a patch... but it's just a thought.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | pp-screenshot.png | 19.11 KB | guckie |
Comments
Comment #1
kae commentedguckie, do you have this working? what do you do for the autoreturn field in paypal? as far as i know we can only set one autoreturn url. where do you send your user after their purchase? since this is an issue thread, maybe we should open a new forum thread? thanks, ae
Comment #2
guckie commentedguckie, do you have this working?
If you mean JUST this specific functionality I refer to in my post, then YES. (That doesn't mean e-commerce is completely functional in my setup just yet.) In this post, I explained the changes I made for this to work with release 4.6.
FOR PAYPAL MODULE RELEASE 4.7, do this:
1) FIND this line:
Immediately below, INSERT:
$ipn_url = url('paypal/ipn',null,null,true);2) FIND this line:
'return' => $return_url,Immediately below, INSERT:
'notify_url' => $ipn_url,3) FIND this line:
if ($key == 'return' || $key == 'cancel' || $key == 'notify_url') {REPLACE with:
if ($key == 'return' || $key == 'cancel' || $key == 'notify_url') {what do you do for the autoreturn field in paypal?
I don't do anything for the autoreturn field. It's already been done. See step #2 of the code replacements above? It instructs you to insert the variable 'notify_url' immediately below the line that defines the 'return' variable, which was already in the coding of paypal.module.
as far as i know we can only set one autoreturn url.
This is not true. You can only set one autoreturn in your PayPal profile, but just like the IPN url, you can override the default value you set in your profile on a per-transaction basis by sending the 'return' variable to the paypal payment screen.
where do you send your user after their purchase?
After a purchase, the user gets sent to the return url I specified in 'administer > settings > paypal' on my drupal website. BECAUSE... the value configured there ends up being passed to the paypal payment screen as the variable 'return'.
To see the variables that are being passed to the PayPal payment screen, test checkout on your drupal e-commerce site using a test product (take the test transaction all the way to the point of jumping over from you website to the paypal payment screen). Take note of the URL showing in your browser's address bar (see attached screenshot).
The URL shown in the address bar at that point should be something comparable to this: (I bolded the variable names that were passed by paypal.module, for effect)
https://www.paypal.com/xclick/business=YOUR@PAYPALRECEIVEREMAIL.COM&item_name=YOURDRUPALSITENAME+order+%237+for+testuser&
item_number=txnid_7&amount=1&shipping=0&no_shipping=1&return=http%3A//www.yourdomain.com/drupaldirectory/store/history/3&
notify_url=http%3A//www.yourdomain.com/drupaldirectory/paypal/ipn&cancel=http%3A//www.yourdomain.com/drupaldirectory/node¤cy_code=USD
since this is an issue thread, maybe we should open a new forum thread?
I don't think I see this as an issue thread, since there's nothing buggy about the current implementation of IPN url handling. I think this is a feature request, since it's just a suggestion for better usability.
I'm going to include a couple of suggested reading links, to help clear up what it is this coding change accomplishes.
[PayPal]: "To activate IPN, you can either change a setting in your PayPal Profile or include the notify_url variable in the payment FORMs on your website."
page 28, Order Management Integration Guide
Website Payments Standard Integration Guide
hidden input variables - page 91
return url - page 93
APPENDIX A - BASIC HTML VARIABLES - PAGE 99
One last note: In those PayPal documentation resources, it also explains that for greater security in passing the IPN url variable, a 'shared secret' password can be used. (I don't know the in's-&out's of setting up shared secret yet, but I'll definitely be working through it at some point!)
ae, hope this helps! =)
Comment #3
guckie commentedGrrr! I can't edit.. LOL
Sorry, my previous post should have said:
3) FIND this line:
if ($key == 'return' || $key == 'cancel') {REPLACE with:
if ($key == 'return' || $key == 'cancel' || $key == 'notify_url') {Comment #4
kae commentedguckie, that's a great and very clear explanation. thank you very much! (one of the most clear explanations i've seen on drupal.org) sorry, one naive question: if i have multisites running off one code base, can i just install this one paypal module (without the rest of ecomm) in the module directory of this site? alternatively, can i just install the ecomm suite and no other modules for this site? thank you very much for figuring this out and writing it all down.
Comment #5
sangamreddi commentedYou can install site specefic modules by creating a directory modules in sites/example.com directory. Reffer handbooks for more information.
Comment #6
guckie commentedThank you, ae, for indicating that my post was helpful. For that, I'm glad =)
I'd love to be able to answer your new questions, but to be honest, multisites on one codebase is uncharted territory for me, and I could only guess at answers there. If I can find enough time to do some testing (in-between too many ongoing projects), I'll gladly return to this thread and post what I learn. Chances are, though, that you'll have this figured out before I can get to it!
The one thing I can say that might point you toward something to look at... is that wherever the code for paypal.module is being served from, it's going to formulate the cancel, return, & IPN url's to include the BASE URL of the applicable site. (If that made any sense) I don't know how a multisite (on one codebase) structure will treat this.
In my case, I am installing multiple complete installations of drupal (on various servers, at various IP addresses), using e-commerce (and ONE paypal account) and each one correctly overrides the return, cancel, and IPN (with the modification I posted) URL's appropriately.
Note: I also recommend making this change to the paypal.module to correct the 'cancel_return' variable, as specified in paypal's documentation.
Comment #7
kae commentedthank you. I'm going to reply at node 52705 since what I write is not a feature request.
Comment #8
neclimdulduplicate of #60048(it has a patch)