> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete an Offer Linked to a Subscription

> Delete an Offer linked to a Subscription using the Razorpay API.

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
  <span>🇺🇸 United States</span>
</div>

Use this endpoint to delete an Offer linked to a Subscription.

<RequestExample>
  ```bash Curl theme={null}
  curl -u [YOUR_KEY_ID]:YOUR_KEY_SECRET] \
  -X DELETE https://api.razorpay.com/v1/subscriptions/sub_00000000000001/offer_JHD834hjbxzhd38d \
  ```

  ```java Java theme={null}
  RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  String subscriptionId = "sub_00000000000001";

  String offerId = "offer_JHD834hjbxzhd38d";

  Subscription subscription = razorpay.subscription.deleteSubscriptionOffer(subscriptionId, offerId);
  ```

  ```php PHP theme={null}
  $api = new Api($key_id, $secret);

  $api->subscription->fetch($subscriptionId)->deleteOffer($offerId)
  ```

  ```javascript Node.js theme={null}
  var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

  instance.subscriptions.deleteOffer(subscriptionId, offerId)
  ```

  ```python Python theme={null}
  import razorpay
  client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

  client.subscription.delete_offer(subscriptionId, offerId)
  ```

  ```ruby Ruby theme={null}
  require "razorpay"
  Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

  subscriptionId = "sub_00000000000001"

  offerId = "offer_JHD834hjbxzhd38d"
  ```

  ```go Go theme={null}
  import ( razorpay "github.com/razorpay/razorpay-go" )
  client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

  body, err := client.Subscription.DeleteOffer("<subscriptionId>", "<offerId>", nil, nil)
  ```

  ```csharp .NET theme={null}
  RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  string subscriptionId = "sub_I3GGEs7Xgmnozy";

  string offerId = "offer_JCTD1XMlUmzF6Z";

  Subscription subscription = client.Subscription.Fetch(subscriptionId).DeleteOffer(offerId);
  ```

  ```bash CLI theme={null}
  razorpay subscriptions delete-offer sub_ABC123 offer_ABC123
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "id": "sub_00000000000001",
    "entity": "subscription",
    "plan_id": "plan_00000000000001",
    "customer_id": "cust_D00000000000001",
    "status": "active",
    "current_start": 1577355871,
    "current_end": 1582655400,
    "ended_at": null,
    "quantity": 1,
    "notes":{
      "notes_key_1": "Tea, Earl Grey, Hot",
      "notes_key_2": "Tea, Earl Grey… decaf."
    },
    "charge_at": 1577385991,
    "start_at": 1577385991,
    "end_at": 1603737000,
    "auth_attempts": 0,
    "total_count": 6,
    "paid_count": 1,
    "customer_notify": true,
    "created_at": 1577356081,
    "expire_by": 1577485991,
    "short_url": "https://rzp.io/i/z3b1R61A9",
    "has_scheduled_changes": false,
    "change_scheduled_at": null,
    "source": "api",
    "offer_id": null,
    "remaining_count": 5
  }
  ```

  ```json Failure theme={null}
  {
    "error": {
      "code": "BAD_REQUEST_ERROR",
      "description": "The api key provided is invalid",
      "source": "NA",
      "step": "NA",
      "reason": "NA",
      "metadata": {}
    }
  }
  ```
</ResponseExample>

## Path Parameters

<ParamField path="sub_id" type="string" required>
  The unique identifier of the Subscription from which you want to remove the offer. For example, `sub_00000000000001`.
</ParamField>

<ParamField path="offer_id" type="string" required>
  The unique identifier of the offer you want remove from the Subscription. For example, `offer_JHD834hjbxzhd38d`.
</ParamField>

## Response Parameters

<ResponseField name="id" type="string">
  The unique identifier of the subscription created. For example, `sub_00000000000001`.
</ResponseField>

<ResponseField name="entity" type="string">
  The entity being created. Here, it will be `subscription`.
</ResponseField>

<ResponseField name="plan_id" type="string">
  The unique identifier for a plan that is linked to the created subscription. For example, `plan_00000000000001`.
</ResponseField>

<ResponseField name="customer_id" type="string">
  The unique identifier of the customer linked to the subscription. This is populated automatically once the customer completes the authorisation transaction. For example, `cust_00000000000001`.
</ResponseField>

<ResponseField name="status" type="string">
  Status of the subscription. Refer to the [life cycle section](/docs/us/payments/subscriptions/states) for more details. Possible values:

  * `created`
  * `authenticated`
  * `active`
  * `pending`
  * `halted`
  * `cancelled`
  * `completed`
  * `expired`
</ResponseField>

<ResponseField name="current_start" type="integer">
  Unix timestamp. The start time of the current billing cycle of the subscription. For example, `1581013800`.
</ResponseField>

<ResponseField name="current_end" type="integer">
  Unix timestamp. The end time of the current billing cycle of the subscription. For example, `1581013800`.
</ResponseField>

<ResponseField name="ended_at" type="integer">
  The timestamp, in Unix format, when the subscription was completed or was cancelled. For example, `1581013800`.
</ResponseField>

<ResponseField name="quantity" type="integer">
  The number of times the plan should be linked to the subscription. For example, if the plan is ₹100/user/month and the customer has 5 users, you should pass 5 as the quantity to have the customer charged ₹500 (5 x ₹100) monthly. By default, this value is set to 1.
</ResponseField>

<ResponseField name="notes" type="object">
  Notes you can enter for the contact for future reference. This is a key-value pair. You can enter a maximum of 15 key-value pairs. For example, `"note_key": "Beam me up Scotty”`.
</ResponseField>

<ResponseField name="charge_at" type="integer">
  Unix timestamp. This indicates when the next charge on the subscription should be made. For example, `1581013800`.
</ResponseField>

<ResponseField name="offer_id" type="string">
  The unique identifier of the offer that should be linked to the subscription. For example, `offer_JHD834hjbxzhd38d`.
</ResponseField>

<ResponseField name="start_at" type="integer">
  The timestamp, in Unix format, when the subscription should start. If not passed, the subscription starts immediately after the authorisation payment. For example, `1581013800`.
</ResponseField>

<ResponseField name="end_at" type="integer">
  The timestamp, in Unix format, when the subscription should end. For example, `1581013800`.
</ResponseField>

<ResponseField name="auth_attempts" type="integer">
  The number of times that the charge for the current billing cycle has been attempted on the card. For example, `2`.
</ResponseField>

<ResponseField name="total_count" type="integer">
  The number of billing cycles for which the customer should be charged. For example, `2`. We support subscriptions for a maximum duration of 100 years. The number of billing cycles depends if the subscription is daily, weekly, monthly or yearly.
</ResponseField>

<ResponseField name="paid_count" type="integer">
  This indicates the number of billing cycles for which the customer has already been charged. For example, `2`.
</ResponseField>

<ResponseField name="customer_notify" type="boolean">
  Indicates whether the communication to the customer would be handled by businesses or Razorpay.

  * `true`: Communication handled by Razorpay. Defaults to `true`.
  * `false`: Communication handled by businesses.
</ResponseField>

<ResponseField name="created_at" type="integer">
  The timestamp, in Unix format, when the subscription was created. For example, `1581013800`.
</ResponseField>

<ResponseField name="expire_by" type="integer">
  The timestamp, in Unix format, till when the customer can make the authorisation payment. For example, `1581013800`.
</ResponseField>

<ResponseField name="short_url" type="string">
  URL that can be used to make the authorisation payment. For example, `https://rzp.io/i/PWtAiEo`.
</ResponseField>

<ResponseField name="has_scheduled_changes" type="boolean">
  Indicates if the subscription has any scheduled changes. Possible values:

  * `true`: Subscription has scheduled changes.
  * `false`: Subscription does not have scheduled changes.
</ResponseField>

<ResponseField name="schedule_change_at" type="string">
  Represents when the subscription should be updated. Possible values:

  * `now` (default): Updates the subscription immediately.
  * `cycle_end`: Updates the subscription at the end of the current billing cycle.
</ResponseField>

<ResponseField name="remaining_count" type="integer">
  This indicates the number of billing cycles remaining on the subscription. For example, `2`.
</ResponseField>

## Errors

<AccordionGroup>
  <Accordion title="The API key/secret provided is invalid.">
    **Code:** `4xx`

    This error occurs due to a mismatch between the API credentials passed in the API call and those generated on the Dashboard.

    **Solution:** Ensure that the API keys are active and correctly entered, with no whitespaces before or after the keys.
  </Accordion>

  <Accordion title="The id provided is invalid or could not be found.">
    **Code:** `400`

    The subscription id (or `offer_id`) in the URL is malformed (wrong prefix or non-existent).

    **Solution:** Pass valid `sub_<14 chars>` and `offer_<14 chars>` ids in the URL.
  </Accordion>
</AccordionGroup>
