Authorization failed due to insufficient permissions

castingcallclub
Contributor
Contributor

I am trying to create a subscription for paypal via braintree. I keep getting this error:

 

Subscription Api response error:

{
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"debug_id": "f3865167eaefb",
"details": [
{
"issue": "PERMISSION_DENIED",
"description": "You do not have permission to access or perform operations on this resource."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/v1/billing/subscriptions#NOT_AUTHORIZED",
"rel": "information_link",
"method": "GET"
}
]
}

 

 

I am trying to create the subscription like this

 

  const createPayPalSubscription = (data, actions) => {
      return actions.subscription.create({
        //'plan_id': window.thePlan.paypalPlanId
        'plan_id': 'dollar12'
      })
  }


const init = () => {
    braintree.client.create(
      { authorization: braintreeClientToken },
      (clientErr, clientInstance) => {
        if (clientErr) { console.log(clientErr) }

        braintree.paypalCheckout.create(
          { client: clientInstance },
          (paypalErr, paypalCheckoutInstance) => {
            if (paypalErr) { console.log(paypalErr) }

            paypalCheckoutInstance.loadPayPalSDK(
              {
                'intent': 'subscription',
                'vault': true,
                'disable-funding': 'card'
              },
              (loadPayPalSDKErr) => {
                if (loadPayPalSDKErr) { console.log(loadPayPalSDKErr) }

                return paypal.Buttons({
                  style: { layout: 'horizontal' },
                  createSubscription: createPayPalSubscription,
                  onApprove: payPalSubscriptionApproved
                }).render('#paypal-button').catch((error) => {
                  console.error('failed to render the PayPal Buttons', error)
                })
              }
            )
          }
        )
      }
}

 

 

Login to Me Too
1 REPLY 1

MTS_Chiranjeevi
Moderator
Moderator

Good day @castingcallclub,

 

Thank you for posting to the PayPal community.

 

Can you please try now and if your still facing issues, please create a MTS ticket via -  https://www.paypal-support.com/s/?language=en_US with the error details.


Braintree Support : https://developer.paypal.com/braintree/help 

 

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

Haven't Found your Answer?

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