> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rmz.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Subscription

> Retrieve detailed information for a specific subscription.

# Get Subscription

<div className="flex items-center gap-2 mb-4">
  <span className="px-2 py-1 bg-green-100 text-green-800 rounded text-sm font-mono font-bold">GET</span>
  <code>/subscriptions/{"{id}"}</code>
</div>

Returns full details for a single customer subscription, including product, customer, and order information.

<Snippet file="rmz-plus-required.mdx" />

## Authentication

<Snippet file="auth-bearer-header.mdx" />

## Headers

| Header          | Value                   | Required    |
| --------------- | ----------------------- | ----------- |
| `Authorization` | `Bearer YOUR_API_TOKEN` | Yes         |
| `Accept`        | `application/json`      | Recommended |

## Path Parameters

| Parameter | Type    | Required | Description         |
| --------- | ------- | -------- | ------------------- |
| `id`      | integer | Yes      | The subscription ID |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://merchant-api.rmz.gg/shawarma/subscriptions/501" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://merchant-api.rmz.gg/shawarma/subscriptions/501", {
    headers: { "Authorization": "Bearer YOUR_API_TOKEN" }
  });
  const subscription = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://merchant-api.rmz.gg/shawarma/subscriptions/501",
      headers={"Authorization": "Bearer YOUR_API_TOKEN"}
  )
  subscription = response.json()
  ```

  ```php PHP theme={null}
  $ch = curl_init("https://merchant-api.rmz.gg/shawarma/subscriptions/501");
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer YOUR_API_TOKEN"
  ]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>

## Success Response

```json theme={null}
{
  "message": null,
  "data": {
    "id": 501,
    "status": "active",
    "external_customer_id": "usr_abc123",
    "starts_at": "2024-01-01",
    "ends_at": "2024-12-31",
    "start_date": "2024-01-01",
    "end_date": "2024-12-31",
    "current_period_start": "2024-01-01T00:00:00.000000Z",
    "current_period_end": "2024-12-31T00:00:00.000000Z",
    "trial_ends_at": null,
    "cancel_at_period_end": false,
    "canceled_at": null,
    "duration": "annually",
    "order_id": 78901,
    "auto_renew": true,
    "price": {
      "amount": 199.99,
      "formatted": "١٩٩٫٩٩ ر.س",
      "currency": "SAR"
    },
    "metadata": {
      "external_user_id": "usr_abc123",
      "plan": "pro"
    },
    "product": {
      "id": 102,
      "name": "Pro Plan",
      "slug": "pro-plan",
      "type": "subscription"
    },
    "variant": {
      "id": 15,
      "duration": "annually",
      "duration_text": "سنه",
      "price": 199.99
    },
    "payment_method": {
      "last_four": "4242",
      "scheme": "visa"
    },
    "scheduled_variant": null,
    "features": null,
    "is_active": true,
    "is_expired": false,
    "days_remaining": 276,
    "created_at": "2024-01-01T00:00:00.000000Z",
    "updated_at": "2024-01-01T00:00:00.000000Z"
  },
  "api": "rmz.shawarma",
  "timestamp": 1699999999
}
```

## Response Fields

| Field                   | Type        | Description                                                                                                                                                                                                 |
| ----------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                    | integer     | Subscription ID                                                                                                                                                                                             |
| `status`                | string      | Current status: `trialing`, `active`, `past_due`, `paused`, `canceled`, `expired`                                                                                                                           |
| `external_customer_id`  | string/null | Stable identifier the merchant supplied at checkout creation. Use this to correlate RMZ subscriptions with your own user records. `null` if not supplied.                                                   |
| `current_period_start`  | string      | Start of current billing period (ISO 8601)                                                                                                                                                                  |
| `current_period_end`    | string      | End of current billing period (ISO 8601)                                                                                                                                                                    |
| `trial_ends_at`         | string/null | When the trial ends (null if no trial)                                                                                                                                                                      |
| `cancel_at_period_end`  | boolean     | Whether the subscription will cancel at end of current period                                                                                                                                               |
| `canceled_at`           | string/null | When cancellation was requested                                                                                                                                                                             |
| `paused_at`             | string      | ISO 8601 timestamp recording when the subscription was paused. Only present when `status` is `paused`.                                                                                                      |
| `paused_remaining_days` | integer     | Number of days that were remaining in the current period at the moment of pause. When the subscription is unpaused, this many days are added to the new period end. Only present when `status` is `paused`. |
| `next_retry_at`         | string      | ISO 8601 timestamp for when the next automatic retry charge will be attempted. Only present when `status` is `past_due`.                                                                                    |
| `duration`              | string      | Duration key: `monthly`, `quarterly`, `semiAnnual`, `annually`, `biennial`, `quinquennial`, `decennial`                                                                                                     |
| `order_id`              | integer     | Original order ID                                                                                                                                                                                           |
| `auto_renew`            | boolean     | Whether auto-renewal is active (has saved card and not canceling)                                                                                                                                           |
| `price`                 | object      | The locked subscription price (set at creation, immune to variant price changes)                                                                                                                            |
| `metadata`              | object/null | Custom key-value pairs attached at checkout session creation                                                                                                                                                |
| `product`               | object      | The subscription product (id, name, slug, type)                                                                                                                                                             |
| `variant`               | object      | Current subscription variant (id, duration, duration\_text, price)                                                                                                                                          |
| `payment_method`        | object/null | Saved card info (last\_four, scheme) — only if auto-renew is active                                                                                                                                         |
| `scheduled_variant`     | object/null | Pending variant change (applied at next renewal)                                                                                                                                                            |
| `is_active`             | boolean     | Whether the subscription currently grants access                                                                                                                                                            |
| `is_expired`            | boolean     | Whether the subscription has expired                                                                                                                                                                        |
| `days_remaining`        | integer     | Number of days remaining in current period                                                                                                                                                                  |

## Error Responses

| Code  | Description                             |
| ----- | --------------------------------------- |
| `401` | Unauthorized — invalid or missing token |
| `404` | Subscription not found                  |
