Skip to main content
knackforge blog knowledge base

Drupal Commerce - PayPal payment was successful but order not completed

Most of us use PayPal as a payment gateway for our eCommerce sites. Zero upfront, No maintenance fee, API availability, and documentation makes anyone easy to get started. At times online references offer out-dated documentation or don't apply to us due to account type (Business / Individual), Country of the account holder, etc. We had this tough time when we wanted to set up an Auto return to Drupal website.

DropThemes.in - the exclusive Drupal themes selling marketplace counts on PayPal. We have had complaints from a few users reporting that their payment was successful however unable to download the themes. Upon reviewing manually we found that users had skipped clicking "Return to site" link. This required site administrator to manually complete the order to let users download the theme.

Paypal manual return to site

This has been a common issue for most of us using Drupal Commerce and PayPal as one of the payment gateways. The appropriate fix would be to turn on Auto Return on PayPal account settings. On the "Profile" > "Settings" > "Website Payment Preferences" the following values are recommended.

Auto Return: On
Return URL: http://example.com (your Drupal site)
PayPal Account Optional: On

PayPal Selling tools

 

PayPal Auto Return

Once configured as prescribed in the screenshots above users would be automatically redirected to the Drupal site upon completion of payment. The payment completion page on PayPal would look as below,

PayPal Payment completion page

On the Drupal site, the user would get Order completion page at http://example.com/checkout/[order-id]/complete. The return URL set on PayPal API call takes precedence here which couldn't be noted on any documentation, we had to find this from our trial and error.

Comments

You shouldn't actually require the use of auto return to finalize your orders. That logic should all be taking place when the IPN is received by your site. I'd check your logs to determine if the IPN is in fact being delivered and parsed properly - and then you may need to make sure that the logic granting access to files is responding to the event "When an order is first paid in full." Good luck!

Hello Ryan, Thanks for your reply. PayPal's IPN is getting logged but that doesn't look like an appropriate trigger for Rules invocation. Order id itself is missing in the IPN response data. Independent of these cases I think Auto Return is good to have as most of the payment gateway sites do send the users back to ecommerce site upon payment completion.