Skip to main content

Prerequisite

A PayPal business account that is approved for Expanded Checkout.

Set up sandbox account

  1. Sign up for a developer account. On successful signup, PayPal automatically creates your sandbox environment. The sandbox environment is a test environment that helps you mimic real-world transactions. By default, the environment includes a business and personal account. When testing your app, you can use the business account to simulate merchant actions and the personal account to simulate customer actions. You can create multiple additional business and personal accounts.
  2. Set up the sandbox environment:
    1. Go to your PayPal developer account and toggle to Sandbox.
    2. Go to Apps & Credentials and select Create App.
    3. Enter your app name, select Type as Merchant, select the sandbox business account to test your app, and select Create App. The app details page is displayed.
    4. Go to Feature > Accept payments. By default, the Vault and Apple Pay checkboxes are selected. If not, select them.
    5. Configure a webhook listener for the app and subscribe to events:
      1. In the app details page, go to Sandbox Webhooks.
      2. Select Add Webhook.
      3. Enter a Webhook URL (the server endpoint where notifications from PayPal are sent), select the events the app wants to subscribe to, and select Save.
      4. The webhook listener is successfully configured, and a Webhook ID is displayed. You can store the ID and use it in your app code to verify the source sending messages to your listener.
      For more information on webhooks, see Webhooks guide. For the list of Usage-based Billing events that the app can subscribe to, see Webhook reference.
  3. Retrieve sandbox app credentials: To integrate Usage-based Billing APIs and test them successfully, you require the following sandbox credentials for your app:
    • Client ID: App identifier that helps with account authentication.
    • Client secret: App credential that helps with app authorization.
    To retrieve the sandbox credentials:
    1. Go to your PayPal developer account and switch to Sandbox.
    2. Go to Apps & Credentials > API Credentials > REST API apps.
    3. Copy the Client ID and Secret (Client secret) listed next to your app name and save them.
  4. Retrieve sandbox account credentials: When you test your integration end-to-end, you run your app, start a payment as a customer, log in to your personal and business accounts, and check that money moves from your personal to your business account. If you use a payment method other than PayPal wallet, you check that the money moves into your business account. You require sandbox log-in credentials for both accounts. For information on how to get these from your developer account, see Get sandbox account credentials.
  5. Set up the development environment.
  6. Activate Usage-based Billing for sandbox account.

Set up production business account

  1. Log in to your PayPal business account at the PayPal Developer Dashboard.
  2. Switch to the Live environment.
  3. Go to Apps & Credentials and create a new app or select an existing app.
  4. Go to Feature > Accept payments. By default, the Vault checkbox is selected. If not, select it. If you intend to offer Apple Pay as a payment option, ensure that the Apple Pay checkbox is selected.
  5. Configure a webhook listener for the app and subscribe to events:
    1. On the app details page, go to Live Webhooks.
    2. Select Add Webhook.
    3. Enter a Webhook URL (the server endpoint where notifications from PayPal are sent), select the events the app wants to subscribe to, and select Save.
    4. The webhook listener is successfully configured, and a Webhook ID is displayed. You can store the ID and use it in your app code to verify the source sending messages to your listener.
    For more information on webhooks, see Webhooks guide. For the list of Usage-based Billing events that the app can subscribe to, see Webhook reference.
  6. Copy your Client ID and Secret for the live app.
  7. Activate Usage-based Billing for production account.

Activate Usage-based Billing

Note: You must activate Usage-based Billing through the API. The PayPal developer dashboard currently does not provide a toggle to enable this feature.
Use a valid access token and send a POST request to the /v1/commerce/billing/activate endpoint. On successful activation, the PayPal server returns a billing_tier_id, a unique code for your merchant account that enables higher rate limits for Usage-based Billing operations.
curl -L -X POST 'https://api-m.sandbox.paypal.com/v1/commerce/billing/activate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
A successful response returns an HTTP 200 status code with a billing_tier_id that confirms your business account is now activated for Usage-based Billing. Store this ID securely as you will need it when sending usage events to PayPal.
I