> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paypal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up accounts

<div className="m-badge-page-wrapper">
  <Badge stroke color="orange" size="sm">Limited Release</Badge>
</div>

You can use the procedures in this section to set up sandbox and production accounts.

## Prerequisite

You need a PayPal business account with approval for Expanded Checkout.

## Set up sandbox account

1. <a href="https://www.paypal.com/signin?returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdashboard%2F&intent=developer&ctxId=ul14c2e612301b4f5c99383ae8f762a937" target="_blank" rel="noopener noreferrer">Sign up for a developer account</a>. 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 <a href="https://developer.paypal.com/dashboard/" target="_blank" rel="noopener noreferrer">PayPal developer account</a> 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 <a href="https://developer.paypal.com/api/rest/webhooks/" target="_blank" rel="noopener noreferrer">Webhooks guide</a>. For the list of Usage-based Billing events that the app can subscribe to, see <a href="/limited-release/usage-based-billing/reference/webhooks-reference" target="_blank" rel="noopener noreferrer">Webhook reference</a>.

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 <a href="https://developer.paypal.com/api/rest/#link-getsandboxaccountcredentials" target="_blank" rel="noopener noreferrer">Get sandbox account credentials</a>.

5. Set up the development environment. This involves building your server, installing dependencies, verifying configuration files that the package managers use, and setting up the environment variables.

6. <a href="#activate-usage-based-billing">Activate Usage-based Billing for sandbox account</a>.

## Set up production business account

1. Log in to your PayPal business account at the [PayPal Developer Dashboard](https://developer.paypal.com/).
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 <a href="https://developer.paypal.com/api/rest/webhooks/" target="_blank" rel="noopener noreferrer">Webhooks guide</a>. For the list of Usage-based Billing events that the app can subscribe to, see <a href="/limited-release/usage-based-billing/reference/webhooks-reference" target="_blank" rel="noopener noreferrer">Webhook reference</a>.
6. Copy your **Client ID** and **Secret** for the live app.
7. <a href="#activate-usage-based-billing">Activate Usage-based Billing for production account</a>.

## Activate Usage-based Billing

<Note>
  You need to activate Usage-based Billing through the API. The PayPal developer dashboard currently does not provide a toggle to enable this feature.
</Note>

Use a <a href="/developer/how-to/api/get-started#2-get-an-access-token" target="_blank" rel="noopener noreferrer">valid access token</a> and make a POST call 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.

<CodeGroup>
  ```shell lines title="Request – Sandbox" theme={null}
  curl -L -X POST 'https://api-m.sandbox.paypal.com/v1/commerce/billing/activate' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
  ```

  ```shell lines title="Request – Production" theme={null}
  curl -L -X POST 'https://api-m.paypal.com/v1/commerce/billing/activate' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
  ```

  ```json lines title="Response" theme={null}
  {
    "billing_tier_id": "NDc3Nzc1NTg0NTY0MTgyMzUzNw==.K7iva2SX08+9R52rAIfUwQvruZackQErIDDdEnUxxKE="
  }
  ```
</CodeGroup>

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 need it when sending usage events to PayPal.
