31 replies [Last post]
Fred's picture
Offline
Joined: 04/14/2010
Juice: 36
Was this information Helpful?

Is there anyone who has succeeded in making the file download work?

I have found multiple threads, some dating back two or more years, about the problem that orders remain 'pending' after successful payments, which keeps customers from accessing their downloads they have already payed for. I tried all those conditionals suggested, but none of them seems to work, orders still remain 'pending', instead of 'completed' which is required for files to be downloaded.

EDIT:

I just checked the orders, and their balance hasn't changed either (it's not $ 0.00). So, despite the fact, that Ubercart says on returning from Paypal that the order is complete (and the payment is successfully made), it doesn't change the order status.

weavegeek's picture
Offline
Joined: 03/11/2010
Juice: 53
Yes Virginia, File Downloads Can Actually Work

I just went down the same path as you, and now have file downloads working. It took some cleverness with the Conditional Actions (details below.)

The following business logic works for my site (Drupal 6.14 and UC 6.x-2.2) which is using Paypal Web Pro to process paypal and credit cards. It allows file downloads without the duplicate payment emails that can arise from using Paypal. (Which is what all the Paypal goo is about in the first three CA's)

There is no easy way to export CA's (that I know of) so I invented a CA pseudo-code to record the logic in a compact format. Just seeing it all in one place was a big help. (If you have questions about the pseudo code, just ask. I think it's pretty self explanatory.)

Trigger: Customer completes checkout

E-mail admin checkout notification
IF 
	(Payment Method == Paypal AND order status == In Checkout)
	OR
	(Payment Method != Paypal)
THEN 	
	Send an e-mail to the administrator(s)


Decrement stock upon order submission (Order)
IF 
	(Payment Method == Paypal AND order status == In Checkout)
	OR
	(Payment Method != Paypal)
THEN 
	Decrement stock of products in order
	//[admin] Decremented stock upon order submission


E-mail customer checkout notification
IF 
	(Payment Method == Paypal AND order status == In Checkout)
	OR
	(Payment Method != Paypal)
THEN 
	Send an e-mail to the customer



Update order status upon checkout completion with full payment (Order)
IF 
	order balance <= $0 
THEN 
	order status = Completed
	//[admin] Updated order status upon checkout completion with full payment.



Trigger: A payment gets entered for an order

Update order status on full payment (Order)
IF 
	order balance <= $0
	AND	
	order status != Payment Received
THEN 
	order status = Payment Received
	// [admin] Updated order status on full payment.



Trigger: E-mail for granted files 

Notify customer when a file is granted (Order)
IF 
	order status == Completed
THEN
	Send an order email regarding files
	//[admin] Notified customer that a file was granted.




Trigger: Order status gets updated

Renew purchased files (Updated order)
IF 
	order status == Completed
THEN 	
	Update all file expirations for this order
	//[admin] Renewed purchased files


Move payment received to completed (Updated order)
IF 
	order status == Payment received
THEN 
	order status = Completed
	//[admin] Moved from payment received to completed.

Note: All the orders move to completed when the payment is received which is what you want for non-shippable orders. I had stressed for a while that shippable orders (or orders with both shippable and non-shippable components) should not go to Completed until after they shipped. Then I realized that UC makes it easy to look at your orders and see which had shipped (there's a little icon that shows up) so I just let it go and let Paid == Completed. If someone's got a fix for that, I'd be interested in your pseudocode.... ;>

Note: I was only able to get this working after a lot of research (yay forums!), a lot of trial and error, and one instance of someone looking and my CAs and saying: "fix that, right there."

Matthew Krick's picture
Offline
Joined: 04/19/2010
Juice: 4
Re: Yes Virginia, File Downloads Can Actually Work

Thank you so much! This looks like it will fix the issues I'm having!

mennonot's picture
Offline
Joined: 03/05/2010
Juice: 18
Thanks for this list of conditional actions

This problem of how to get the down-loadable files reliably emailed to customers has been plaguing me on and off for months. Your addition of that separate conditional action seems to have worked to get my ubercart system sending the file download notification email to customers.

It also helped to watch this video:

http://blip.tv/file/1757864

especially around 14:30.

mennonot's picture
Offline
Joined: 03/05/2010
Juice: 18
Getting three "File Downloads for Order# "

After sending the above comment I realized that the customer is now getting 3 "File Downloads for Order# " emails. Has anyone else had this problem?

Fred's picture
Offline
Joined: 04/14/2010
Juice: 36
Re: Anyone having working file download?

Thank you. Did it work with sandbox also? Because I had no success with it. But this is probably the lack of IPN support there, as the payments inside sandox also do not change their status. They remain "under payment review" forever.

I tried live too, but unfortunately I only have one Paypal account, and Paypal won't let buying with the sellers account. I have to make another account.

Also, why do you decrement stock? At first, I even didn't have the stock module switched on, as I didn't see it necessary for downloadable stuff.

weavegeek's picture
Offline
Joined: 03/11/2010
Juice: 53
Re: Re: Anyone having working file download?

I did not test this with the Paypal sandbox, I used the Credit Card Test Gateway because it was easier to set up.

I decrement stock because my site sells both downloadable and shippable items. I only track and decrement stock on the shippable items.

For Paypal testing (on live) I had a test item priced at .01 and got volunteer testers from the community to purchase it.

Fred's picture
Offline
Joined: 04/14/2010
Juice: 36
Re: Anyone having working file download?

I made now another account and tried live payments, but they still remain 'pending'.

I tired both IPN off (as Ubercart should be able to make it automatic) and on (with IPN URL as http://mysite.com/paypal/ipn )

The only modifications I made to the CA-s given by weavegeek, is that instead of plain Paypal, I checked the option which includes the cards for the first option, and for the other of the OR condition, the negate (!=), I chose just plain Paypal. I also just let the email to be sent to the administrator and put the decrement into the same predicate. But that couldn't have changed it. Other predicates I entered just as written.
Could it be, that IPN is not working yet?

EDIT: One more question, did you create new predicates, or did you just edit the existing built-in ones?

weavegeek's picture
Offline
Joined: 03/11/2010
Juice: 53
Re: Re: Anyone having working file download?

I created one new predicate (Move payment received to completed), and otherwise edited existing ones.

Fred's picture
Offline
Joined: 04/14/2010
Juice: 36
Re: Re: Re: Anyone having working file download?

I just wanted to tell that your predicates work very well. What other obstacle I had, was that somehow when playing with Paypal sandbox, the .htaccess file became corrupted. I changed it and now everything works.
Thanks again!!

weavegeek's picture
Offline
Joined: 03/11/2010
Juice: 53
Just curious...

I'm just curious, what got corrupted in .htaccess, and how did you fix it?

Fred's picture
Offline
Joined: 04/14/2010
Juice: 36
Re: Just curious...

Fixing it was easy, I just copied one from another Drupal site (closing www redirect first). What was wrong, I do not know exactly, as I just tried this, without first looking the .htaccess file. But I think it may be replicated by going to Sandbox->Test Tools->IPN Simulator and sending it out. As for me, I had enough of Sandbox, I now do my testing live. One cent is not that big amount to use for a test transaction.

Rob B's picture
Offline
Joined: 02/12/2010
Juice: 33
Re: Anyone having working file download?

Thanks a lot for this schema, managed to get it to work with normal credit card payments by leaving out the first few steps. What a relief!

I'm having a little trouble because the site I am working on has two types of payments, and the other one is to pay by purchase order, where people are invoiced rather than paying up front. The problem I am having is that now when I manually change the order status to Completed, it is no longer sending out the File Downloads email automatically. Is there an additional condition I can use to send the email with the File details when I change the status myself? Any help would be greatly appreciated.

weavegeek's picture
Offline
Joined: 03/11/2010
Juice: 53
Re: Re: Anyone having working file download?

I would like to know the answer to Rob B's question too. With the schema above, when I change the order status manually (say if the customer is paying by check) the file download does not get sent.

weavegeek's picture
Offline
Joined: 03/11/2010
Juice: 53
Mulitple emails

I did have to modify the above a bit to avoid multiple emails. Mostly it was working around all the various ways Paypal could return state.

An "email notification send" flag that the CAs could check against would be very handy.

I'd love to see an "invoice email sent" as well as a "file notification email sent" flag. Would make my CAs a lot more robust and cleaner.

Just sayin...

mennonot's picture
Offline
Joined: 03/05/2010
Juice: 18
Any specific hints on how to eliminate multiple emails?

Weavegeek,

I'll second the suggestion of some way to check if notification email has been sent out. What I was thinking of was an additional state that a order could have beyond completed, like "Completed and files sent".

Could be more specific about how you modified your CAs to get rid of multiple emails? I'm just learning my way around CAs and I'm not clear on how to differentiate between different ways that Paypal might return state..

gjmokcb's picture
Offline
Uber Donor
Joined: 11/17/2008
Juice: 60
Multiple e-mails

A million thanks to weavegeek. Seems like the final "payment received == completed" does the trick. But I'm getting four (count 'em, four) file download e-mails. I've tried several techniques to get around it, without results. If weavegeek (or anyone else) has a solution, I'd love to hear about it.

gjmokcb's picture
Offline
Uber Donor
Joined: 11/17/2008
Juice: 60
multiple download e-mails

First update. Reduced e-mails from four to two as follows:

1. Revise "Update order status on full payment": add condition order status not "completed"

2. Disable "Update order status upon checkout completion with full payment"

gjmokcb's picture
Offline
Uber Donor
Joined: 11/17/2008
Juice: 60
multiple download e-mails

Predicate weights are not critical in most areas of the sequence, but it is critical that "Move payment received to completed (Updated order)" be given a higher (heavier) predicate weight so that it fires after "Renew purchased files (Updated order)." That setting, together with the changes mentioned in my other reply to myself, results in a single file download e-mail. At least for me. At least for today. Hmm, have I tested it for anonymous users? Nope.

gjmokcb's picture
Offline
Uber Donor
Joined: 11/17/2008
Juice: 60
anonymous file download

Digital downloads for anonymous users are an important feature for Ubercart. It is not easy to figure out how to make them work, but they do work, at least in my environment.

I use use only PayPal for a payment method (avoiding the need for an SSL certificate, a merchant account, and a gateway) and I sell only to anonymous users (I don’t need customer accounts, and I do not have enough repeat business for an account to be of use to customers) . One interesting consequence is that a customer can purchase a digital product by giving me only their e-mail address; all other information is collected by PayPal.

The settings provided below work for anonymous users and registered users. They do not send multiple download e-mails or multiple transaction notifications (at least in my environment). Because I accept only PayPal payments, my actions for the “customer completes checkout” trigger do not have the payment-type IF/THEN statements used by weavegeek.

I am somewhat embarrassed to admit that getting these settings figured out required three days and no less than 96 iterations; 96 test transactions through PayPal. They vary from weavegeek’s solutions in several ways; some of those changes involved careful analysis; some involved dumb luck. The dumb luck factor is necessary because the behavior of various conditional actions is dictated by module code that is not obvious on the surface of the conditional actions. My goal was to get a working structure without hacking module code.

Here is the setup that works for me:

TRIGGER: A PAYMENT GETS ENTERED FOR AN ORDER.

Update Order Status on full payment: Disabled.

TRIGGER: CUSTOMER COMPLETES CHECKOUT

E-mail admin checkout notification: Weight = 0. IF order status == “in checkout” THEN e-mail an admin order invoice.

E-mail customer checkout notification: Weight = 0. IF order status == “in checkout” THEN e-mail a customer order invoice.

Update order status upon checkout completion with full payment: Weight = 1. IF order balance <= 0 THEN update order status to “completed”

TRIGGER: E-MAIL FOR GRANTED FILES

Notify customer when a file is granted: Weight = 0. IF order status != “completed” THEN send an order e-mail regarding files.

[Note: the above setting is counterintuitive. There are three more logical settings: (1) IF order status == “completed”; (2) IF order status == “in checkout”; or (3) no IF/THEN setting. All three more-logical settings display an “unable to send e-mail” error to the customer (probably due to the customer status being returned to “anonymous” after transaction completion) or send duplicate download e-mails, or throw the e-mail error and send duplicate e-mails. Also counterintuitive is that the preferred setting does not send the granted file e-mail prematurely before payment (nor are the two checkout notifications sent prematurely); that appears to be because the “in checkout” status is set by PayPal after payment.]

TRIGGER: ORDER STATUS GETS UPDATED

Move payment received to completed (updated order): Disabled.

[Note: the above action was central to weavegeek’s solution; the flow of order status has been changed in my approach, making this action unnecessary.]

Renew purchased files (updated order): Weight = 0. IF order status (updated order) = “completed” THEN update all file expirations for this order (original order).

[Note: above, another counterintuitive point—update file expirations for the original order, not the updated order.]

Good luck with this. I hope it works for you.

valante's picture
Offline
Joined: 08/01/2010
Juice: 7
Re: anonymous file download

Your solution is completely arbitrary and makes no sense . . .

. . . And it just saved my butt. Thanks! I admire your methodical work.

Best,
Tal

DFragmentor's picture
Offline
Joined: 06/03/2010
Juice: 3
Weird issue

So here is a weird issue, When I have a file download priced at .01 pennies, the order will be set at completed and my download will be ready. BUT when the cost is $10, or $1, the order stays in pending. What is the deal with that?

svogel's picture
Offline
Joined: 06/18/2010
Juice: 9
Lots of trouble

Somehow this process haunts me Smiling

I first checked the process with "bank transfer", setting the order-status manually to "payment received".
With the additional "conditional action" from Cathey (http://blip.tv/file/1757864) "Move payment received to completed" it worked. The status gets automatically set to "completed"
Only I got 2 notification-mails send-out.

I changed the "Move payment received to completed" action to set the new status for the "original order" (instead of "updated order") and now I get exactly one email.
NICE!

Now I tried the Paypal-Payment after some issues (e.g. i had secured my site with a .htaccess-password) I now got the order automatically go to the state "Complete". Very fine!

But in case of payment via paypal the notification email is not sent.
Do I have to make changes in the conditions of "Notify customer when a file is granted"??

Edit: What's interesting: although in the admin-comments the action "Notify customer when a file is granted" has left a comment, no email was sent.
Using Paypal-Express didn't even leave that "notify customer"-comment ...

This is really annoying.

jones's picture
Offline
Joined: 06/28/2010
Juice: 7
File download for anonymous users

First of all thanks for your suggestions. The article helped me to get it to work but...

If a user is logged in and orders a product, then the mail with the files to download is sent. So good so far.

But in my scenario it is possible that someone is not registered but then orders a product. In such a case the order will be associated with an account (provided that the entered email-address matches an account) or a new account will be created. But in this case only the email with the general order information is sent but the email with the downloads is missing. Even if the user logs in then there are no files listed. If I now repeat the order (as logged-in user) then it works again.

Has anyone a solution for my problem?
Sorry for my english, not my nativ language.

Thanks
Jones

enlighten_me's picture
Offline
Joined: 04/25/2008
Juice: 83
Re: Anyone having working file download?

I'm having a similar situation but something's off. Also using Paypal Website Payments Pro.

If a customer pays with Paypal, everything works OK

If a customer pays with credit card, though processed with Paypal, even though the status is set to Completed from Payment Received, the files downloads are not granted automatically.

Any suggestions?

Rob B's picture
Offline
Joined: 02/12/2010
Juice: 33
Re: Anyone having working file download?

Any luck getting the generated e-mail to send when an order's status is changed manually?

I'm also having another issue where we get some people paying by fax. Is there an easier way than generating an order for them, and having them log into their user section? Perhaps some way where I could automatically generate the download link for a file, or generate the email when I've manually created the order.

Rob B's picture
Offline
Joined: 02/12/2010
Juice: 33
Rob B wrote: Any luck getting
Rob B wrote:

Any luck getting the generated e-mail to send when an order's status is changed manually?

Ok I've managed to get it to work by changing the Conditional Action "Notify customer when a file is granted" - I made it so that the condition "Check the order status" is "In checkout", with the "Negate this condition" checkbox ticked.

Probably not the best way of doing it, but now when I manually update an order from Pending to Completed, it sends off the email.

cosmomill's picture
Offline
Joined: 11/06/2010
Juice: 3
Duplicate messages

I also followed the instructions from Cathey's (http://blip.tv/file/1757864) screencast on a fresh Drupal 6.20-dev / Ubercart 6.x-2.x-dev installation. Everything worked flawlessly except the email notification. I run into the same problem like other people in this thread. The customer is getting two "File Downloads for Order# ..." and "Your Order at ..." emails.
I found the reason for this misbehaviour. If you use "PayPal Website Payments Standard" as payment method the trigger "Customer completes checkout" is fired twice. The first time it get fired if you hit the "Pay Now" button after you have logged into Paypal. The second time it get fired if you hit the "Return to Merchant" button. This must be a bug. Until now I have no time to test it with "PayPal Express Checkout" as payment method.
I use the following workaround to get rid of this misbehavior.
Edit all predicates for the trigger "Customer completes checkout" or at least "E-mail customer checkout notification" and "Update order status upon checkout completion with full payment" to avoid sending duplicate messages to the customer.
Add condition "Check the order status" NOT "Completed".

Now, a second handy hint.
If you use other payment methodes, too. Please edit the "move payment received to completed" predicate and add condition "Check the payment method" IS "PayPal"

I hope it helps somebody.

Bye
Rene

Gigi's picture
Offline
Joined: 12/22/2010
Juice: 12
Re: Anyone having working file download?

Wow this should not be an issue! After customizing my shop and getting everything else up and running I go to test the functionality of the file downloads by buying a file using PayPal Sandbox and the file isn't even listed under downloads and it's NOT sent in the Email either.

Why include a feature that doesn't even work correctly? What are the steps to get this to work? Please include it in the official instructions/read me file so we don't have to thumb through Google and endless forum threads to see that there is a problem. If this software has been released, there should be no troubleshooting involved for its' list of working features.

I enabled file download and have the proper permissions set. That should be all I have to do.

THANK YOU

rks_213's picture
Offline
Joined: 01/16/2011
Juice: 183
@Gigi I agree. If file

@Gigi

I agree. If file downloads are enabled then it's obvious you want a customer to get a notification that their file is ready to be downloaded.

If someone can post a good implementation of NOT having their emails sent, please let me know and I will retract my statement. However, until then, UC should already have this working out of the box instead of requiring you to go through all this work and testing to make it happen.

ajsoles's picture
Offline
Joined: 01/11/2011
Juice: 8
Unable to finish Paypal Order

Everything is fine until I try to return after the payment is made.
This is what I get as an error message. "EntityMetadataWrapperException: Unknown data property order_total. in EntityStructureWrapper->getPropertyInfo() (line 294 of /Users/arthursoles/Documents/drupal/drupal-7.0-travelguide/sites/all/modules/entity/includes/entity.wrapper.inc)."
Any help on this. Am using Drupal 7 to a Acguia Drupal Stack and PayPal Sandbox.
Art

j0rd's picture
Offline
Getting busy with the Ubercode.
Joined: 07/16/2008
Juice: 453
Re: Anyone having working file download?

I've explained some issues related to Ubercart, Anonymous Checkout & UC File purchases here:

http://drupal.org/node/1227076

--
Ubercart & Drupal Commerce Theme Development