> For the complete documentation index, see [llms.txt](https://aplazo.gitbook.io/aplazo-integrations/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aplazo.gitbook.io/aplazo-integrations/espanol/referencia-de-api/online-api/crea-un-pago.md).

# Crea un pago

{% hint style="info" %}
Throughout this documentation, the terms "**payment**," "**loan**," and "**order**" are used interchangeably to refer to the same concept.
{% endhint %}

## Environments

{% tabs %}
{% tab title="Development" %}
<https://api.aplazo.net/api>
{% endtab %}

{% tab title="Production" %}
<https://api.aplazo.mx/api>
{% endtab %}
{% endtabs %}

{% openapi src="/files/9LjWj62EfrRCRGt9S68y" path="/loan" method="post" %}
[openapi3\_20250109.yaml](https://content.gitbook.com/content/UR1kwlS8DiKsSq3rCVB5/blobs/hZMypjMkbiYLv5efPBB0/openapi3_20250109.yaml)
{% endopenapi %}

## Response Examples

### Success

<details>

<summary><mark style="color:green;">200</mark> - Successful Loan Creation</summary>

{% code title="Response: 200 OK" overflow="wrap" %}

```json
{
  "url": "https://checkout.aplazo.net/main/1777a4f6-da5e-4787-9956-40467dd0c37e",
  "loanId": 156123,
  "loanToken": "1777a4f6-da5e-4787-9956-40467dd0c37e"
}
```

{% endcode %}

</details>

### Errors

<details>

<summary><mark style="color:red;">400</mark> - An <code>ACTIVO</code> status loan with the same <code>cartId</code> already exists</summary>

{% code title="Response: 400 Bad Request" %}

```json
{
    "status": 0,
    "error": "OUTSTANDING_LOAN_ALREADY_EXISTS",
    "message": "Outstanding loan with cartId: cart-id-321 already exists"
}
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;">400</mark> - Invalid data type</summary>

{% code title="Response: 400 Bad Request" %}

```json
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;">403</mark> - Invalid Authentication token</summary>

{% code title="Response: 403 Forbidden" %}

```json
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;">500</mark> - Missing field or parameter</summary>

{% code title="Response: 500 Internal Server Error" %}

```json
{
    "timestamp": "2025-01-06T17:27:52.605+00:00",
    "status": 500,
    "error": "Internal Server Error",
    "path": "/api/loan"
}
```

{% endcode %}

</details>
