Skip to main content

Create an upsell campaign

Overview

Use the createUpSellCampaign method to create an upsell campaign via JSON-RPC API 6.0.

Request parameters

Parameters Type Required/Optional Description

Name

String

Required

Name of campaign, max 500 characters.

StartDate

String

Optional

The date when the up-sell campaign starts, in the YYYY-MM-DD format. Can be NULL (starts immediately after enabling).

EndDate

String

Optional

The date when the up-sell campaign ends, in the YYYY-MM-DD format. Can be NULL (ends immediately after disabling).

DisplayForManualRenewals

Boolean/Integer

Required

Flag to control if the campaign will be displayed for manual subscription renewal orders. Can be set as true/false/0/1.

Discount

Object

Required

Discount definition object, details below:

      Type

String

Required

Type of discount. Can be FIXED or PERCENT.

      Value

Integer

Required

Percentage discount value (PERCENT discount only).

      Values

Array of objects

Required

List of currency discounts (FIXED discount only), details below:

            Currency

String

Required

Code of Currency for the related amount.

            Amount

Integer

Required

Discount amount value for the related currency.

      DefaultCurrency

String

Required

Code of default Currency (FIXED discount only).

PrimaryProduct

Object

Required

Main (primary) product object, details below:

      Code

String

Required

The code of the product that the recommendation is made for.

      Quantity

Integer

Required

The quantity for the primary product. Can be 0 (standing for any quantity).

      PriceOptions

Array of objects

Optional

Price options list for the primary product, details below:

            Code

String

Required

Price option group code.

            Options

Array of objects

Optional

Price options list, details below:

                  Code

String

Required

Price option code.

                  Value

Integer

Optional

Price option value (for scale interval price option group only).

RecommendedProduct

Object

Required

Recommended product object, details below:

      Code

String

Required

The code of the recommended product.

      Quantity

Integer

Required

The quantity for the recommended product. Can be 0 (standing for “match quantity” setting).

      PriceOptions

Array of objects

Optional

Price options list for the recommended product, details below:

            Code

String

Required

Price option group code.

            Options

Array of objects

Optional

Price options list, details below:

                Code

String

Required

Price option code.

                Value

Integer

Optional

Price option value (for scale interval price option group only).

Enabled

Boolean/Integer

Required

Sets the campaign enabled or disabled. Can be set as true/false/0/1.

Description

Array of objects

Required

List of campaign language descriptions, details below:

      Language

String

Required

Code of the language.

      Text

String

Required

The text of the description in the associated language.

Response parameters

Parameters Type Description

UpSell

Object

Object containing information related to the upsell campaigns, including product information and discount settings.

Request sample

<?php
require ('PATH_TO_AUTH');

$upsell = new \stdClass();

$upsell->Name = 'December 2020 upsell campaign’;
$upsell->StartDate = '2020-12-21';
$upsell->EndDate = '2020-12-25';
$upsell->DisplayForManualRenewals = false;

// setup percent discount
$discountPercent = new \stdClass();
$discountPercent->Type = 'PERCENT';
$discountPercent->Value = 5;

// setup fixed discount
$discountFixed = new \stdClass();
$discountFixed->Type = 'FIXED';
$discountValues = [
    'USD' => 10,
    'EUR' => 8,
    'TRY' => 80,
    'RUB' => 1100,
];
$dv = [];
foreach ($discountValues as $curr => $amt) {
    $disc = new \stdClass();
    $disc->Currency = $curr;
    $disc->Amount = $amt;

    $dv[] = $disc;
}
$discountFixed->Values = $dv;

// assign discount
$upsell->Discount = $discountPercent;
# OR
# $upsell->Discount = $discountFixed;


// setup primary product
$primaryProduct = new \stdClass();
$primaryProduct->Code = $productCode;
$primaryProduct->Quantity = 1;
$ppPriceOptionGroup1 = new \stdClass();
$ppPriceOptionGroup1->Code = 'OPTGRP2';
$ppPriceOptionGroup1Option = new \stdClass();
$ppPriceOptionGroup1Option->Code = 'OptGrp2Code2';
$ppPriceOptionGroup1->Options = [$ppPriceOptionGroup1Option];

$ppPriceOptionGroup2 = new \stdClass();
$ppPriceOptionGroup2->Code = 'interval_scale_grp1';
$ppPriceOptionGroup2Option = new \stdClass();
$ppPriceOptionGroup2Option->Code = 'interval_scale_grp1-1-10';
$ppPriceOptionGroup2Option->Value = '6';
$ppPriceOptionGroup2->Options = [$ppPriceOptionGroup2Option];

$primaryProduct->PriceOptions = [$ppPriceOptionGroup1, $ppPriceOptionGroup2];
$upsell->PrimaryProduct = $primaryProduct;

// setup recommended product
$recommProduct = new \stdClass();
$recommProduct->Code = $recProductCode;
$recommProduct->Quantity = 0; // stands for “match quantity” 
$rpPriceOptionGroup1 = new \stdClass();
$rpPriceOptionGroup1->Code = 'CHECKB_LIST';
$rpPriceOptionGroup1Option1 = new \stdClass();
$rpPriceOptionGroup1Option1->Code = 'chk1';
$rpPriceOptionGroup1Option2 = new \stdClass();
$rpPriceOptionGroup1Option2->Code = 'chk3';
$rpPriceOptionGroup1->Options = [$rpPriceOptionGroup1Option1, $rpPriceOptionGroup1Option2];
$recommProduct->PriceOptions = [$rpPriceOptionGroup1];
$upsell->RecommendedProduct = $recommProduct;

$upsell->Enabled = true;

// setup languagte descriptions / texts
$enDescription = new \stdClass();
$enDescription->Language = 'EN';
$enDescription->Text = 'Buy <!--{RECOMMENDED_PRODUCT_NAME}--> for just <!--{RECOMMENDED_PRODUCT_PRICE}--> until Dec 25th';
$upsell->Description = [$enDescription];

$jsonRpcRequest = new \stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'createUpsellCampaign';
$jsonRpcRequest->params = [$sessionID, $upsell];
$jsonRpcRequest->id = $i++;

$upsellResponse = callRPC($jsonRpcRequest, $host);

 

ConvertPlus Buy-Links Signature for Dynamic Products

Overview

You can generate links for dynamic products outside the Merchant Control Panel, using the ConvertPlus parameters explained in this article. Some of the ConvertPlus buy-link parameters require a signature, to prevent any interference in the ordering process. Optional parameters also require a signature if they are included in the generated buy-link.

 

ConvertPlus parameters that require a signature

Parameter Description
return-url URL to which customers are redirected after their finalized purchase. Learn more about Redirect URL on this article.

return-type

The return method used for redirecting your customers after a successful sale. Possible values:

  • Link in the Thank You page
  • Header Redirect
expiration

Buy link expiry date. The link becomes invalid after the date from this parameter. Send as a UTC timestamp.

Example: 

1537549421 

order-ext-ref Use this parameter to set an external reference to the order.
item-ext-ref Set product identifier for your dynamic products. You can send multiple values separated by semicolon ;. 
customer-ref The 2Checkout system generates default customer numerical (integer) IDs automatically for all orders of products that feature subscriptions. Can be used for new acquisitions aggregating new subscriptions under an existing Customer account.
customer-ext-ref The external customer reference.
currency Preselected billing currency 2Checkout uses to charge your customers.
prod

The name of the dynamic product. For multiple products, send them separated by a semicolon.

Example: name1;name2;name3.

price

For dynamic products, enter the product price.

For multiple dynamic items, send the values separated by a semicolon.

Example: price1;price2;price3.

qty

The number of units (quantity) for each product in checkout, separated by a semicolon;. Do not use spaces or blanks. Example: qty=2;1.

qty works in conjunction with prod, based on their respective order. The first value of the qty parameter controls the number of units for the products whose identifier is in the first position of the prod parameter. 

Example: https://secure.2checkout.com/checkou...rchant=2COLNC&prod=6FD08E61B5;E2932D0DE2&qty=4;3

type

The type of dynamic product. Possible values:

  • digital
  • physical
  • shipping
  • tax

If type is empty or not send, the default line item is considered product.

For multiple dynamic items, send the values separated by a semicolon.

opt Defines the product pricing options.

 

URL formating rules:

 

":" is considered a pair separator

  • 1 product with 1 price option with 1 value (includes scale option type)
    • prod=code1&opt=gr1:val1
  • 1 product with 1 price option with multiple values
    • prod=code1&opt=gr1:val1:val2

 

"," is considered a value separator

  • 1 product with 2 price options with 1 value each
    • prod=code1&opt=gr1:val1,gr2:val2
  • 1 product with 2 price options with multiple values each
    • prod=code1&opt=gr1:val1:val2,gr2:val3:val4

 

";" is considered a parameter separator between products

  • 2 products with 1 price option containing 1 value
    • prod=code1;code2&opt=gr1:val1;gr2:val2
  • 2 products with 1 price option containing multiple values
    • prod=code1;code2&opt=gr1:val1:val2;gr2:val3:val4
  • 2 products with 2 price options containing 1 value each
    • prod=code1;code2&opt=gr1:val1,gr2:val2;gr3:val3,gr4:val4
  • 2 products with 2 price options containing multiple values each
    • prod=code1;code2&opt=gr1:val1:val2,gr2:val3:val4;gr3:val5:val6,gr4:val7:val8
description For dynamic products, set a description that is displayed in the checkout page. The description field is displayed only for the 'One column with payment buttons' template. The description will not be visible in the default template.
recurrence

For dynamic products, set product recurring options.

Send multiple dynamic items separated by a semicolon.

Example: period1:unit1;period2:unit2;

 

Possible values for units:

  • DAY
  • WEEK
  • MONTH
  • YEAR
  • FOREVER

*This parameter is conditioned by two other parameters: duration and renewal-price.

duration For dynamic products, set the duration of the recurrence.
renewal-price For dynamic products, set the price that should be applied to the renewal order.

ConvertPlus parameters to be included in the signature - general rules

  1. General parameters included in the signature, regardless of the type of checkout (catalog products, dynamic products, renewal, unfinished payment): return-urlreturn-typeexpirationorder-ext-refcustomer-refcustomer-ext-ref.
  2. Parameters to be included in the signature for dynamic products buy-links: currencyprod, priceqtytypeoptdescriptionrecurrencedurationrenewal-price,  item-ext-ref.
  3. Parameters to be included in the signature for manual renewal buy-links: prodqtyopt.
  4. Parameters to be included for on-the-fly pricing for catalog products: prodpriceqtyopt, coupon.
  5. The parameter to be included in order to lock the cart for catalog products: lock.
  6. Parameters to be included when an approved URL is set: in this case, all parameters will be included in the signature, when redirected after successful completion of a sale.

Build the ConvertPlus signature

To sign a ConvertPlus buy-link, you need to follow these steps:

  1. Sort the parameters that require a signature alphabetically.
  2. Serialize the parameters and append to them the length of their values.
  3. Concatenate the resulting values.
  4. The serialized value is then encrypted with your Buy Link Secret Word using the HMAC method (algorithm sha256).
  5. The resulting value is added to the buy link under the signature parameter

Example

Let's consider the following parameters:

  •     merchant = 'MCODE'
  •     dynamic = '1'
  •     prod = 'Software'
  •     price = 10
  •     currency = 'USD'
  •     qty = 1
  •     type = 'digital'
  •     expiration = 1893456000

The regular buy-link will have the following structure:

https://www.2checkout.com/checkout/buy?merchant=2COLRNC&dynamic=1&prod=Software&price=10currency=USD&qty=1&type=digital&expiration=1893456000 

This link is missing one last parameter, a signature.

Let's take a look at the list of parameters that require a signature:

  •     merchant = '2COLRNC'
  •     dynamic = '1'
  •     prod = 'Software' <-- SIGNATURE REQUIRED
  •     price = 10        <-- SIGNATURE REQUIRED
  •     currency = 'USD'        <-- SIGNATURE REQUIRED
  •     qty = 1             <-- SIGNATURE REQUIRED
  •     type = 'digital'         <-- SIGNATURE REQUIRED
  •     expiration = '1893456000' <-- SIGNATURE REQUIRED

We extract only those parameters:

  •     prod = 'Software'
  •     price = 10
  •     currency = 'USD'
  •     qty = 1
  •     type = 'digital'
  •     expiration = 1893456000

Sort the parameters alphabetically

  •     currency = 'USD'
  •     expiration = 1893456000
  •     price = 10
  •     prod = 'Software'
  •     qty = 1
  •     type = 'digital'

Serialize the values

To serialize a value, you need to prepend to it the number of letters or digits a value has. For example, the currency parameter has the 'USD' value that will be serialized as '3USD', where 3 is the number of letters that make up the value. The value of the price parameter is '10', so the serialized value will be '210', where 2 is the number of digits that make up the value.

In case a value uses special characters, to serialize it, you need to prepend to it the number of bytes in the string, also known as the UTF-8 string length. To count the bytes in the string, you can use an online bytes counter. For example, if the prod parameter has the 'ελληνικά' value, this will be serialized as '16ελληνικά' and not as '8ελληνικά', due to the use of special characters, where '16' is the number of bytes in the string.

  •     currency = '3USD'
  •     expiration = 101893456000  
  •     price = 210
  •     prod = '8Software'
  •     qty = 11
  •     type = '7digital'

Concatenate the values

    '3USD1018934560002108Software117digital'

Encrypt using your Secret Word

The serialized value is then encrypted using the HMAC method.

    - the algorithm used is sha256

    - the key used when encrypting is the merchant secret word (in this example, the secret word is 'secret_wordbuylink')

This outputs a 64 character string:

c2225743f22e3b698b2f31052e35ec7602b787c804eaac1e0cd127a9a06b5762

Add the string in the buy-link

https://secure.2checkout.com/checkout/buy?merchant=2COLRNC&dynamic=1&prod=Software&price=10&currency=USD&qty=1&type=digital&expiration=1893456000&signature=c2225743f22e3b698b2f31052e35ec7602b787c804eaac1e0cd127a9a06b5762

Set grace period

Overview

Use the setSubscriptionGracePeriod method to set a custom grace period for an Active or Past Due subscription. This method changes per-subscription end user data and not customer details.

Parameters

Parameters 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. Needs to belong to an Active or Past Due subscription.

subscriptionGracePeriod

Required (int)

 

The number of days for the grace period, during which time, customers can still renew/upgrade expired subscriptions. During the grace period, subscriptions feature the Past Due status.

 

Can be NULL. When NULL, the grace period for a subscription is the same as that you defined in the per-product or per-account grace period settings. You can use this to set a custom grace period for a subscription.

 

Use 0 to remove the grace period from a subscription.

Response

Parameters Type/Description

Boolean

true or false depending on whether the changes were successful or not.

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$gracePeriod = YOUR_GRACE_PERIOD;

$jsonRpcRequest = array (
'method' => 'setSubscriptionGracePeriod',
'params' => array($sessionID, $subscriptionReference, $gracePeriod),
'id' => $i++,
'jsonrpc' => '2.0');

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

Retrieve order fields

Overview

Use the getAdditionalOrderFields method to extract information about additional fields you set up for your account.

Parameters

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. Avangate throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

Request

<?php

require ('PATH_TO_AUTH');

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getAdditionalOrderFields ',
'params' => array($sessionID)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));

?>

Response

Parameters Type/Description

AdditionalFields

Array of orders

Increasing trial conversion rates

Is trial conversion a key part of your customer acquisition strategy? Whether you're currently offering a free software download or a 30-day free subscription, this case study with Absolute Software delivers valuable insights you can put into play to increase your trial activation rates and conversion rates.

Tune into this 27-minute webinar to learn how Absolute realized a 5x increase in their trial conversion rate.

Join 2Checkout and UpSellit to discuss metrics, tips, and best practices:

  • The most important KPIs in a trial funnel
  • How to drive trial activations
  • Ideas to optimize the user experience
  • Creative ways to increase distribution
  • How to optimize messaging based on the length of the trial
Join Our Webinar

 

6 Strategies to maximize your recurring revenue

Prevent Payment Failures

Intelligent Payment Routing enables you to match or route card transactions to the payment gateways best equipped to handle them and retry authorizations using a failover or back-up gateway. We recommend taking advantage of this feature to:

  • Provide automatic support for switching and optimization between multiple payment processors around the world.
  • Increase conversion rates.
  • Reduce the volume of unfinished payments.
  • Shift riskier transactions to secondary gateways to protect relationships with primary providers.

Analyzing a sample of 2Checkout vendors, we have seen an average uplift between 2% and 5% in their authorization rates using this fallback system.

An equally important aspect is routing transactions to local payment processors in countries such as the USA, Brazil or Turkey.

After using local payment processing, many of our vendors have seen up to 40% increase in authorization rates in the aforementioned markets.

Ensure Billing Continuity

The best way to handle the incoming wave of account number changes is to use an Account Updater.

Account Updater is a generic term for programs such as Visa's Account Updater or MasterCard Automatic Billing Updater that are offered by the credit card networks to automatically exchange updated credit card account information between participating issuers, acquirers, and merchants.

The programs record changes to credit card account numbers and expiration dates due to mergers, portfolio flips (e.g., Visa to MasterCard), re-issued cards (from loss or security breach) account closures, and product upgrades. Companies that participate in updater programs have several ways to check the information in their subscriber database:

  • Automated nightly updates that check any card you have processed in the past six months.
  • Requests for information on specific cards that have been declined.
  • Requests for information on a set of cards due for their next billing installment.

The 2Checkout Account Updater has so far helped our vendors grow their recurring revenue in multiple ways:

  • Salvage over 90% of otherwise unusable cards used for recurring billing.
  • Seamlessly update state (out of date) credit/card accounts.
  • Increase retention by up to 40%.
  • Increase customer loyalty by eliminating service disruption.

Increase Authorization Rates for Expired Cards

Credit cards in your database slip past their expiration date on a monthly basis. The account number hasn't changed, and the subscriber still wants to receive your service, but when you attempt to bill that card, the payment is declined -- or your gateway won't let you submit it at all -- because the card is expired.

2Checkout allows you to identify expired cards and update them on file (standard banking procedures to prolong expiration dates), so that stale expiration dates don't deny you revenues or threaten your relationship with a perfectly happy subscriber. You can retry those payments and recover up to 90% of payments that initially had been declined due to expired cards.

Our approach to expired card handling involves sending the card with the expired date first. If it's declined, we retry the payment up to four times in this sequence:

If the processor or gateway won't accept an expired date, then we jump immediately to adding three years to the expiration date. In case of errors, the 2Checkout Retry Logic comes into play and adds four years, then two years, then five years. Finally, we add one year to the expiration date.

We also recommend you create a report to track each retry attempt and its results. That way, you'll be able to see how many payments you're recovering at each step and notice any changes in the trend.

For instance, adding three years to the date tends to recover a higher percentage of payments now, but in the past adding two years was slightly more successful. The optimal approach is always a moving target, but with good tracking, you'll be able to adapt to the changes.

We’ve seen an average authorization rate uplift of 4% after some of our vendors started taking advantage of this mechanism.

 

Increase Recovery Rate and Minimize Payment Failures

Configurable Retry Logic enables you to automatically recover payments for soft card declines. Soft declines refer to temporary issues, with a high probability that a subsequent try would be successful.

We recommend that you adapt the number of retries and retention strategy to your business and customer base, and we can provide guidance on optimizing conversion rates.

Soft decline reasons include:

  • Insufficient funds
  • Card activity limit exceeded
  • Processing failures due to system, technical or infrastructure issues
  • Expired cards

 

2Checkout’s Retry Logic proved to successfully recover up to 20% of failed transactions due to soft declines.

More extreme situations may result in hard declines, due to stolen/lost cards and/or invalid card data. We no longer attempt authorizations for subscriptions for which the initial card charge results in a hard decline. Unless you target those customers with your own retention strategies, such subscriptions expire.

As part of the Revenue Recovery Tools, pre-expiration billing is available, allowing the configuration of renewal attempts before the subscription expiration.

Reduce Churn and Recapture Revenue

Use our Authorization and Revenue Recovery Dashboard to monitor the impact of your recovery strategies and use the insight to adjust and optimize your tactics to reduce churn and recapture more revenue.

  • Gain unmatched transparency and visibility into subscription renewals and recurring billing.
  • Access extensive authorization data to optimize retention strategies.
  • Gain granular-level insight at the subscription level into the activities of the Retry Logic and Account Updater tools.
  • Take advantage of data portability to support third-party marketing and retention campaigns.

Around 16% of successful automatic renewals registered by 2Checkout are currently recovered through our auto-renewal enrollment and churn prevention campaigns.

Recover Revenue from Unfinished Payments

Dunning is the process of methodically communicating with customers to ensure the collection of accounts receivable. Our dunning management tools help you reduce customer churn and recover lost revenue from failed authorizations. We notify customers via email about failed renewals, helping them update their payment information in myAccount.

We automatically attempt to authorize a recurring charge for a subscription according to its renewal deadline. If the authorization process fails with a hard decline - a permanent error from the payment processor/gateway indicating that any further authorizations would also be unsuccessful – then the dunning management tools come into play.

We send a single dunning management email immediately after each failed automatic authorization attempt made for subscriptions with the auto-renewal system enabled. As soon as the shoppers update their payment information, we automatically attempt to authorize the payment and renew the subscription.

2Checkout’s dunning management tools led to an average of 1% increase in authorization rates.

Retrieve customer

Overview

Use the getCustomerInformation method to retrieve the details of a customer entity from the 2Checkout system.

Parameters

Parameters 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.

CustomerReference

Required (int)

 

System-generated customer reference. Required unless you prefer to use ExternalCustomerReference.

ExternalCustomerReference

Optional (string)

 

External customer reference that you control. Optional when you use CustomerReference. If you include it, it needs to belong to the same customer as the CustomerReference.

Response

Parameters Type/Description

Customer

Object

Request

<?php

require ('PATH_TO_AUTH');

$customerReference = CUSTOMER_REFERENCE;
$externalCustomerReference = 'EXT_CUSTOMER_REFERENCE'; //Optional, but if you include it it needs to belong to the same customer as the internal 2Checkout customer reference

$jsonRpcRequest = array (
'method' => 'getCustomerInformation',
'params' => array($sessionID, $customerReference, $externalCustomerReference),
'id' => $i++,
'jsonrpc' => '2.0');

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

Create fixed discount

Overview

Use setPromotionDiscount to set a fixed promotion discount.

Parameters

Parameter Type/Description

sessionID

Required (string)

 

Output of the Login method.

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to set the discount for.

promotionDiscount

Required(Object)

 

Type

Required (String)

 

 

Discount type:

  • PERCENT, use in combination with Value
  • FIXED, use in combination with Values and DefaultCurrency

 

Value / Values

Required (Int / Array of objects)

 

 

  • Value = Int, determines the discount percentage from 0 to 100
  • Values = Array of Value objects

 

 

Value

Required (Object)

 

 

 

Currency

Required (String)

 

 

 

 

Discount currency ISO code (ISO 4217).

 

 

 

Amount

Required (Int)

 

 

 

 

Discount amount in corresponding currency.

 

DefaultCurrency

Required (String)

 

 

Default discount currency ISO code (ISO 4217).

Response

Parameter Type/Description
promotionDiscount Object

Request

<?php
declare(strict_types=1);

class Configuration
{
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = 'http://api.2checkout.com/soap/6.0';
    public const ACTION = 'setPromotionDiscount';
    public const ADDITIONAL_OPTIONS = null;
    public const PROMOTION_CODE = "AB3WMME0UA";
    //array or JSON
    public const PAYLOAD = <<<JSON
{
  "Type": "FIXED",
  "DefaultCurrency": "USD",
  "Values": [
    {
        "Currency": "USD",
        "Amount": 10
    },
    {
        "Currency": "EUR",
        "Amount": 10
    }
  ]
}
JSON;
}

class Client
{
    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION,
        string $promotionCode = Configuration::PROMOTION_CODE
    ): ?object {
        if (is_array($payload)) {
            $payload = json_encode($payload);
        }
        if (!empty($payload)) {
            // SoapClient works with objects(StdClass)
            $payload = json_decode($payload);
        }
        $soapClient = $this->getClient($url);
        $sessionId = $this->getSession($soapClient);
        $args = array_filter([$sessionId, $promotionCode, $payload]);

        return $soapClient->$action(...$args);
    }

    public function getClient(string $url): SoapClient
    {
        return new SoapClient(
            $url.'?wsdl',
            [
                'location' => $url,
                'cache_wsdl' => WSDL_CACHE_NONE,
            ]
        );
    }

    public function getSession(SoapClient $client)
    {
        $date = gmdate('Y-m-d H:i:s');
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $string = strlen($merchantCode).$merchantCode.strlen($date).$date;
        $hash = hash_hmac('md5', $string, $key);
        $client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');

        return $client->login($merchantCode, $date, $hash);
    }
}

try {
    $client = new Client();
    var_dump($client->call());
} catch (Exception $ex) {
    var_dump($ex);
}

LCN triggers

Set LCN triggers and contents 

In your Control Panel account, navigate to Dashboard → IntegrationsWebhooks and API and click on the LCN Settings tab. In the General LCN Settings section, under Triggers, select the events for which 2Checkout sends notifications.

License Change Notification (LCN) provides automatic notifications for orders from the 2Checkout system, based on the below list of triggers you control.

LCN Triggers 

Here's a list of the events for which you can trigger notifications. from Control Panel. You can set the triggers (when the notification will be sent) and what tags (parameters) will be included in the response from Control Panel. Find further information on LCN parameters here.

LCN Triggers Dispatch reason codes and labels Subscription status Actions that trigger LCN

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Licenses changes

LICENCE_CHANGE - Licence change
LICENCE_GP_CHANGE - Licence grace period change
LICENCE_PENDING_ACTIVATION - Licence pending activation

 

 

 

 

ACTIVE & auto-renewal

When:

  • updating Subscription info to change expiration date and recurring enabled/disabled
  • updating End User details
  • updating Subscription details: canceling/reactivating the subscription

 

 

 

ACTIVE & non-recurring

When:

  • updating Subscription details: cancel subscription
  • updating End User details

 

 

 

ACTIVE & manual payment

When:

  • updating Subscription details to cancel/reactivate subscription
  • updating End User details

 

 

DISABLED & non-recurring

When:

  • updating Subscription details to reactivate/cancel the subscription
  • updating End user details

 

 

PENDING ACTIVATION & auto-recurring

When:

  • updating Subscription details to reactivate/cancel the subscription
  • updating Subscription info to disable automatic billing
  • updating End User details

 

 

 

 

 

 

Licenses expirations (including past due notifications)

LICENCE_EXPIRATION - Licence expiration
LICENCE_PASTDUE - Licence past due
 

 

 

 

 

EXPIRED or PAST DUE & auto-recurring

When:

  • updating Subscription details to cancel subscription
  • updating Subscription info to extend billing cycle expiration
  • updating Subscription info to stop automatic billing cycle
  • updating End User details

 

 

 

 

EXPIRED/PAST DUE & manual payment

When:

  • updating Subscription details: cancel/reactivate subscription
  • updating Subscription info: extend billing cycle expiration
  • updating Subscription info to stop automatic billing cycle
  • updating End User details

 

Licenses payment method changes

LICENCE_CHANGE - Licence change

 

ACTIVE & auto-renewal subscription

  • when updating Subscription info to change credit card details

 

Licenses when a Churn Prevention Campaign was accepted LICENCE_CPC_ACCEPTED - Churn Prevention Campaign was accepted ACTIVE

When:

  • accepting a discount proposed through a churn prevention campaign
  • accepting a discount for enabling autorenewal

*For both situations, the LCN will contain the updated renewal price.

Licenses changed via import LICENCE_CHANGE - Licence change ACTIVE

When:

  • importing a subscription from CSV
Scheduled cancellation event has been registered SCHEDULED_FOR_CANCELATION_ON_DEMAND - Scheduled cancellation event has been registered ACTIVE

When:

  • a shopper with a German billing address requested subscription cancelation
Scheduled cancellation event has been reverted REVERT_CANCELATION_ON_DEMAND - Scheduled cancellation event has been reverted ACTIVE

When:

  •  a shopper with a German billing address has requested subscription cancelation, and then reverted the cancelation request
Scheduled cancellation actually has taken place CANCELATION_ON_DEMAND - Scheduled cancellation actually has taken place DISABLED

When:

  • the subscription is canceled 28 days after a shopper with a German billing address requested subscription cancelation

LCN triggers - API calls

Triggers API calls that trigger LCN API calls that do not trigger LCN

 

 

 

 

 

License changes

  • convertTrial
  • enableSubscription
  • disableSubscription
  • setSubscriptionGracePeriod
  • enableRecurringBilling
  • disableRecurringBilling
  • renewSubscription
  • setSubscriptionUpgrade
  • extendSubscription
  • updateSubscriptionEndUser
  • copyPaymentInfo (on APIv6)
  • updateSubscription
  • setSubscriptionCustomer
  • setCustomRenewalPrice
  • externalCustomerRef

 

Time to go beyond payments

For online businesses today, accepting payments online is a core requirement. However, lured by low-cost offers from payment processors, decisions are based solely on price, rather than examining the actual needs of a growing business beyond the first year. Companies are spending upwards of 11% of revenue in addition to their payment processor investment because key business features are missing - for rapid product launch, experimentation, and a focus on conversion metrics.

Watch this webinar and learn from Raj Badarinath, Senior Director Marketing at 2Checkout, why your payment processor isn't enough, why you're continuously "hitting the payments wall", and why your revenue is shrinking instead of growing.

Watch this webinar to discover:

  • Accepting payments online isn't enough for emerging and growing companies
  • Payments are critical, but only part of the puzzle
  • The graduation path to true online revenue success

Selling digital goods and services to a global audience needs a combination of smarter payments, commerce, and distribution. It's time to Go Beyond Payments!

Join Our Webinar

 

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