> 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/api-reference/online-api/get-payment-status.md).

# Get payment status

Environments

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

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

{% hint style="warning" %}
You can query the payment status either by `loanId` or `cartId` . You should only choose one.
{% endhint %}

## Check loan or payment status

> Retrieves the current status of a loan or payment using either \`loan\_id\` or \`cart\_id\`. You can only use one.

```json
{"openapi":"3.0.3","info":{"title":"Aplazo Online API","version":"1.0.0"},"servers":[{"url":"https://merchant.aplazo.net/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/v1/loan/status":{"get":{"summary":"Check loan or payment status","description":"Retrieves the current status of a loan or payment using either `loan_id` or `cart_id`. You can only use one.","parameters":[{"name":"loan_id","in":"query","required":false,"schema":{"type":"integer"},"description":"The unique identifier of the loan to query the status."},{"name":"cart_id","in":"query","required":true,"schema":{"type":"string"},"description":"The unique identifier of the cart/transaction on the merchant's ecommerce platform."}],"responses":{"200":{"description":"Loan or payment status retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"loanId":{"type":"integer","description":"The unique identifier of the loan."},"status":{"type":"string","enum":["ACTIVO","NO CONFIRMADO","CANCELADO / DEVUELTO"],"description":"Current status of the loan or payment."}}}}}},"404":{"description":"Cart not found."}},"tags":["Loans"]}}}}
```

## Response Examples

### Success

<details>

<summary> <mark style="color:green;">200</mark> - Sucess - query with cart_id</summary>

{% code overflow="wrap" %}

```bash
curl --location 'https://merchant.aplazo.net/api/v1/loan/status?cart_id=some-cart' \
--header 'Authorization: Bearer <token here>'
```

{% endcode %}

**Response**

{% code overflow="wrap" %}

```json
{
    "loanId": 159004,
    "status": "CANCELADO / DEVUELTO"
}
```

{% endcode %}

</details>

### Errors

<details>

<summary> <mark style="color:red;">404</mark> - CartId not found</summary>

{% code overflow="wrap" %}

```bash
curl --location 'https://merchant.aplazo.net/api/v1/loan/status?cart_id=some-cart' \
--header 'Authorization: Bearer <token here>'
```

{% endcode %}

**Response**

{% code overflow="wrap" %}

```json
{
    "message": "loan by CartId = some-cart was not found.",
    "code": "LOAN_NOT_FOUND",
    "params": [
        "CartId",
        "some-cart"
    ],
    "payload": null
}
```

{% endcode %}

</details>

<details>

<summary> <mark style="color:red;">400</mark> - Invalid query parameter</summary>

{% code overflow="wrap" %}

```bash
curl --location 'https://merchant.aplazo.net/api/v1/loan/status?cart_idx=3201' \
--header 'Authorization: Bearer <token here>'
```

{% endcode %}

{% code overflow="wrap" %}

```json
{
    "message": "Card ID (cart_id) or Loan ID (loan_id) are required",
    "code": "LOAN_STATUS_NEED_CARTID_OR_LOANID",
    "params": null,
    "payload": null
}
```

{% endcode %}

</details>
