Digital downloads is problematic with paypal standard just because of the way it works
here's the flow with payments standard:
the customer click the checkout button on the cart page when they are done shopping.
the fill in the checkout form, this posts to the confirm page.
When the checkout form is posted to the confirm page, the order information is stored in the database. your orders table should have a status column that is being set to 0 or pending or something similar.
Then customer clicks the confirm button and is taken to the paypal server to arrange the transaction details.
When don with paypal, the customer is directed back to your site.
Here's where things get dicey - At this point, the transaction has not been processed. It is in a queue on paypals servers to be processed on a first come first served basis. The actual processing will take place at a later time.
You can set you paypal account to make an IPN post to a page on your site when the transaction actually gets processed. you can use that page to update the database with the transaction status.
see paypal ipn page for more details:
Once you have the order status being set when the order is stored in the database and updated through the IPN post, you will need to modify the order history recordsets to include a check of the status column in the orders table so that only sucessfull orders will be shown.
From a customer standpoint, Paypal standard is a bad choice when offering digital downloads. Since PayPal standard does not process the transaction in real time, they will be forced to wait on paypal to perform the transaction before they can download.
Paypal Pro, And paypal express checkout will process the transaction in real time and eliminate any waiting inherent in paypal standard.