Sandbox Account - Error Order could not be captured

Gavin-Builder
New Community Member

I've got a sandbox account that was working OK, the site is just about to go live and I am now consistently getting the above error.

 

I'm using paypay.Buttons:-

 

        paypal.Buttons({
            createOrder: ( data, actions ) => {
                return actions.order.create({
                    purchase_units: [{
                        amount: {
                            value: this.amount.toFixed(2),
                            currency_code: "GBP",
                        }
                    }]
                })
            },
            onApprove: ( data, actions ) => {
                return actions.order.capture().then(details => {
                 console.log('details',details);
                })
            },
            onError: ( error ) => {
                console.log('error',error);
            }
        }).render('#paypal-button-container')

The endpoint failing is:- POST to  https://www.sandbox.paypal.com/smart/api/order/9SS20746CE045201T/capture

 

There's about 16k of output to console, but the final part is:-

 

Error: Order could not be captured
at Yt.(anonymous function) (https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:51457)
at Object.<anonymous> (https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:57716)
at JSON.parse (<anonymous>)
at o (https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:57576)
at ir (https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:57727)
at Er.u.on (https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:62490)
at Er (https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:62679)
at https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:67116
at https://www.paypal.com/sdk/js?client-id=AQ0BP............LKMvKBB7Qd&currency=GBP:1:67162

Any assistance is appreciated.

Login to Me Too
4 REPLIES 4

Domingofhernand
Contributor
Contributor

The same thing happens to me suddenly, I think it's because of the session, because once it expires and I re-enter with the buyer's account it works without errors.

Login to Me Too

demsley
Contributor
Contributor

Many thanks - @Domingofhernand - this is exactly the problem I have and the correct solution.

Simply log out and back into the PayPal acoount.

Login to Me Too

JosephArtem
New Community Member

If you just press the overlay that says "Don’t see the secure PayPal browser? We’ll help you re-launch the window to complete your purchase" it will re-load the pay window and all will be fine. Just click it a few times before trying a payment to be safe.

Login to Me Too

akhtersoyeb
Contributor
Contributor

I was using brave browser. I don't know why but when I tested it in firefox the error got solved.

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.