Search code examples
javascriptpaypalpaypal-sandbox

Paypal Checkout. I can't login with the paypal account accesses


I'm trying to implement the payment process with Paypal Checkout

This is my code

<div class='wrapper-packages'>
   <div id="paypal-button"></div> 
</div>  

<script>
    paypal.Button.render({

       env: 'sandbox',

       client: {
           sandbox: 'xxxxxxxx',
           production: 'xxxxxxxx'
    },

    payment: function() {

        var env    = this.props.env;
        var client = this.props.client;

        return paypal.rest.payment.create(env, client, {
            transactions: [
                {
                    amount: { total: '1.00', currency: 'USD' }
                }
            ]
        });
    },

    commit: true, // Optional: show a 'Pay Now' button in the checkout flow

    onAuthorize: function(data, actions) {

        // Optional: display a confirmation page here

        return actions.payment.execute().then(function() {
            alert('ok');
        });
    }
}, '#paypal-button')
</script>

When I click on Paypal Checkout button, it opens the modal for log in paypal account, but I can't do login

The login credentials are ok, I've checked it. So, what can be the problem?


Solution

  • When using PayPal's Sandbox, you need to use Sandbox Test Accounts. You can read more about them in the Docs