Smart Button "Debit or Credit Card" button - capture fails with "permission_denied"

odtpwc
Contributor
Contributor

Hello all,
I am at my wit's end on this one and any help would be greatly appreciated.

 

This all worked on Friday on my initial LIVE deployment, now not.

We are receiving this response on the capture call:

 

e.g.: Request URL: https://www.paypal.com/smart/api/order/91368574PC6529151/capture

 

 

 

{"ack":"permission_denied","message":"Insufficient privileges"}

 

 

 

 

Here is the slightly redacted/simplified code of my smart button:

 

 

 

 

 paypal.Buttons({
        style: {
            shape: 'rect',
            color: 'gold',
            layout: 'vertical',
            label: 'paypal',

        },
        createOrder: function (data, actions) {

            var orderDescription = 'Thank You';

            var priceTotal = parseFloat(amountElement.value);
            var referenceId =  Date.now();

            var orderObj = {
                purchase_units: [{
                        reference_id : referenceId,
                        description: orderDescription,
                        amount: {
                            currency_code: "CZK",
                            value: priceTotal
                        }
                    }
                ]
            };

            
            return actions.order.create(orderObj);

        },
        onApprove: function (data, actions) {
            return actions.order.capture().then(function (details) {

                successElement.style.display = 'block';
                paypalButtonElement.style.display = 'none';
                
            });
        },

        onError: function (err) {
            amountElement.disabled = false;
            errorElement.style.display = 'block';
            console.log(err);
        },

        onCancel: function (data, actions) {
            amountElement.disabled = false;
        }

    }).render('#paypal-button-container');

 

 

 

 

What is happening:

1) Code works in sandbox with no issues. I simply have changed client-id for my LIVE app in the <script> tag.

2) onApprove is triggered. The failure seems to happen in the actions.order.capture() call within. 

3) The payment cards are valid. I have tried with several cards (all afternoon!). This probably makes sense since onApprove is called.

4) The button WORKS when paying with one's PayPal balance. However, not if you click the pay with credit/debit card button.

5) The code worked last week. This week not. I have not received any notification in PayPal dash about any issues with my account, etc. I only just started using Paypal for receiving payments like this - so I thought maybe something with my account, but I have not received ANY notifs about account issues.

6) Here is what the Request to URL: https://www.paypal.com/v2/checkout/orders looks like (when invoking actions.order.create)

 

 

 

 

{
	"purchase_units": [{
			"reference_id": 1612201506255,
			"description": "Thank You",
			"amount": {
				"currency_code": "CZK",
				"value": 200
			}
		}
	],
	"intent": "CAPTURE",
	"application_context": {}
}

 

 

 

it responds with:

 

 

 

{
	"id": "91368574PC6529151",
	"intent": "CAPTURE",
	"status": "CREATED",
	"purchase_units": [{
			"reference_id": "1612201506255",
			"amount": {
				"currency_code": "CZK",
				"value": "200.00"
			},
			"payee": {
				"email_address": "REDACTED",
				"merchant_id": "REDACTED"
			},
			"description": "Thank You"
		}
	],
	"create_time": "2021-02-01T17:45:06Z",
	"links": [{
			"href": "https://api.paypal.com/v2/checkout/orders/91368574PC6529151",
			"rel": "self",
			"method": "GET"
		}, {
			"href": "https://www.paypal.com/checkoutnow?token=91368574PC6529151",
			"rel": "approve",
			"method": "GET"
		}, {
			"href": "https://api.paypal.com/v2/checkout/orders/91368574PC6529151",
			"rel": "update",
			"method": "PATCH"
		}, {
			"href": "https://api.paypal.com/v2/checkout/orders/91368574PC6529151/capture",
			"rel": "capture",
			"method": "POST"
		}
	]
}

 

 

 

 

 

Anyone else having this issue? Can anyone offer any hints on what I may be doing wrong?

As this is LIVE, I am eager to resolve this ASAP.

 

Login to Me Too
7 REPLIES 7

borokjanos
Contributor
Contributor

Have you found anything yet? I'm in the same situation, and I need to solve this problem asap.

Login to Me Too

odtpwc
Contributor
Contributor

Talking to support. Nothing yet.

I even have this problem when using the out-of-box button-builder form code.

Login to Me Too

hkalman
Contributor
Contributor

Hello,

 

did you found any solution? Thanks.

Login to Me Too

odtpwc
Contributor
Contributor

I was contacted by Paypal support, and told to add the following property:

    upgradeLSAT: true

 

Example:
  paypal.Buttons({
    upgradeLSAT: true,
        createOrder: function(data, actions) {
          return actions.order.create({
            purchase_units: [{
              amount: {
                value: '0.01'
              }
            }]
          });
        },
        onApprove: function(data, actions) {
          return actions.order.capture().then(function(details) {
            alert('Transaction completed by ' + details.payer.name.given_name);
          });
        }
      }).render('#paypal-button-container'); // Display payment options on your web page

 
 
Haven't tried it yet, as we needed to find another solution to use as a workaround. Would be grateful if you could let us know if it works for you.
 
Login to Me Too

borokjanos
Contributor
Contributor

I had to find another solution too, but had a backup, so I tried it again, but the result is the same. A a matter of fact the json reply is a little bit different, but it contains the same error: Permission deined.

Login to Me Too

hkalman
Contributor
Contributor

I tested the "upgradeLSAT: true," parameter, but I've got error 403 on this request: 

 

https://www.paypal.com/v2/checkout/orders/_random_chars_/capture

Login to Me Too

Trish0427
Contributor
Contributor
What do u mean? I havent received the item!
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.