Client-side REST integration

Get your client ID

Before you can set up and execute payments using the REST API, you need a client ID. The client ID authenticates your account with PayPal. You can use an existing client ID or create a new one.

To get your client ID or set up a new one:

  1. Navigate to My Apps & Credentials and click Log into Dashboard in the top, right corner of the page.
  2. Scroll down to REST API Apps and click the name of your app to see the app's details. If you don't have any apps, create one now:
    a. Click Create App.
    b. In App Name, enter a name and then click Create App again. The app is created and your client ID is displayed.
  3. Click the Sandbox / Live toggle to display and copy the client ID for each environment.

Set up your client

  1. In the client option below, pass the client IDs for sandbox and production (live).
  2. In the payment function, call actions.payment.create() to set up the payment. See the available payment options and currency codes.
  3. In the onAuthorize function, finalize the payment.
  4. Optionally show a confirmation page.
<div id="paypal-button"></div>

<script src=""></script>


        env: 'production', // Or 'sandbox'

        client: {
            sandbox:    'xxxxxxxxx',
            production: 'xxxxxxxxx'

        commit: true, // Show a 'Pay Now' button

        payment: function(data, actions) {
            return actions.payment.create({
                payment: {
                    transactions: [
                            amount: { total: '1.00', currency: 'USD' }

        onAuthorize: function(data, actions) {
            return actions.payment.execute().then(function(payment) {

                // The payment is complete!
                // You can now show a confirmation message to the customer

    }, '#paypal-button');

Additional information

Try the full interactive demo.

The PayPal REST APIs use webhooks for event notification. When your integration is complete, you can set up and subscribe to a webhook listener.


Test your integration.