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.
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
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,
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.