Retrieve eligible enrollment campaigns
Use the getEligibleEnrollmentCampaigns method to retrieve all the automatic renewal enrollment campaigns a subscription is eligible for, so you can offer the shopper a discount to enable automatic renewal. Enrollment campaigns have no translations, so this method has no Language parameter.
A subscription is eligible when automatic renewal is disabled, the subscription is active, and there is an active enrollment campaign for its product. The criteria are the same as for the existing myAccount flow.
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.
Request sample
<?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';
$result = $client->getEligibleEnrollmentCampaigns($sessionID, $subscriptionReference);
var_dump($result);
} catch (SoapFault $e) {
echo 'SoapFault: ' . $e->getMessage() . PHP_EOL;
}Response parameters
EligibleEnrollmentCampaignsResponse
Array of objects
Response sample
Error codes
INVALID_SUBSCRIPTION_REFERENCE
The subscription reference is invalid or belongs to a different merchant.
Last updated
Was this helpful?