Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal Smart Payment Buttons and create subscriptions give me a RESOURCE_NOT_FOUND error

I'm using a Sandbox and I created a paypal plan with Paypal PHP SDK and activated it.

I'm following the integration guide to create a subscription to this plan (https://developer.paypal.com/docs/subscriptions/integrate/#4-create-a-subscription).

But when I clic on the yellow button I have a Javascript Error in the console :

Error: Create Subscription Api response error:

{
    "name": "RESOURCE_NOT_FOUND",
    "message": "The specified resource does not exist.",
    "debug_id": "23912dc1195d",
    "details": [
        {
            "issue": "INVALID_RESOURCE_ID",
            "description": "Requested resource ID was not found."
        }
    ],
    "links": [
        {
            "href": "https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID",
            "rel": "information_link",
            "method": "GET"
        }
    ]
}

I checked if the plan exists and it's OK with the Paypal PHP SDK.

Here is the Javascript code used :

<script src="https://www.paypal.com/sdk/js?client-id=sandbox_paypal_client_id&vault=true"></script>

  <div id="paypal-button-container"></div>

  <script>
    // paypal.Buttons().render('#paypal-button-container');

    paypal.Buttons({
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          'plan_id': 'P-8N6112936N290211KKMN5MZI'
        });
      },
      onApprove: function(data, actions) {
        alert('You have successfully created subscription ' + data.subscriptionID);
      }
    }).render('#paypal-button-container');
  </script>

In the paypal developer dashboard I see the API call for this action, but in orange...

Thanks in advance for your help.

like image 938
Seb Avatar asked Oct 18 '25 14:10

Seb


2 Answers

I also ran into this problem. My confusion when following the Subscriptions Integration instructions was that I thought the SDK would work with Subscription Plans (API endpoint /billing/plans), but at the time of writing it doesn't (at least the PHP and .NET versions) - the SDK only works with the older Billing Plans (/payments/billing-plans) which are very similarly named (Plans for short).

As @giannisrig says, you have to call the Subscription Plans part of the API directly (/billing/plans). I hope they'll update the SDK soon - this seems like an important missing feature.

like image 63
Joe Derry Hall Avatar answered Oct 22 '25 04:10

Joe Derry Hall


Use the sandbox business account associated with the sandbox client ID you're using and make the paypal smart subscription or plan through there. The planId and clientId need to belong to the same sandbox account.

like image 31
Kevin Danikowski Avatar answered Oct 22 '25 05:10

Kevin Danikowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!