> For the complete documentation index, see [llms.txt](https://docs.2checkout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/subscription-churn-prevention-campaigns/accept-enrollment-campaign-discount.md).

# Accept enrollment campaign discount

Use the **acceptEnrollmentCampaignDiscount** method to enable automatic renewal (AR) for a subscription and apply the discount of an enrollment campaign. On a successful call:

• Automatic renewal is enabled for the subscription.

• A custom renewal price is created from the campaign discount.

• If the subscription already had a discount from a previous campaign, the new discount replaces it. Discounts do not stack.

• The LICENCE\_AR\_ENROLLMENT\_CAMPAIGN\_ACCEPTED license change notification (LCN) is dispatched, if enabled.

The method re-validates the campaign server-side every time, so you do not need to call getEligibleEnrollmentCampaigns first. If the campaign expired between your calls, the request fails and automatic renewal stays disabled.

## Request parameters

<table><thead><tr><th width="201.199951171875" valign="top">Parameter</th><th valign="top">Type / Description</th></tr></thead><tbody><tr><td valign="top"><code>sessionID</code></td><td valign="top"><strong>Required (string)</strong><br>Session identifier, the output of the <strong>Login</strong> method. Include <code>sessionID</code> into all your requests. 2Checkout throws an exception if the values are incorrect. The <code>sessionID</code> expires in 10 minutes.</td></tr><tr><td valign="top"><code>SubscriptionReference</code></td><td valign="top"><strong>Required (string)</strong><br>Unique, system-generated subscription identifier.</td></tr><tr><td valign="top"><code>CampaignCode</code></td><td valign="top"><strong>Required (string)</strong><br>The code of the enrollment campaign whose discount you want to accept.</td></tr></tbody></table>

### Request sample

```php
<?php

$vendorCode = 'YOUR_VENDOR_CODE';
$apiKey     = 'YOUR_API_KEY';
$date       = gmdate('Y-m-d H:i:s');
$hash       = hash_hmac(
    'md5',
    strlen($vendorCode) . $vendorCode . strlen($date) . $date,
    $apiKey
);

try {
    $client = new SoapClient(
        'https://api.2checkout.com/soap/6.0?wsdl',
        ['cache_wsdl' => WSDL_CACHE_NONE]
    );

    $sessionID = $client->login($vendorCode, $date, $hash);

    $subscriptionReference = '351D8F557E';
    $campaignCode = 'UGPPKKJY5L1LHBFPHKQ3';

    $result = $client->acceptEnrollmentCampaignDiscount($sessionID, $subscriptionReference, $campaignCode);
    var_dump($result);
} catch (SoapFault $e) {
    echo 'SoapFault: ' . $e->getMessage() . PHP_EOL;
}

```

## Response parameters

| Type        | Description                                                                    |
| ----------- | ------------------------------------------------------------------------------ |
| **Boolean** | **true** or **false** depending on whether the changes were successful or not. |

## Error codes

| Error code                                  | Description                                                               |
| ------------------------------------------- | ------------------------------------------------------------------------- |
| **INVALID\_CAMPAIGN**                       | The campaign code is invalid, unknown or expired.                         |
| **ALREADY\_REGISTERED\_ENROLLMENT**         | The subscription already has an active enrollment campaign.               |
| **ALREADY\_REGISTERED\_CANCELLATION**       | The subscription already has an active churn campaign.                    |
| **ALREADY\_REGISTERED\_CANCELLATION\_SAME** | The subscription already has this same churn campaign active.             |
| **INVALID\_SUBSCRIPTION\_REFERENCE**        | The subscription reference is invalid or belongs to a different merchant. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/subscription-churn-prevention-campaigns/accept-enrollment-campaign-discount.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
