Search code examples
javascriptpaypalbraintree

PayPal integration from Braintree sandbox error: PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED


I got this error when I try to test my PayPal integration from Braintree.

Here is my client code (actually copy from official site and make little modification):

braintree.client.create({
    authorization: ClientToken
}, function(err, clientInstance) {
    if (err) {
        console.error(err);
        return;
    }

    // Create a PayPal Checkout component.
    braintree.paypalCheckout.create({
        client: clientInstance
    }, function (paypalCheckoutErr, paypalCheckoutInstance) {
        // Stop if there was a problem creating PayPal Checkout.
        // This could happen if there was a network error or if it's incorrectly
        // configured.
        if (paypalCheckoutErr) {
            console.error('Error creating PayPal Checkout:', paypalCheckoutErr); // Error from this line
            return;
        }
    });
});

Error creating PayPal Checkout: 
{
    name: "BraintreeError",
    code: "PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED",
    message: "A linked PayPal Sandbox account is required to use PayPal Checkout in Sandbox. See https://developers.braintreepayments.com/guides/paypal/testing-go-live/#linked-paypal-testing for details on linking your PayPal sandbox with Braintree.",
    type: "MERCHANT",
    details: undefined
}

I have actually link my PayPal sandbox account (from the Braintree control panel) and surprisingly cannot find any useful information about this error. Of course I have read through https://developers.braintreepayments.com/guides/paypal/testing-go-live/node#linked-paypal-testing.


Solution

  • I finally turn out open another Braintree sandbox account solve this problem. It is weird however I cannot solve by anything else.