Retrieve next renewal price
Use the getNextRenewalPrice method to retrieve information on the costs customers incur on the next renewal for a subscription, per the recurring billing configuration.
For a subscription that has addons, the method returns the combined price of the main subscription and its addons, together with a price breakdown for each of them. By default, 2Checkout includes all active addon subscriptions that have automatic renewal enabled. Use AddonReferences to price only specific addons. The price breakdown is available when the add-on renewal pricing feature is enabled for your account.
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.
Currency
Required (string). ISO 4217 code.
AddonReferences
Optional (array of strings)
The references of the addon subscriptions to include in the price. When you omit it, 2Checkout includes all active addon subscriptions with automatic renewal enabled.
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 = 'YOUR_SUBSCRIPTION_REFERENCE';
$Currency = 'eur';
$AddonReferences = array('YOUR_ADDON_SUBSCRIPTION_REFERENCE'); //optional
$result = $client->getNextRenewalPrice(
$sessionID,
$subscriptionReference,
$Currency,
$AddonReferences
);
var_dump($result);
} catch (SoapFault $e) {
echo 'SoapFault: ' . $e->getMessage() . PHP_EOL;
}
Response parameters
Object
Response sample
Last updated
Was this helpful?