> ## 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.

# Record Order Payment

> The "Record Order Payment" API allows to record a payment for an order. Use this endpoint to record payment for an order and update the order status to "Paid".

The "Record Order Payment" API allows to record a payment for an order. Use this endpoint to record payment for an order and update the order status to "Paid".

```http theme={null}
POST https://services.leadconnectorhq.com/payments/orders/{orderId}/record-payment
```

## 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>

## Path parameters

<ParamField path="orderId" type="string" required default="5e2d4c8e0e8b4e001c1c4f5d">
  Order ID
</ParamField>

## Body

<ParamField body="altId" type="string" required default="6578278e879ad2646715ba9c">
  account Id / company Id based on altType
</ParamField>

<ParamField body="altType" type="string" required default="account">
  Alt Type Posibles valores: 'account'
</ParamField>

<ParamField body="mode" type="string" required default="card">
  manual payment method Posibles valores: 'cash', 'card', 'cheque', 'bank\_transfer', 'other'
</ParamField>

<ParamField body="card" type="object">
  Details of Card if used for payment
</ParamField>

<ParamField body="cheque" type="object">
  Details of the Cheque if used for payment
</ParamField>

<ParamField body="notes" type="string" default="This was a direct payment">
  Any note to be recorded with the transaction
</ParamField>

<ParamField body="amount" type="number" default="100">
  Amount to be paid against the invoice.
</ParamField>

<ParamField body="meta" type="object">
  Meta data to be recorded with the transaction
</ParamField>

<ParamField body="isPartialPayment" type="boolean">
  Indicates if the order is intended to be a partial payment.
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="success" type="boolean" required default="True">
    Success status of the request
  </ResponseField>

  ```json theme={null}
  {
    "success": true
  }
  ```
</Accordion>

<Accordion title="400 - Order not found">
  ```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/orders/YOUR_orderId/record-payment' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "mode": "card",
    "notes": "This was a direct payment",
    "amount": 100,
    "meta": {},
    "isPartialPayment": true
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/payments/orders/YOUR_orderId/record-payment', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "mode": "card", "notes": "This was a direct payment", "amount": 100, "meta": {}, "isPartialPayment": true}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/payments/orders/YOUR_orderId/record-payment',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "mode": "card", "notes": "This was a direct payment", "amount": 100, "meta": {}, "isPartialPayment": true},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/payments/orders/YOUR_orderId/record-payment');
  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({'altId': '6578278e879ad2646715ba9c', 'altType': 'account', 'mode': 'card', 'notes': 'This was a direct payment', 'amount': 100, 'meta': {}, 'isPartialPayment': true}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
