# Check Payment Status

Poll the live status of an order by its `order_id`.

**GET** `/api/paylater/merchant-portal/v2/web-checkout/status`

- Sandbox: `https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/status`
- Production: `https://connect.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/status`

> **Info: Authentication**
>
> All requests require a bearer token from the [OAuth 2.0 token endpoint](https://docs.paylaterapp.com/authentication.html). Pass it as `Authorization: Bearer <ACCESS_TOKEN>`.

## Request

#### Headers

| Header | Value |
| --- | --- |
| `Authorization` | `Bearer <ACCESS_TOKEN>` |

**Query parameters**

- `order_id` (String, required): Unique order ID.

### Example request

**cURL**

```bash
curl --location 'https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/status?order_id=000072152' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>'
```

**Node.js**

```javascript
const res = await fetch(
  'https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/status?order_id=000072152',
  {
    method: 'GET',
    headers: {
      Authorization: `Bearer ${accessToken}`,
    },
  },
);

const status = await res.json();
```

**Python**

```python
import requests

resp = requests.get(
    "https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/status",
    headers={
        "Authorization": f"Bearer {access_token}",
    },
    params={
        "order_id": "000072152",
    },
)

status = resp.json()
```

**PHP**

```php
$ch = curl_init('https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/status?order_id=000072152');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $accessToken,
    ],
]);

$status = json_decode(curl_exec($ch), true);
```

## Response

The response reflects the current state of the order. The `status` field is the canonical indicator — see [Status codes](https://docs.paylaterapp.com/check-payment-status.html#status-codes) below.

**Not initiated**

```json
{
  "message": "Order not initiated",
  "status": 0
}
```

**Pending**

```json
{
  "payLaterOrderId": "PL1744792493935483",
  "message": "pending",
  "merchantReference": "000072152",
  "status": 1
}
```

**Success**

```json
{
  "payLaterOrderId": "PL1744792493935483",
  "message": "success",
  "merchantReference": "000072152",
  "status": 2
}
```

**Failed**

```json
{
  "payLaterOrderId": "PL1744792493935483",
  "message": "failed",
  "merchantReference": "000072152",
  "status": 3
}
```

## Status codes

| status | Meaning |
| --- | --- |
| `0` | Customer did not proceed |
| `1` | Pending |
| `2` | Success |
| `3` | Failed |

## Errors

```json
{
  "error": "Order ID is required"
}
```

> **Tip: Prefer webhooks**
>
> For production, subscribe to [webhooks](https://docs.paylaterapp.com/webhooks.html) instead of tight polling.
