I'm testing my website with the Paypal Sandbox.
The website gives users the option set up a subscription.
My problem is that the user interface at PayPal is different for subscription and non-subscription purchases.
Specifically, the problem is that with subscription purchases, there is no way for the user to return to the website. Because of this, the order is not recorded in the website. However the subscription setup and first payment are showing up successfully in the sandbox merchant's paypal account.
Here's the page we encounter after making a subscription purchase. The interface looks old compared to the interface we get usually. And the user doesn't have a way of going back to the vendor's website.
The post variables I am sending to PayPal are as follows.
cmd:_xclick-subscriptions
upload:1
business:[email protected]
notify_url:http://my-drupal-website.org/commerce_paypal/ipn/paypal_wps%7Ccommerce_payment_paypal_wps
charset:utf-8
no_note:1
no_shipping:1
cancel_return:http://my-drupal-website.org/checkout/7/payment/back/5MZYFfEjBiGmPKZN7wYTLF448-QjqVR033ZPD3ayJo8
return:http://my-drupal-website.org/checkout/7/payment/return/5MZYFfEjBiGmPKZN7wYTLF448-QjqVR033ZPD3ayJo8
rm:2
paymentaction:sale
currency_code:EUR
lc:US
invoice:7-1386345451
amount_1:39.68
item_name_1:Order 7 at My-Shop-Name
on0_1:Product count
os0_1:12
form_build_id:form-Gq9gM9dXCKx2YMGmtMbR9QnkHx3qiPr9WJIlOYIc3cM
form_token:sRG6zDlzzSAKPD2gm6wvUIvIy0hDFGxfetiX9mRHBX8
form_id:commerce_checkout_form_payment
item_name:My-Shop-Name Subscription
a3:39.68
p3:1
t3:W
src:1
sra:1
It works find if I purchase a non-recurring item (an item which is not part of a subscription).
With these normal purchases I get the more up-to-date PayPal interface.
For completeness, here are the form variables for a non-subscription purchase.
cmd:_cart
upload:1
business:[email protected]
notify_url:http://my-drupal-website.com/commerce_paypal/ipn/paypal_wps%7Ccommerce_payment_paypal_wps
charset:utf-8
no_note:1
no_shipping:1
cancel_return:http://my-drupal-website.com/checkout/12/payment/back/zCjHwDIsRje05kl-SVCr6BiYAIvg5VzacJzIWOTua6E
return:http://my-drupal-website.com/checkout/12/payment/return/zCjHwDIsRje05kl-SVCr6BiYAIvg5VzacJzIWOTua6E
rm:2
paymentaction:sale
currency_code:EUR
lc:US
invoice:12-1386669511
amount_1:11.99
item_name_1:Order 12 at my-web-shop
on0_1:Product count
os0_1:1
form_build_id:form-aOlePcx9lSdAhlojQxLFLw5KOGyh0KJZ8foGj0n1BAg
form_token:sRG6zDlzzSAKPD2gm6wvUIvIy0hDFGxfetiX9mRHBX8
form_id:commerce_checkout_form_payment
OK. Big Egg on Face Moment. Repeat 1 million times: underscores in urls are EVIL.
I had an underscore in the URL of the website I was using to test.
The URL of the website was something like this: my_branch.stage.company.com
I removed the underscore from the website URL and now the "Return to Business One's Test Store" button appears bottom right after a subscription purchase in PayPal.
What still remains unexplained is why an underscore in the url is no problem for a non-subscription purchase. Or, why the UI for subscriptions is so different from the standard UI.