checkout

PayPal Checkout Quick Start

Follow these steps to create a fully functioning PayPal Checkout button within minutes:

  1. Copy and paste this HTML and JavaScript code snippet into an HTML file.

    <div id="paypal-button"></div>
    <script src="https://www.paypalobjects.com/api/checkout.js"></script>
    <script>
    paypal.Button.render({
      env: 'sandbox',
      client: {
        sandbox: 'demo_sandbox_client_id'
      },
      payment: function (data, actions) {
        return actions.payment.create({
          transactions: [{
            amount: {
              total: '0.01',
              currency: 'USD'
            }
          }]
        });
      },
      onAuthorize: function (data, actions) {
        return actions.payment.execute()
          .then(function () {
            window.alert('Thank you for your purchase!');
          });
      }
    }, '#paypal-button');
    </script>
    
  2. Open the HTML file in your browser and click your new PayPal Checkout button.

    Congratulations, you now have a working PayPal Checkout button!

Tip: If you already have sandbox credentials, enter them in the PayPal window to see the buyer's checkout flow. To create a sandbox account, see Create sandbox test accounts.

Make test calls to the API using the interactive API Explorer.

Next

Enhance your payment button with a full client-side integration:

If you're satisfied with this simple button, see PayPal Checkout button customization options and best practices tips:

Feedback

Have feedback?

Let us know.