javascriptphplaravelpaypal-rest-sdk

Paypal Advanced Checkout not working on laravel app


I am trying to implement an advanced paypal checkout, everything works fine when trying the advanced paypal example here. I used my own client id and secret to do so, and it also worked, but when trying to implement the same code in my laravel app, it throws this error:

PayPal Hosted Fields is not eligible.

caused by this code:

if (paypal.HostedFields && **paypal.HostedFields.isEligible()**) {  // <-------- this line
        // Renders card fields
        paypal.HostedFields.render({
            // Call your server to set up the transaction
            ...
        }).then((card_fields) => {
            ....
        });
} else {
        console.log("PayPal Hosted Fields is not eligible.");
}

when I ran through their tutorial I found that this Advanced Checkout feature is not available in all countries, what was missing is enabling Advanced Credit and Debit Card Payments checkbox which was missing from my app. I believe that is because I the account is from a country that is not supported for advanced checkout. I wanted to make sure that this is the problem and not something in my code, can someone help me?

EDIT:

I also tried someone else's account and had the same issue. also tried a new account and same problem


Solution

  • I believe that is because I the account is from a country that is not supported for advanced checkout.

    PayPal's advanced checkout is available exclusively for the countries listed in its documentation.

    For other countries, use the black "Debit or Credit Card" button of a standard checkout.