Paypal return URL

Posts: 2
Joined: 01/23/2008

Hello-

I've been working on using paypal for purchasing products on my website. Evevrything is working smoothly until after the user pays. After payment, the user is redirected back to the shopping cart. I've used this url and followed the directions step-by-step: http://www.ubercart.org/docs/user/539/configuring_paypal_web_payments_st...

I was hoping to have the user taken to the default completion page where they receive the following information:

Thank you for shopping at !site. A new account has been created for you here that you may use to view your current order status.

Click here to login to your new account using the following information:

Username: !new_username
Password: !new_password

Am I missing a step somewhere? I've changed the 'yoursite.com' information to match my address in the instructions. Thanks for your time and developing this module!

Posts: 2
Joined: 01/23/2008

Does having clean urls disabled effect this return url in the documentation? http://www.mysite.com/uc_paypal/wps/complete

Actually, I turned clean urls on, tested and had the same problem. I'm still redirected to the shopping cart after payment. this is kicking my butt.

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

glock, not sure if you're running the latest code or not but this seems to be testing fine in the Livetest. What may be the cause is that you actually shouldn't set a specific return URL in your PayPal account at all. Ubercart passes in the appropriate address and will take clean URLs into account. That document you mentioned was user submitted a while back and may have errors or outdated info in it... Sad

Posts: 62
Joined: 08/31/2007
Bug Finder

I am also hardly bitten by this bug Sad

Posts: 68
Joined: 01/19/2008
Uber Donor

i have the same problem and i have tried this with fresh installs (latest code) on 2 different servers with the same results.

using sandbox, i checkout, go through paypal but i get returned to the cart page. the file download does show up on my accounts page and i do get the confirmation with the link to the download.

i always get directed back to the cart page showing the item still in the cart.

i do not have a return address set in paypal.

i hired a ubercart specialist to try and figure this out and we wasted a lot of time but it looks like a bug maybe?

Posts: 62
Joined: 08/31/2007
Bug Finder

@ yosemite1

I am also suffering badly by that bug,
I suggest to downgrade ubercart to an older version.

@ glock

Please kindly move this thread to "Bug Reports" topic.
This is surely a bug, not a configuration problem.
Where you able to find a work around?

Posts: 68
Joined: 01/19/2008
Uber Donor

i wiped out my fresh install of drupal 5.7 and ubercart beta 4 and did a fresh install of drupal 5.7 and ubercart beta 2 on a lunar pages hosted accnt

i set up a test download product, checked out through paypal sandbox, completed payment and once again i am brought back to the shopping cart page which shows the file in the cart.

if i go to my accnt the file is there for download and i get the email notification.

i have workflow_ng set to:
Update order status on full payment
check order balance> Balance is less than or equal to $0.00.
action> order to completed

i see that their is a lot of discussion on this issue in previous posts and there may be some work around by modifying some code but if there is update on the uc_paypal module you may be back to where you were.

Posts: 68
Joined: 01/19/2008
Uber Donor

this problem is somehow tied to attributes

when i do a live test with a product set up for just a download and the download/model sku associated to ANY the transaction completes ok and i am returned to the completed page

when i associate the file download to a attribute and choose that at the product/features/download/model sku (File Download) i am returned to the cart page

both instances show file in accnt file download area and both get email notifications

edit
-----------------------------------

i tried again and the 1st time it worked with just a standard download and i am returned to the completed page

tried attribute download and i was returned to cart

tried one more time on standard sku(ANY)download, no attribute, and was returned to the cart page

Posts: 62
Joined: 08/31/2007
Bug Finder

yosemite1 wrote:
this problem is somehow tied to attributes

when i do a live test with a product set up for just a download and the download/model sku associated to ANY the transaction completes ok and i am returned to the completed page

when i associate the file download to a attribute and choose that at the product/features/download/model sku (File Download) i am returned to the cart page

both instances show file in accnt file download area and both get email notifications

edit
-----------------------------------

i tried again and the 1st time it worked with just a standard download and i am returned to the completed page

tried attribute download and i was returned to cart

tried one more time on standard sku(ANY)download, no attribute, and was returned to the cart page

Sad to know that this problem occurs in fresh installs too Sad

Disappointing to hear that we are still not able to find a hint on cause of this problem. Sad

Ryan can involve a little deeper in this problem, and ask us to try some techniques such as adding echo statements in certain php files or ask us to watch out for certain events in server logs or suggest to diagnose this problem using firebug (extension for firefox) to find the cause of this problem,
But he is reluctant in helping us in this problem Sad

Posts: 5
Joined: 01/07/2008

I've been having this problem with the return url. If this is a bug then I guess I'll just have to be more patient with it, but if there is something I can change (my coding skills aren't too strong) then I'd appreciate the help.

I had this problem before I upgraded to beta 3 (which I love, by the way), when I was running alpha 8. I did a clean install into a new directory and updated everything to the latest version in the hopes that it would help. It did make it a little easier for me to fix the other problems I had been having, but this one has persisted.

In both sandbox and in a live test I just ran, once the transaction has been completed, if I press the button to return to the merchant site it brings me back to the shopping cart. The items are also still in the shopping cart. I have just been using WPS with paypal. At first I thought there might have been something in workflow I could set up, but it didn't look like it had any conditions or actions that would apply to this situation.

I'm flummoxed.

I may have left some of the details out of this, I'm trying to remember anything else that might be important. Nothing else is coming to mind at the moment. At this point maybe I just need to stop looking at it for a few hours (long enough to get some sleep)...

Oh, right. I have also already checked out my paypal settings for a default completion page. I had never set one. I still haven't as per your suggestions. I have tried to see if it was an attributes issue, but that doesn't seem to be the case with my problem. Pretty much everything on the site works except for the cart not being emptied when the order is submitted.

Any help you can throw my (our) way would be appreciated.

Posts: 68
Joined: 01/19/2008
Uber Donor

another fresh install with the latest code and another day chasing down this problem of having paypal return me to the cart.

i was hoping to set up a new site selling photos as prints and downloads and ubercart looked very promising but i am giving up and continuing on with my old working zen cart site.

thank you for the help and i will check back to see if this gets resolved.

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

raddy wrote:
But he is reluctant in helping us in this problem Sad

Just let me digress a moment to say that this is not true, and I'll appreciate no further assumptions like this. I'm not upset or anything, but I don't want that sort of image to be tossed around while I'm busy fixing bugs and developing features elsewhere in the code.

The issue here w/ PayPal is complex, and since I can't reproduce it it's hard for me to fix. None of the information provided so far has given me a good lead to track down the issue. Just so we're all clear on the issue, this is not a problem with Ubercart failing to recognize PayPal payment or complete an order. As was pointed out, orders are actually being completed. This is because we rely on the PayPal IPN payment to know when payment has actually been submitted, and when that happens we submit the order.

The real issue is whether or not a proper return address is being recognized. When this works properly, it is because the address PayPal sends you back to gets recognized by Drupal and through that it clears out the cart contents and sets the appropriate variable to send you to the checkout completion page. If this gets missed, then you will be sent back to the cart page because of the way Drupal is resolving the URL.

So, all this involves the way Drupal works... it defines "URLs" on the fly for each page load. If it can't find the exact one you request, it goes down the line until it finds the closest match. That's how you end up at the cart page. Because of these things, it seems to me that the thing about an attribute is coincidental and not the root issue. I'll look at the code and see if it's something to do with Workflow-ng, but there again I'm skeptical. It's an issue with the way the URLs are being defined, and I don't really know how to best get to the bottom of it. Just know that it's in the issue queue and has been for a while, there just hasn't been a readily available fix or investigation method.

Posts: 14
Joined: 02/01/2008

Maybe I can help.

My url is clean Smiling but I have the same problem. After payment, the user is redirected back to the shopping cart.

I disable Calculate shipping cost and anonymous checkout.

1) I set in user management > user settings > Only site administrators can create new user accounts.
and the problem was fixed. I can see the complete page!

2) if I set Visitors can create accounts and no administrator approval is required I'll see this problem again. Require e-mail verification when a visitor creates an account - enable.

3) Visitors can create accounts but administrator approval is required. - no problem.

4) New user registration by invitation only. - I don't test it.

Drupal, last ver of Ubercart and I have i18n module. so my urls looks like
http://site/en/admin/user/settings
http://site/en/catalog

unfortunately my site settings is Visitors can create accounts and no administrator approval is required... Sad

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I'm still not sure if that gets at the issue or not. I think I may have solved the problem, but it will require the folks having troubles to test. The issue is that it had a hardcoded check on the order status, and so if your site was configured to do something different with orders it would fail on the return. Open up uc_paypal.module and change the function uc_paypal_complete() around line 693 to look like the following:

<?php
function uc_paypal_complete($order_id = 0) {
  if (
intval($_SESSION['cart_order']) != $order_id) {
   
$_SESSION['cart_order'] = $order_id;
  }

  if (!(
$order = uc_order_load($order_id))) {
   
drupal_goto('cart');
  }

 
// This lets us know it's a legitimate access of the complete page.
 
$_SESSION['do_complete'] = TRUE;

 
drupal_goto('cart/checkout/complete');
}
?>

Posts: 68
Joined: 01/19/2008
Uber Donor

hi ryan,

thank you for reply and i totally appreciate all your hard work and know how busy you must be working on this great project.

when i get a chance i will try to modify the code, the option of requiring admin approval would not work for me as i want to sell down loadable photos and most folks would want it immediately.

if you want i can give you full access to my test site to see if you can chase down the problem.

cf

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Yeah, I don't think the administrator approval thing directly relates to the issue, because Ubercart manually makes new users and does not rely on the normal account creation process. Perhaps that is a separate issue that needs to be addressed, but this fix above should nail it for you.

Posts: 5
Joined: 01/07/2008

Ryan, you are the man. I plugged that code in over the original uc_paypal_complete function (minus the php tag) and it did the charm.

I think that's actually the last problem that I had with my shop. Wow, I'm ecstatic.

Just to explain a little further the problem (now that it's gone), I had continued to try different auto return settings in paypal, but you were right. If things are working properly, you won't need it. At checkout I've checked the code before submitting an order, and it showed the return url as being site.com/uc_paypal/wps/complete (with the order number added). when clicking the button to return to my site after submitting payment, that is the address it goes to. But then my site couldn't make use of that so it would bring me to the cart. The issue was with how ubercart was handling the return as it was received. And this fixed that.

Thanks a bunch
cassidy

Posts: 62
Joined: 08/31/2007
Bug Finder

Hi Ryan

Thank you for your swift response and fix,
The fix worked great in my end.
I would have also felt ecstatic if the following problem didn't arise,

Basically the customer is successfully taken to Order completion page Smiling .
But the order is marked as pending instead of Payment Received.

Additional information,

Workflow-NG configuration.

Check the order balance : Balance is less than or equal to $0.00.
Update the order status : Payment received.

IPN Debug information

IPN transaction verified.

Receiving IPN at URL for order 102.

Array
(
    [mc_gross] => 2.00
    [invoice] => 102
    [item_number1] => paypaltesting
    [payer_id] => Alphanumeric code.
    [tax] => 0.00
    [payment_date] => 22:03:35 Feb 04, 2008 PST
    [payment_status] => Completed
    [charset] => windows-1252
    [mc_shipping] => 0.00
    [mc_handling] => 0.00
    [first_name] => (First name)
    [mc_fee] => 0.38
    [notify_version] => 2.4
    [custom] =>
    [payer_status] => unverified
    [business] => business email address
    [num_cart_items] => 1
    [mc_handling1] => 0.00
    [verify_sign] => Alphanumeric code
    [payer_email] => Payer email address
    [mc_shipping1] => 0.00
    [tax1] => 0.00
    [txn_id] => Transaction ID
    [payment_type] => instant
    [last_name] => Last name
    [item_name1] => Paypal testing
    [receiver_email] => same as business email address
    [payment_fee] => 0.38
    [quantity1] => 1
    [receiver_id] => Alphanumeric code
    [txn_type] => cart
    [mc_gross_1] => 2.00
    [mc_currency] => USD
    [residence_country] => US
    [payment_gross] => 2.00
)

From store administration page.

Admin comments shows the following,

02/05/2008
11:33:42 AM - PayPal IPN reported a payment of 2.00 USD.
02/05/2008
11:34:01 AM - Order created through website.

Payments tab

02/05/2008
11:31:18 1 PayPal -$2.00 $2.00 PayPal transaction ID:

So everything seems right, but the order is marked as Pending,

I hope cassidy would also experience this problem.

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

raddy, this sounds like a separate issue that was solved last month. What version of the code are you running on?

Posts: 62
Joined: 08/31/2007
Bug Finder

Ryan wrote:
raddy, this sounds like a separate issue that was solved last month. What version of the code are you running on?

I am running Ubercart 1.0 Beta4

Posts: 68
Joined: 01/19/2008
Uber Donor

hey ryan

i have tried that code on my live site(download only) and it seems to work, i am returned to the payment completed page as it should be.

i will try it next on my test site that has the latest beta and with multiple attributes set. download and shipping

thank you for all your hard work.

Posts: 62
Joined: 08/31/2007
Bug Finder

@ yosemite1

Is the order states marked as "Payment Received" in your end?
In my end, it is getting marked as "Pending" . Sad

Please see my above post for detailed information.

Posts: 5
Joined: 02/07/2008

I'm a bit late to the conversation, but having the same issue. I applied the patch above and corrected the URL problem, but the orders are remaining marked as pending ...

Just thought I'd jump in. I'm new to Ubercart, but love what I see so far. Keep up the good work.

Posts: 14
Joined: 02/01/2008

After unsuccessful payment status order is pending too. Do I have to change status manually ? or Do I have to configure workflow-ng ?

I went to workflow-ng and there were intresting lebel: the Update order status on full payment + action Update the order status -> Pending. But it's disabled by default.

Any information will be helpful.

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Enabling the default configuration will update an order's status when a payment actually gets entered for an order. For an unsuccessful payment, it won't do anything.

Posts: 14
Joined: 02/01/2008

I'm about changing pending status to completed status.
I read http://www.ubercart.org/docs/developer/920/order_states_and_statuses
When a customer completes checkout, the order gets moved from the default in_checkout status to the default status for the post_checkout state. (By default, this is "Pending.")

1) So I think default status pending is correct. Am I right ?
2) I want changing status to complete automatic.

I don't understand meaning of "Update order status on full payment" in workflow and it's disabled by default.

I setup my workflow:
event: Customer completes checkout
Conditions: Check the order balance - Balance is greater than $0.00.
actions: Update the order status - order: completed

but after payments status order is still pending...
I'm lost.

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Because you're backwards. A balance grater than $0.00 means they haven't paid yet. Set it to less than or equal $0.00. That's what the default configuration does.

Posts: 68
Joined: 01/19/2008
Uber Donor

i have a fresh install of drupal 5.7 and the latest uc from http://bazaar.ubercart.org/drupal5/, installed the uc_paypal module script provided by ryan (above) and it all works fine

glock to get this download thing working make sure you have the fix installed and then make sure:

You must have the following modules installed and activated:
File Downloads
Notify
Workflow-ng UI
Workflow-ng

Set the following conditions to enable a purchased file download.

drupal/admin/users mang/access control/anonymous > uc_file module/download file enabled for registered users

drupal/admin/build/workflow-ng setup a configuration to condition> check order balance= Balance is less than or equal to $0.00. and i have another condition set on mine to> check the order payment method set to paypal (not sure if this is needed?)
ACTION> update the order status, order status set to completed

Store administration/products/product/ edit/ features/ There is a tab called “Features” at the top, enable file download.

Store admin/config/notification setting/checkout notifications Set to “Send order confirmation e-mails to customers after checkout.”

store admin/notification setting/edit(top)/file download “send email to customer with file download link(s) “ checked

store admin/config/products settings/edit (at top)/product features and set up the “file download settings” and make sure order status is completed

over at your paypal have this set;
a) Click on "Website Payment Preferences" under the "Selling
Preferences" section:
b) Enable "Auto Return"
c) Set the "Return URL" to
http://www.yoursite.com/uc_paypal/wps/complete (be sure to fill in
"your site domain appropriately")

---------------------------------

hey ryan,

will future releases have the corrected script in the uc_paypal module?

Posts: 86
Joined: 02/06/2008

Just piping in and wondering if this was fixed in The latest release (alpha9) ?

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

All fixes make it into the next release... this one is in beta 5 which just got posted. Cool

Posts: 14
Joined: 02/01/2008

over at your paypal have this set;
a) Click on "Website Payment Preferences" under the "Selling
Preferences" section:
b) Enable "Auto Return"
c) Set the "Return URL" to
http://www.yoursite.com/uc_paypal/wps/complete (be sure to fill in
"your site domain appropriately")

1) I'm sorry for my question. Where is "Selling Preferences" section ?
I can't enable "Auto Return" Sad

Beta4, I changed the function uc_paypal_complete() around line 693, and setup workflow. After payment I got "you cart is empty".

New information!
I disable i18n module and now everything fine. But I must have i18n.

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Interesting... I haven't used the i18n module, so I'm not really sure why it would be causing a problem like that. It shouldn't even be affecting the WPS form.

Posts: 14
Joined: 02/01/2008

maybe because He works with url
before i18n http://site/catalog
after enable i18n http://site/en/catalog

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Seems like this should be taken care of through the i18n issue tracker. I found a similar issue here that you can watch/contribute to.