> For the complete documentation index, see [llms.txt](https://docs.gem-suite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gem-suite.com/api-reference/resources/sales/payments.md).

# Payments

## List all sales payments

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/sales_payments`

This endpoint allows you to get the list of your clients.

#### Query Parameters

| Name      | Type    | Description                                                |
| --------- | ------- | ---------------------------------------------------------- |
| page      | integer | The number of the page you wish to see. Default is 1.      |
| per\_page | integer | The number of the desired result per page. Default is 500. |

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Accept         | string | Should be `application/json`. |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "data": [
        {
            "id": 5,
            "invoice_id": 8,
            "method_id": 104,
            "amount": 56.40,
            "date_payment": "2024-09-23"
        },
        {
            "id": 4,
            "invoice_id": 7,
            "method_id": 104,
            "amount": 500.00,
            "date_payment": "2024-08-26"
        },
        {
            "id": 3,
            "invoice_id": 23,
            "method_id": 102,
            "amount": 47.49,
            "date_payment": "2024-08-26"
        },
        {
            "id": 2,
            "invoice_id": 104,
            "method_id": 101,
            "amount": 214.98,
            "date_payment": "2024-08-22"
        },
        {
            "id": 1,
            "invoice_id": 16,
            "method_id": 69,
            "amount": "29.50",
            "date_payment": "2024-08-21"
        }
    ],
    "meta": {
        "current_page": 1,
        "last_page": 1,
        "per_page": 500,
        "total": 5
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}

## Retrieve a sales payment

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/sales_payments/:id`

This endpoint allows you to get the details of the sales payment.

#### Path Parameters

| Name | Type    | Description                              |
| ---- | ------- | ---------------------------------------- |
| id   | integer | The ID of the sales payment to retrieve. |

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Accept         | string | Should be `application/json`. |

{% tabs %}
{% tab title="200 " %}

```json
{
    "data": [
        {
            "id": 4,
            "invoice_id": 7,
            "method_id": 104,
            "amount": 500.00,
            "date_payment": "2024-08-26"
        }
    ],
    "success": true
}
```

{% endtab %}
{% endtabs %}

## Create a sales payment

<mark style="color:green;">`POST`</mark> `https://app.gem-books.com/api/sales_payments`

This endpoint allows you to create a sales payment.\
Returns the created sales payment.

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Content-Type   | string | Should be `application/json`. |
| Accept         | string | Should be `application/json`. |

#### Request Body

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| invoice\_id   | string | Invoice ID        |
| method\_id    | string | Payment method ID |
| amount        | string | Payment amount    |
| date\_payment | string | Payment date      |

{% tabs %}
{% tab title="200 " %}

```json
{
    "data": [
        {
            "id": 6,
            "invoice_id": 10,
            "method_id": 101,
            "amount": "250.00",
            "date_payment": "2024-10-30"
        }
    ],
    "success": true
}
```

{% endtab %}
{% endtabs %}

```json
{
    "invoice_id": 10,
    "method_id": 101,
    "amount": 250.00,
    "date_payment": "2024-10-30"
}
```

## Update a sales payment

<mark style="color:orange;">`PUT`</mark> `https://app.gem-books.com/api/sales_payments/:id`

This endpoint allows you to update a specific sales payment. \
Returns the updated sales payment.

#### Path Parameters

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| id   | integer | Sales payment id to update. |

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Content-Type   | string | Should be `application/json`. |
| Accept         | string | Should be `application/json`. |

{% tabs %}
{% tab title="200 " %}

```json
{
    "data": [
        {
            "id": 6,
            "invoice_id": 10,
            "method_id": 101,
            "amount": "100.00",
            "date_payment": "2024-10-31"
        }
    ],
    "success": true
}
```

{% endtab %}
{% endtabs %}

```
{
"invoice_id": 15,
"method_id": 101,
"amount": 100.00,
"date_payment": "2024-10-31"
}
```
