Skip to main content

One click (1-click) subscription upgrade

One click (1-click) subscription upgrade

Last updated: 13-Oct-2021
Rate this article:


Avangate supports 1-click manual subscription upgrades for returning customers who paid for their previous orders with Credit/Debit cards.

In this scenario, you can facilitate subscription upgrades for subscribers by enabling them to use card on file information to pay for the upgrade.

How does this work? 

  1. Identify returning customers. 
  2. Identify valid upgrade options and costs.
  3. Create a tokenized manual subscription upgrade link and serve it to the returning customer.
  4. Customers using the link land a hosted shopping cart, chose one of their credit cards they previously used for purchases from your account/store and place the order.


What do shoppers see in the cart?


Please contact Avangate to start using one click (1-click) subscription upgrades.


  • Configure the upgrade product / subscription plan in your Control Panel. 
  • Email address must match that from the initial order. If shoppers change the email they need to re-enter the payment details.


Flow comparison

  • Longer purchase funnel
  • Complex flow
  • Unused subscriber and payment on file info
  • High risk of churn
  • Shorter purchase funnel
  • Streamlined flow
  • Uses both customer and payment on file information
  • Lower risk of churn
  • Increase Customer Lifetime Value (CLTV) and recurring revenue


Detailed 1-click subscription upgrade flow

Identify returning customers

You particularly need either the Avangate customer reference or the external customer reference you control.

Use customer information



If customers log into your system and you’ve mapped unique identifiers into the Avangate platform you can easily extract their subscription information.


Use subscription information



You can also use subscription information to extract customer references, based on a set of filters. Validate the status of the subscription (needs to be Active or Past Due).

  • Customer email
  • Delivered codes/activation keys
  • Avangate customer reference
  • External customer reference
  • Subscription status
  • Recurring billing status
  • Product code
  • Customer country
  • Purchased date
  • Expiration/Renewal deadline
  • Subscription type


Validate upgrade options and costs





Retrieve the possible upgrade options for a subscription.



Retrieve information about the costs a customer incurs when upgrading a specific subscription

Create the manual upgrade link

To build custom upgrade links you need the following two elements:

1. The main upgrade path: or if you use a custom domain with Avangate 

2. The unique subscription identifier from the Avangate system: LICENSE=1234567.

The simplest upgrade link you can build is

Attach the payment token to the manual Upgrade link



Avangate attaches a unique token to links, designed to identify the returning shoppers and support the automatic extraction of payment data and billing information from the Avangate system.



function callRPC($Request, $hostUrl, $Debug = true) {
    $curl = curl_init($hostUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);
    if ($Debug) {
    $ResponseString = curl_exec($curl);
    if ($Debug) {
    if (!empty($ResponseString)) {
        $Response = json_decode($ResponseString);
        if (isset($Response->result)) {
            return $Response->result;
        if (!is_null($Response->error)) {
            var_dump($Request->method, $Response->error);
    } else {
        return null;
$host = '';
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel:
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel:

$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);
$i = 1; // counter for API calls
// call login
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;
$sessionID = callRPC($jsonRpcRequest, $host);
$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail  = null;
$SubscriptionSearch->DeliveredCode = '___TEST___CODE____123';
$SubscriptionSearch->AvangateCustomerReference = '449686020';
$SubscriptionSearch->ExternalCustomerReference = null;
$SubscriptionSearch->Aggregate = false;
$SubscriptionSearch->SubscriptionEnabled = null; //true false null
$SubscriptionSearch->RecurringEnabled = null; // true - autorenewal, false - manual renewal, null = both(default) 
$SubscriptionSearch->ProductCodes = null; //array('Product_Code1', 'Product_Code2');
$SubscriptionSearch->CountryCodes = null;//array ('au')
$SubscriptionSearch->PurchasedAfter = null;
$SubscriptionSearch->PurchasedBefore = null;
$SubscriptionSearch->ExpireAfter = null;
$SubscriptionSearch->ExpireBefore = null;
$SubscriptionSearch->RenewedAfter = null;
$SubscriptionSearch->RenewedBefore = null;
$SubscriptionSearch->NotificationAfter = null;
$SubscriptionSearch->NotificationBefore = null;
$SubscriptionSearch->LifetimeSubscription = null;
$SubscriptionSearch->Type = 'regular'; //'trial', 'regular', 'regularfromtrial'
$SubscriptionSearch->TestSubscription = null; // true, false, null = both(default) 
$SubscriptionSearch->Page = 1;
$SubscriptionSearch->Limit = 10;
$jsonRpcRequest = array (
        'method' => 'searchSubscriptions',
        'params' => array($sessionID, $SubscriptionSearch),
        'id' => $i++,
        'jsonrpc' => '2.0');
$allsubscriptions = callRPC((Object)$jsonRpcRequest, $host, true);
$subscriptionReference = $allsubscriptions[0]->SubscriptionReference;

//retrieve all the upgrade options for a subscription
$jsonRpcRequest = array (
        'method' => 'getProductUpgradeOptions',
        'params' => array($sessionID, $subscriptionReference),
        'id' => $i++,
        'jsonrpc' => '2.0');
$optionsforUpgrade = callRPC((Object)$jsonRpcRequest, $host, true);
//retrieve information about the costs a customer incurs when upgrading a specific subscription
$productCode = $optionsforUpgrade[1]->ProductInfo->ProductCode;
$Currency = 'usd';
$Options = 'emailsupport'.';'.'oneuser1';
$jsonRpcRequest = array (
        'method' => 'getProductUpgradeOptionsPrice',
        'params' => array($sessionID, $subscriptionReference, $productCode, $Currency, $Options),
        'id' => $i++,
        'jsonrpc' => '2.0');
callRPC((Object)$jsonRpcRequest, $host, true);
$jsonRpcRequest = array (
        'jsonrpc' => '2.0',
        'id' => $i++,
        'method' => 'getProductByCode',
        'params' => array($sessionID, $productCode)
$upgrtadebleProduct = callRPC((Object)$jsonRpcRequest, $host, true);
$upgrtadebleProductID = $upgrtadebleProduct->AvangateId;
$Options = 'emailsupport'.','.'oneuser1';//Replace the ; separator with , for use with query strings
//$upgradelink = "".$subscriptionReference; //This is the simplest upgrade link you can build and use to generate a tokenized upgrade checkout URL
$upgradelink = "".$subscriptionReference."&UPGRADEPROD=".$upgrtadebleProductID."&UPGRADEOPT=".$Options; 
$IdCustomer = $allsubscriptions[0]->AvangateCustomerReference;
$CustomerType = 'AvangateCustomerReference';
$Url = $upgradelink;
$ValidityTime = 10;
$ValidationIp = null;
$jsonRpcRequest = array (
        'method' => 'getSingleSignOnInCart',
        'params' => array($sessionID, $IdCustomer, $CustomerType, $Url, $ValidityTime, $ValidationIp),
        'id' => $i++,
        'jsonrpc' => '2.0');
$upgradeSSOURL = callRPC((Object)$jsonRpcRequest, $host, true);
header("Location: $upgradeSSOURL");
Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo