skip to Main Content

I am trying to implement the PayPal-Smart-Buttons to my website for a subscription.
I copied the code from the PayPal docs (https://developer.paypal.com/docs/subscriptions/integrate/#subscriptions-with-smart-payment-buttons). So my code looks like this:

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>

<body>
    <script
         src="https://www.paypal.com/sdk/js?client-id=AZz6Px2hMTBBNvg8GvMiT8FuTTvATwoAMCLVGLt-On-iewuacyQv-d6LSQunDqK1KES4KHTGDU3Sgpsb&vault=true">
    </script>
    <div id="paypal-button-container"></div>
  <script>
  paypal.Buttons({
      createSubscription: function(data, actions) {
          return actions.subscription.create({
              'plan_id': 'P-64K047315T678654PL3W74YY'
          });
      },
      onApprove: function(data, actions) {
          alert('You have successfully created subscription ' + data.subscriptionID);
      }
    }).render('#paypal-button-container');
  </script>
</body>

Previously I’ve created two products and one plan for each product.
Here are the configured plans:

{
   "plans":[
      {
         "id":"P-64K047315T678654PL3W74YY",
         "name":"AC-Bot Silver Subscription",
         "status":"ACTIVE",
         "usage_type":"LICENSED",
         "quantity_supported":false,
         "create_time":"2020-06-20T12:17:39Z",
         "links":[
            {
               "href":"https://api.sandbox.paypal.com/v1/billing/plans/P-64K047315T678654PL3W74YY",
               "rel":"self",
               "method":"GET",
               "encType":"application/json"
            }
         ]
      },
      {
         "id":"P-9LX00946YY976221PL3W74ZI",
         "name":"AC-Bot Gold Subscription",
         "status":"ACTIVE",
         "usage_type":"LICENSED",
         "quantity_supported":false,
         "create_time":"2020-06-20T12:17:41Z",
         "links":[
            {
               "href":"https://api.sandbox.paypal.com/v1/billing/plans/P-9LX00946YY976221PL3W74ZI",
               "rel":"self",
               "method":"GET",
               "encType":"application/json"
            }
         ]
      }
   ],
   "links":[
      {
         "href":"https://api.sandbox.paypal.com/v1/billing/plans?page_size=10&page=1",
         "rel":"self",
         "method":"GET",
         "encType":"application/json"
      }
   ]
}

The plans are active, but I’ve getting the error: "Uncaught Error: Api: /smart/api/billagmt/subscriptions/I-B9Y1J8J6HA9G/cartid returned status code: 500 (Corr ID: 4c5a81ed5a4db)".

Anybody experienced the same issue?

2

Answers


  1. Chosen as BEST ANSWER

    In the meantime the bug of PayPal has been fixed. Everything works again as it should.


  2. I made it work, this is how it worked for me, and I hope it works for you too.

    Here is what I did to make it work.

    1. Log out of your sandbox store (if you are currently logged in).
    2. Log back into your sandbox store.
    3. Open up a private tab, and test your button there, or use another browser to test the button. Make sure you don’t close the tab where your store is in.

    This worked for me. I don’t know why it is like it is.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search