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

# PayPal

> Follow this guide to connect PayPal with Spartan

## Prerequisites

* PayPal Business Account
* Access to PayPal Developer Dashboard
* Your application ready for integration

## Access PayPal Developer Dashboard

<Steps>
  <Step title="Open the PayPal Developer Portal">
    Go to [https://developer.paypal.com](https://developer.paypal.com), click **Log In**, and sign in with your PayPal Business account credentials.
  </Step>

  <Step title="Open the Developer Dashboard">
    After logging in, open the PayPal Developer Dashboard, where you can manage applications and credentials.
  </Step>
</Steps>

## Create a New Application

<Steps>
  <Step title="Open My Apps & Credentials">
    In the left sidebar, click **My Apps & Credentials**, then click **Create App**.
  </Step>

  <Step title="Configure the application">
    * **App Name**: Enter a descriptive name, such as `My Store Payment Gateway`.
    * **Type**: Select **Merchant** (default).

          <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/paypal/step-1.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=f40baec30c7d35dfe0cba3663101e0ed" alt="Create PayPal Application" width="1866" height="911" data-path="public/gateways/paypal/step-1.png" />
  </Step>
</Steps>

## Create a Webhook

<Steps>
  <Step title="Add a webhook">
    Scroll to the end of the application settings and click **Add Webhook**.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/paypal/step-3.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=7f2bd8df5ba4c748b0768ff0e899f432" alt="Creating Webhook" width="1866" height="911" data-path="public/gateways/paypal/step-3.png" />
  </Step>
</Steps>

## Select Webhook Events

<Steps>
  <Step title="Select all events">
    Select **All events**, scroll down, and click **Create**.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/paypal/step-4.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=416065b4d3b7f19b0a363ad67f729496" alt="Webhook events" width="1866" height="911" data-path="public/gateways/paypal/step-4.png" />
  </Step>
</Steps>

## Get Webhook ID

<Steps>
  <Step title="Confirm the webhook was created">
    After creating the webhook, confirm that it appears in the webhooks list.
  </Step>

  <Step title="Copy the Webhook ID">
    Find your webhook and copy its **Webhook ID**, such as `7B89XXXXXX2Y`. This ID is required for webhook verification.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/paypal/step-5.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=9106f3ac0291bc13e56739f306b67b6e" alt="Webhook ID" width="1866" height="911" data-path="public/gateways/paypal/step-5.png" />
  </Step>
</Steps>

## Get Client Credentials

<Steps>
  <Step title="Open the app credentials">
    Return to your app dashboard and click the **Credentials** tab.
  </Step>

  <Step title="Copy the Client ID and Secret">
    * **Client ID**: Copy the public identifier.
    * **Client Secret**: Copy the private key and keep it secure.

    These credentials are required for PayPal API authentication.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/paypal/step-2.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=57a3828df8dae5261f9b6a3d8deb7739" alt="Get Client Credentials" width="1866" height="911" data-path="public/gateways/paypal/step-2.png" />
  </Step>
</Steps>

## Add PayPal to Spartan

<Steps>
  <Step title="Open the PayPal gateway">
    Log in to Spartan as an administrator, then go to **Modules → Gateways** and select **PayPal**, not PayPal IPN.
  </Step>

  <Step title="Configure PayPal">
    Enter the PayPal credentials and Webhook ID, then click **Save Settings**.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/paypal/step-6.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=e430fd196fcb385491d1bcb0c0a459b7" alt="Spartan PayPal configuration" width="1866" height="911" data-path="public/gateways/paypal/step-6.png" />
  </Step>
</Steps>

## Troubleshooting

### Common Issues

1. **Invalid Credentials**
   * Verify Client ID and Client Secret are correct
   * Ensure you're using the right environment (sandbox/live)

2. **Webhook Not Receiving Events**
   * Check webhook URL is accessible
   * Verify webhook is enabled and configured correctly
   * Check your server logs for errors
   * Make sure your domain is not flagged. ( Check PayPal for more info )
