# Subscription Notification

**Method:** `POST`

**Path:** `/ps/api/v1/public/subscriptions/notify`

**Category:** Subscriptions - Presentations

**Authentication:** Required

## Description

Sends a pre-debit notification for a subscription. This is used
when the merchant controls the PDN (Pre-Debit Notification) process.


## Request Body

Content-Type: `application/json`

- `subscription_id` (`string`) **required** — Unique identifier for the subscription.
- `due_date` (`string`) **required** — The ISO 8601 UTC Timestamp when the payment is due.
- `amount` (`object`) **required** — Monetary amount with currency for subscription-related APIs.
  - `value` (`integer`) **required** — Amount in the smallest currency unit (paisa for INR). Minimum ₹1 (100), maximum ₹10 lakh (100000000).
  - `currency` (`string`) **required** — Three-letter ISO 4217 currency code.

- `merchant_presentation_reference` (`string`) **required** — **Idempotency Key.** Unique identifier of the merchant presentation reference. Duplicate requests with the same `merchant_presentation_reference` will return the existing presentation instead of creating a new one.
- `is_merchant_retry` (`boolean`) — Indicates whether the merchant controls the retry process.

### Example Request

```json
{
  "subscription_id": "v1-sub-4405071524-aa-qlAtAf",
  "due_date": "2024-03-15T10:30:00Z",
  "amount": {
    "value": 1000,
    "currency": "INR"
  },
  "merchant_presentation_reference": "1234567890",
  "is_merchant_retry": false
}
```

## Responses

- `200` — Notification sent successfully.
- `400` — 

### Response Schema

- `subscription_id` (`string`) — Unique identifier for the subscription.
- `due_date` (`string`) — The ISO 8601 UTC Timestamp of the date & time at which the payment is due.
- `presentation_id` (`string`) — Unique identifier for the presentation.
- `amount` (`object`) — Monetary amount with currency for subscription-related APIs.
  - `value` (`integer`) **required** — Amount in the smallest currency unit (paisa for INR). Minimum ₹1 (100), maximum ₹10 lakh (100000000).
  - `currency` (`string`) **required** — Three-letter ISO 4217 currency code.

- `merchant_presentation_reference` (`string`) — Unique identifier of the merchant presentation reference.
- `pdn_status` (`CREATED | INITIATED | NOTIFIED | FAILED | CANCELLED | PAUSED | PDN_FAILED`) — Pre-debit notification status.
- `status` (`WAITING_FOR_EXECUTION | CREATED | INITIATED | NOTIFIED | FAILED | CANCELLED | PAUSED | PDN_FAILED`) — Subscription presentation status. 

### Example Response

```json
{
  "subscription_id": "v1-sub-4405071524-aa-qlAtAf",
  "due_date": "2022-09-21T17:32:28Z",
  "presentation_id": "v1-pre-4405071524-aa-qlAtAf",
  "amount": {
    "value": 1000,
    "currency": "INR"
  },
  "merchant_presentation_reference": "1234567890",
  "pdn_status": "CREATED",
  "status": "WAITING_FOR_EXECUTION"
}
```

---

Reference: https://localhost:3000/api/subscriptions-presentations/send-subscription-notification
