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.

Choose an optimal location for your PayPal button

To increase checkout speed and reduce buyer friction, you can locate your PayPal button early in the checkout flow on your product page or cart checkout page. If you offer additional payment options, you can choose to add a radio button on your checkout page to display a PayPal acceptance mark alongside the other payment options.

Locate the button on the product page or cart checkout page

In an upstream placement, the PayPal button appears on your product page or checkout page. When the buyer clicks the PayPal button, their billing and shipping information is provided from their PayPal account. The buyer simply reviews the information and confirms the purchase. If necessary, the buyer can change the billing and shipping information. In this checkout flow, the sales and shipping amount is not shown because the buyer can modify this information before confirming the purchase.

See an upstream presentment checkout flow. On the demo site, click the PayPal Checkout button.

Use a PayPal acceptance mark

In a downstream placement, the PayPal acceptance mark appears as a radio button at the end of the checkout flow. In this flow, the buyer enters their billing and shipping information on your shopping cart page. The buyer then clicks the radio button to choose PayPal as their payment option. A confirmation page displays the total amount of the purchase, including shipping and tax information. Because the shipping information is provided from your shopping cart page and not by PayPal, this information can not be changed. The buyer confirms the information and clicks the PayPal Pay Now button.

See a downstream presentment. On the demo site, click Proceed to Checkout.

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.