# Get Transaction by Order ID

Retrieve full customer, loan/instalment, and status details for one order.

**GET** `/api/paylater/merchant-portal/v2/web-checkout/transactions/{order_id}`

- Sandbox: `https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/transactions/{order_id}`
- Production: `https://connect.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/transactions/{order_id}`

> **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>` |

**Path parameters**

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

### Example request

**cURL**

```bash
curl --location 'https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/transactions/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/transactions/000072152',
  {
    method: 'GET',
    headers: {
      Authorization: `Bearer ${accessToken}`,
    },
  },
);

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

**Python**

```python
import requests

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

transaction = resp.json()
```

**PHP**

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

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

## Response

A `200 OK` returns the customer, loan/instalment, and status details for the order.

**200 OK**

```json
{
  "id": 10129,
  "customer": {
    "fullName": "JOHN SMITH",
    "mobileNumber": "97466955189",
    "email": "john@test.com",
    "allowedSpendingLimit": "25000.0"
  },
  "loan": {
    "emi": 154.75,
    "grantedAmount": 619.00,
    "installmentAmount": 154.75,
    "noOfTerms": 4
  },
  "orderStatus": {
    "message": "pending",
    "status": 1
  }
}
```

If the order exists but the customer has not yet started the checkout, the response indicates that the order has not been initiated.

**Not initiated**

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

## Errors

```json
{
  "message": "Order not initiated"
}
```

```json
{
  "message": "Order ID not found"
}
```

See [Error handling & response codes](https://docs.paylaterapp.com/errors.html) for the full catalogue.
