Inconsistent behavior between Sandbox and Production

qnatangi
Contributor
Contributor

We have a Paypal button on our site, but it behaves inconsistently when it is on sandbox vs when it is on production environment.

Specifically, if the return URL contains %23 string:

1. Sandbox gives "Things don’t appear to be working at the moment." error message after logging in with Paypal account.
Sample request:

https://www.sandbox.paypal.com/cgi-bin/webscr
?cmd=_xclick&business=<redacted>
&item_name=Invoice%12345
&item_number=Invoice%12345
&quantity=1
&amount=15.00
&currency_code=USD
&invoice=12345
&custom=12345_%20
&cancel_return=https%3a%2f%2example.com%2fPaypal%2fCancelCallback
&return=https%3a%2f%2fexample.com%2f%23%2fPaypal%2fsuccess
&notify_url=https%3a%2f%2example.com%2fPaypal%2fNotifyCallback

2. Production happily lets the user go through the entire payment process without any issue.

Sample request:

https://www.paypal.com/cgi-bin/webscr
?cmd=_xclick&business=<redacted>
&item_name=Invoice%12345
&item_number=Invoice%12345
&quantity=1
&amount=15.00
&currency_code=USD
&invoice=12345
&custom=12345_%20
&cancel_return=https%3a%2f%2example.com%2fPaypal%2fCancelCallback
&return=https%3a%2f%2fexample.com%2f%23%2fPaypal%2fsuccess
&notify_url=https%3a%2f%2example.com%2fPaypal%2fNotifyCallback

 

Interestingly, I tried removing %23 string from the sandbox link and everything is working just fine too.
Sample request:

https://www.sandbox.paypal.com/cgi-bin/webscr
?cmd=_xclick&business=<redacted>
&item_name=Invoice%12345
&item_number=Invoice%12345
&quantity=1
&amount=15.00
&currency_code=USD
&invoice=12345
&custom=12345_%20
&cancel_return=https%3a%2f%2example.com%2fPaypal%2fCancelCallback
&return=https%3a%2f%2fexample.com%2fPaypal%2fsuccess
&notify_url=https%3a%2f%2example.com%2fPaypal%2fNotifyCallback

 
What is the desired behavior? We're concerned if sandbox behavior is something that will also apply in production in the future. If that's the case, when would that take effective?

Login to Me Too
4 REPLIES 4

MTS_Chiranjeevi
Moderator
Moderator

Good day @qnatangi,

 

Thank you for posting to the PayPal community.

 

HTML URL coding "%23"  defines “#” ASCII Value. 

External guide link - https://www.w3schools.com/tags/ref_urlencode.ASP 

 

I would suggest to please pass the valid format URL format in your button code. 

 

Example : https://example.com/ReturnUrl

 

Sample HTML button code : https://developer.paypal.com/api/nvp-soap/paypal-payments-standard/integration-guide/sample-code-lan... 

 

https://developer.paypal.com/api/nvp-soap/paypal-payments-standard/integration-guide/Appx-websitesta... 

 

Important : PayPal Website Payments Standard (WPS) is a legacy integration. 

 

We recommend merchants to integrate our latest PayPal Checkout (Smart button) product.


Please follow the steps provided in the below detailed guide links : 

 

https://developer.paypal.com/docs/checkout/

 

https://developer.paypal.com/demo/checkout/#/pattern/server 

 

https://developer.paypal.com/integration-builder/ 

 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

qnatangi
Contributor
Contributor

Hello Chiranjeevi,

 

Thanks for the info and the suggestions.


About the # character, we're totally aware of that. We passed %23 to the URL because otherwise it breaks on both sandbox and production! Same for all other non-URL-friendly characters like colons, slashes, etc.

What we really need to know is WHY the behavior is different between sandbox and production. And ultimately how can we make sure sandbox and production behave the same so our tests against sandbox are reliable.


We are aware of WPS being deprecated, and we will have plan to migrate that. However that is a separate topic.

 

Login to Me Too

qnatangi
Contributor
Contributor

Hello @MTS_Chiranjeevi ,
I didn't know that I should tag you so you can get a notification for my comments. Could you please check my previous comment? I would appreciate if we can get a confirmation about the correct and consistent API behavior.
Thank you!

Login to Me Too

MTS_Chiranjeevi
Moderator
Moderator

Hi @qnatangi,

 

If your still facing issue, please create a MTS ticket via - https://www.paypal-support.com/s/?language=en_US  with the detail information and error details.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.