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

# Create new provider config

> API to create a new payment config for given account

API to create a new payment config for given account

```http theme={null}
POST https://services.leadconnectorhq.com/payments/custom-provider/connect
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Query parameters

<ParamField query="locationId" type="string" required default="Lk3nlfk4lxlelVEwcW">
  Account id
</ParamField>

## Body

<ParamField body="live" type="object" required>
  Live config containing api-key and publishable key for live payments
</ParamField>

<ParamField body="test" type="object" required>
  Test config containing api-key and publishable-key for test payments
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="name" type="string" required default="Company Paypal Integration">
    The name of the custom provider
  </ResponseField>

  <ResponseField name="description" type="string" required default="This payment gateway supports payments in India via UPI, Net banking, cards and wallets.">
    Description of payment gateway. Shown on the payments integrations page as subtext
  </ResponseField>

  <ResponseField name="paymentsUrl" type="string" required default="https://testpayment.paypal.com">
    This url will be loaded in iFrame to start a payment session.
  </ResponseField>

  <ResponseField name="queryUrl" type="string" required default="https://testsubscription.paypal.com">
    The url used for querying payments related events. Ex. verify, refund, subscription etc.
  </ResponseField>

  <ResponseField name="imageUrl" type="string" required default="https://testsubscription.paypal.com">
    Public image url for logo of the payment gateway displayed on the payments integrations page.
  </ResponseField>

  <ResponseField name="_id" type="string" required default="662a44ad19a2a44d3cd9d749">
    The unique identifier for the custom provider.
  </ResponseField>

  <ResponseField name="locationId" type="string" required default="Lk3nlfk4lxlelVEwcW">
    Account id
  </ResponseField>

  <ResponseField name="marketplaceAppId" type="string" required default="65f0b217a05c774da7f1efa5">
    The application id of marketplace
  </ResponseField>

  <ResponseField name="paymentProvider" type="object" default="{ live: { liveMode: true }, test: { liveMode: false, apiKey: &#x22;y5ZQxryRFXZHvUJZdLXXXXXX&#x22;, publishableKey: &#x22;rzp_test_zPRoVMLOa0A9wo&#x22; }}">
    Payment provider details.
  </ResponseField>

  <ResponseField name="deleted" type="boolean" required default="True">
    Whether the config is deleted or not. true represents config is deleted
  </ResponseField>

  <ResponseField name="createdAt" type="string" required default="2023-11-20T10:23:36.515Z">
    The creation timestamp of the custom provider.
  </ResponseField>

  <ResponseField name="updatedAt" type="string" required default="2024-01-23T09:57:04.846Z">
    The last update timestamp of the custom provider.
  </ResponseField>

  <ResponseField name="traceId" type="string" default="302d2cf4-1ba0-4bf5-bc3b-f8fa76fda58a">
    Trace id of the custom provider.
  </ResponseField>

  ```json theme={null}
  {
    "name": "Company Paypal Integration",
    "description": "This payment gateway supports payments in India via UPI, Net banking, cards and wallets.",
    "paymentsUrl": "https://testpayment.paypal.com",
    "queryUrl": "https://testsubscription.paypal.com",
    "imageUrl": "https://testsubscription.paypal.com",
    "_id": "662a44ad19a2a44d3cd9d749",
    "locationId": "Lk3nlfk4lxlelVEwcW",
    "marketplaceAppId": "65f0b217a05c774da7f1efa5",
    "paymentProvider": "{ live: { liveMode: true }, test: { liveMode: false, apiKey: \"y5ZQxryRFXZHvUJZdLXXXXXX\", publishableKey: \"rzp_test_zPRoVMLOa0A9wo\" }}",
    "deleted": true,
    "createdAt": "2023-11-20T10:23:36.515Z",
    "updatedAt": "2024-01-23T09:57:04.846Z",
    "traceId": "302d2cf4-1ba0-4bf5-bc3b-f8fa76fda58a"
  }
  ```
</Accordion>

<Accordion title="400 - No such config exists for given locationId and marketplaceAppId">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/payments/custom-provider/connect' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/payments/custom-provider/connect', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
    },
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/payments/custom-provider/connect',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
      },
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/payments/custom-provider/connect');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode(None),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
