# Create subscription with SBMD enabled

**Method:** `POST`

**Path:** `/ps/public/subscriptions/sbmd`

**Category:** UPI Reserve Pay

**Authentication:** Required

## Description

Endpoint used by CMS to create subscription with SBMD enabled

## Request Body

Content-Type: `application/json`

- `merchant_subscription_reference` (`string`) **required** — Unique reference ID for the subscription provided by the merchant
- `customer_id` (`string`) **required** — Unique identifier for the customer associated with the subscription
- `plan_details` (`object`) **required**
  - `reserve_amount` (`integer`) **required** — Amount to be reserved
  - `currency` (`INR | USD`) **required** — Currency code for the subscription
  - `validity_days` (`integer`) **required** — Validity of the subscription in days
  - `description` (`string`) **required** — Description of the SBMD Plan

- `callback_url` (`string`) — URL
- `expire_after` (`integer`) — duration after which subscription expires
- `terms_accepted` (`boolean`) — pending
- `merchant_metadata` (`object`) — A key-value pair of merchant-specific metadata.

### Example Request

```json
{
  "merchant_subscription_reference": "sub_ref_12345",
  "customer_id": "cust_abc123",
  "plan_details": {
    "reserve_amount": 10000,
    "currency": "INR",
    "validity_days": 0,
    "description": "your_description"
  },
  "merchant_metadata": {
    "key1": "DD",
    "key2": "XOF"
  }
}
```

## Responses

- `200` — Success
- `400` — Bad Requet
- `500` — Internal Server Error

### Response Schema

- `subscription_id` (`string`) — Unique identifier for the created subscription
- `order_id` (`string`) — order_id for the created order
- `customer_id` (`string`) — customer_id passed
- `status` (`string`) — Current status of the subscription after creation
- `start_date` (`string`) — Subscription start timestamp
- `end_date` (`string`) — Subscription end timestamp
- `plan_details` (`object`)
  - `reserve_amount` (`integer`) **required** — Amount to be reserved
  - `currency` (`INR | USD`) **required** — Currency code for the subscription
  - `validity_days` (`integer`) **required** — Validity of the subscription in days
  - `description` (`string`) **required** — Description of the SBMD Plan

- `expires_at` (`string`)
- `redirect_url` (`string`) — RedirectURL

### Example Response

```json
{
  "subscription_id": "sub_xyz789",
  "status": "ACTIVE",
  "plan_details": {
    "reserve_amount": 10000,
    "currency": "INR",
    "validity_days": 0,
    "description": "your_description"
  }
}
```

---

Reference: https://localhost:3000/api/upi-reserve-pay/create-sbmd-subscription
