Search code examples
htmlpaypalpaypal-sandboxpaypal-subscriptions

Paypal Sandbox Subscription Button 400 Error


I am facing a weird issue with PayPal sandbox. I am trying to create a subscription button from https://sandbox.paypal.com/buttons but it's not working!

Here is the code that page generates.

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
    <input type="hidden" name="cmd" value="_s-xclick" />
    <input type="hidden" name="hosted_button_id" value="F7H82MZZ8PFKL" />
    <input type="hidden" name="currency_code" value="USD" />
    <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Subscribe" />
  </form>

Here is the output in the console:

early_flush_waiting_for_second_chunk 
Object
client_elapsed
: 
3
event
: 
"early_flush_waiting_for_second_chunk"
level
: 
"info"
pageID
: 
25
req_elapsed
: 
1220
state
: 
"pre_bootstrap"
timestamp
: 
"1691655080674"
[[Prototype]]
: 
Object
ngrlCaptcha.min.js:1 
        
        
        POST https://www.sandbox.paypal.com/webapps/billing/api/billagmt/undefined/createCart 400

I have tried everything and went thru various forums, but nothing seems to be working. I have tried other buttons (Buy Now) and they are working fine. The button nor the email link is working. I have tried from a business as well as personal accounts. All email addresses associated are also verified!


Solution

  • As nobody was able to provide a solution I will like to post the workaround. So, the work around to this thing is using paypal's smart subscribe buttons instead of subscribe button. Or JavaScript SDK to be exact. They are working perfectly.

    I am still curious about the original question. So please provide a proper answer if you know!