Simple Paypal button integration results in 404 error

dsver
Contributor
Contributor

I have business and personal account set up, subscriptions, plans... all setup for simple paypal button POC in sandbox.

This is my code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" />
    <title></title>
    
</head>
<body>
    <script src="https://www.paypal.com/sdk/js?client-id=xxxx&vault=true&intent=subscription"></script>
    <div id="paypal-button-container"></div>
    <script>    paypal.Buttons({
        createSubscription: function(data, actions) {
            return actions.subscription.create({
            'plan_id': 'P-66899082RN487441DMXZKF7I'
        });
        },
        onApprove: function(data, actions) {
            console.log(data, '\n', actions);
            alert('You have successfully subscribed to ' + data.subscriptionID);
        }
    }).render('#paypal-button-container');
    </script>
</body>
</html>

(I've replaced the client id with xxxx, but in reality I've put valid client id instead. This is definately the right client ID, we use only one client ID!)

However, I got 404 in the first place, when paypal plugin starts pinging its own endpoint: https://www.sandbox.paypal.com/v1/billing/subscriptions 404 error

following the bunch of errors in the console:

rest_api_v1_billing_subscriptions_create_error , create_order_error , Uncaught Error: Create Subscription Api response error ...etc.

I used the exact form form the official integration manual: https://developer.paypal.com/docs/subscriptions/integrate/
Here is the plan in the dashboard:

paypal-plan.png

 

The colleagues have created it by following steps 1 and 2: https://developer.paypal.com/docs/subscriptions/integrate/#link-createproduct
They created several plans. I tried 3 of those plans, same result. (You can see only one plan in the capture because I deleted it from the capture)

 

Here are the errors I got in the console:

 

paypal-console.png

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

dsver
Contributor
Contributor

I apologize to all who spent time analyzing this question.

Colleague gave me the wrong client ID / client secret in the first place 😞 

Once I applied the right client ID, it went well

View solution in original post

Login to Me Too
1 REPLY 1
Solved

dsver
Contributor
Contributor

I apologize to all who spent time analyzing this question.

Colleague gave me the wrong client ID / client secret in the first place 😞 

Once I applied the right client ID, it went well

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.