cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

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
Who Me Too'd this topic