Skip to main content

One click (1-click) subscription renewal

One click (1-click) subscription renewal

Last updated: 14-Apr-2022
Rate this article:

Overview

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

In this scenario, you can facilitate subscription renewals for subscribers who opted out of auto-renewal (recurring billing).

How does this work? 

  1. Identify returning customers. 
  2. Generate the manual renewal link.
  3. Create a tokenized manual subscription renewal link and serve it to the returning customer.
  4. Customers using the link land on a hosted shopping cart, then chose a credit card they previously used for purchases from your account/store and place the order.

Availability

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

Requirements 

  • Make sure that the subscription is eligible:
    • Status needs to be Active or Past Due
    • Subscriptions cannot be evergreen​
  • The email address must match that of 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 renewal flow

Identify returning customers

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

Use customer information

getCustomerSubscriptions 

 

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

searchSubscriptions 

 

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

 

Create the manual renewal link

getRenewalDetails 

Retrieve information regarding subscription renewals based on Avangate Subscription References:

  • Information on the automatic renewal (recurring billing) status (enabled or disabled).
  • The link that customers access to renew the subscription though a manual payment.

 

Attach the payment token to the manual renewal link

getSingleSignOnInCart

 

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.

 

Example



<?php
$host   = "https://api.avangate.com";
$client = new SoapClient($host . "/soap/3.0/?wsdl", array(
    'location' => $host . "/soap/3.0/",
    "stream_context" => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    ))
));
function hmac($key, $data)
{
    $b = 64; // byte length for md5
    if (strlen($key) > $b) {
        $key = pack("H*", md5($key));
    }
    
    $key    = str_pad($key, $b, chr(0x00));
    $ipad   = str_pad('', $b, chr(0x36));
    $opad   = str_pad('', $b, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$now          = date('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);
try {
    $sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage();
    exit;
}
 
var_dump($sessionID);
$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail  = null;
$SubscriptionSearch->DeliveredCode = '___TEST___CODE____123';
$SubscriptionSearch->AvangateCustomerReference = '123456789';
$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;
try {
    $allsubscriptions = $client->searchSubscriptions($sessionID, $SubscriptionSearch);
}
catch (SoapFault $e) {
    echo "allsubscriptions: " . $e->getMessage();
    exit;
}
var_dump("allsubscriptions", $allsubscriptions);
$subscriptionReference = $allsubscriptions[0]->SubscriptionReference;
 
try {
    $manualrenewallink = $client->getRenewalDetails($sessionID, $subscriptionReference);
}
catch (SoapFault $e) {
    echo "manualrenewallink: " . $e->getMessage();
    exit;
}
var_dump("manualrenewallink", $manualrenewallink);

$IdCustomer = $allsubscriptions[0]->AvangateCustomerReference;
$CustomerType = 'AvangateCustomerReference';
$Url = $manualrenewallink->ManualRenewalLink;
$ValidityTime = 10;
$ValidationIp = null;
try {
    $ssoLINK = $client->getSingleSignOnInCart($sessionID, $IdCustomer, $CustomerType, $Url, $ValidityTime, $ValidationIp);
}
catch (SoapFault $e) {
    echo "ssoLINK: " . $e->getMessage();
    exit;
}
var_dump("ssoLINK", $ssoLINK);

 

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