Some content on this site may not be available right now. We are aware and actively monitoring the situation.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Enter enrollment campaign

Use the enterEnrollmentCampaign method to record that a shopper interacted with an enrollment campaign offer, even if they do not accept it. The method records a DISPLAY impression for the campaign. If the shopper abandons the offer, the impression stays recorded and is available in the retention reports.

This method only records intent. It does not enable automatic renewal and does not create a discount. To apply the discount, call acceptEnrollmentCampaignDiscount.

Request parameters

Parameter
Type / Description

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 the shopper interacted with.

Request sample

example.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->enterEnrollmentCampaign($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, expired, or the subscription is not eligible for the campaign.

INVALID_SUBSCRIPTION_REFERENCE

The subscription reference is invalid or belongs to a different merchant.

Last updated

Was this helpful?