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
sessionID
Required (string)
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes.
SubscriptionReference
Required (string) Unique, system-generated subscription identifier.
CampaignCode
Required (string) The code of the enrollment campaign whose discount you want to accept.
Request sample
<?php
require('PATH_TO_AUTH');
$subscriptionReference = '351D8F557E';
$campaignCode = 'UGPPKKJY5L1LHBFPHKQ3';
$jsonRpcRequest = [
'method' => 'acceptEnrollmentCampaignDiscount',
'params' => [$sessionID, $subscriptionReference, $campaignCode],
'id' => $i++,
'jsonrpc' => '2.0'
];
var_dump(callRPC((object)$jsonRpcRequest, $host, true));
Response parameters
Boolean
true or false depending on whether the changes were successful or not.
Error codes
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.
Last updated
Was this helpful?