Skip to main content

Create price option groups

Overview

Use the addPriceOptionGroup method to create price options for your subscription plans/products.

  • Send options for each pricing grouo or 2Checkout throws an exception.
  • When adding an interval with no min / max values or overlapping values, 2Checkout throws an exception. 

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.

PriceOptionsGroup

Required (object)

 

Use this object to create a new price option group for your account.

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$PriceOptionGroup = new stdClass();
$PriceOptionGroup->Name = 'New Multi Users';
$PriceOptionGroup->Description = 'Quos aut ipsam ipsum omnis aut molestiae. Et quod molestias distinctio. Fugiat sit asperiores reprehenderit officia eaque quae quia. Aperiam quia quia illo eos nesciunt accusamus.';
$PriceOptionGroup->Translations = array();
$PriceOptionGroup->Translations[0] = new stdClass();
$PriceOptionGroup->Translations[0]->Name = 'xdrki7ljix';
$PriceOptionGroup->Translations[0]->Description = 'Beatae doloribus ipsam voluptatem et. Iure dignissimos non amet. Quibusdam fugiat dolor repudiandae temporibus harum.';
$PriceOptionGroup->Translations[0]->Language = 'en';
$PriceOptionGroup->Translations[1] = new stdClass();
$PriceOptionGroup->Translations[1]->Name = '37wr8ie2dj';
$PriceOptionGroup->Translations[1]->Description = 'Esse distinctio voluptatibus omnis et et quia dolor. Quibusdam dicta dolores odio consequatur velit voluptate. Laboriosam reiciendis libero vel quae molestiae ad.';
$PriceOptionGroup->Translations[1]->Language = 'ru';
$PriceOptionGroup->Type = 'RADIO';
$PriceOptionGroup->Options = array();
$PriceOptionGroup->Options[0] = new stdClass();
$PriceOptionGroup->Options[0]->Name = 'SingleUser';
$PriceOptionGroup->Options[0]->Description = 'Nisi ea autem a labore similique. Minus natus cumque nemo. Aut aliquam laboriosam dolorem ad.';
$PriceOptionGroup->Options[0]->Translations = array();
$PriceOptionGroup->Options[0]->Translations[0] = new stdClass();
$PriceOptionGroup->Options[0]->Translations[0]->Name = '0q2r3kcj0q';
$PriceOptionGroup->Options[0]->Translations[0]->Description = 'Voluptatem in vitae rerum ea tempore. Non cumque ullam optio quis. Laborum maxime sunt facere. Dolor fugit a fugiat quasi facere totam.';
$PriceOptionGroup->Options[0]->Translations[0]->Language = 'en';
$PriceOptionGroup->Options[0]->Translations[1] = new stdClass();
$PriceOptionGroup->Options[0]->Translations[1]->Name = 'dwfxuw4lrn';
$PriceOptionGroup->Options[0]->Translations[1]->Description = 'Debitis omnis maiores quia praesentium totam error corrupti. Consectetur eum magnam quam vero. Sit aperiam natus perspiciatis iusto sint ut fugit. Adipisci illum non voluptatem voluptas.';
$PriceOptionGroup->Options[0]->Translations[1]->Language = 'it';
$PriceOptionGroup->Options[0]->Code = 'singleuser1';
$PriceOptionGroup->Options[0]->SubscriptionImpact = new stdClass();
$PriceOptionGroup->Options[0]->SubscriptionImpact->Impact = 'Add';
$PriceOptionGroup->Options[0]->SubscriptionImpact->Months = 1;
$PriceOptionGroup->Options[0]->PriceImpact = new stdClass();
$PriceOptionGroup->Options[0]->PriceImpact->Method = 'FIXED';
$PriceOptionGroup->Options[0]->PriceImpact->Amounts = array();
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[0] = new stdClass();
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[0]->Currency = 'USD';
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[0]->Amount = 90.61;
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[1] = new stdClass();
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[1]->Currency = 'EUR';
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[1]->Amount = 6.70;
$PriceOptionGroup->Options[0]->PriceImpact->ImpactOn = 'BASE';
$PriceOptionGroup->Options[0]->PriceImpact->Impact = 'ADD';
$PriceOptionGroup->Options[0]->PriceImpact->Percent = 39;
$PriceOptionGroup->Options[0]->Default = false;
$PriceOptionGroup->Options[1] = new stdClass();
$PriceOptionGroup->Options[1]->Name = 'MultiUser';
$PriceOptionGroup->Options[1]->Description = 'Vero voluptatum fuga et repellendus sed qui. Dolores molestiae error non ad aperiam. In error quos eum quas repudiandae pariatur et suscipit.';
$PriceOptionGroup->Options[1]->Translations = array();
$PriceOptionGroup->Options[1]->Translations[0] = new stdClass();
$PriceOptionGroup->Options[1]->Translations[0]->Name = 'MultiUser';
$PriceOptionGroup->Options[1]->Translations[0]->Description = 'Debitis et saepe facere blanditiis. Tempore et nemo aut ullam possimus ipsum nisi. Ad libero et consequuntur aliquam libero. Rerum aut illum eveniet earum.';
$PriceOptionGroup->Options[1]->Translations[0]->Language = 'en';
$PriceOptionGroup->Options[1]->Translations[1] = new stdClass();
$PriceOptionGroup->Options[1]->Translations[1]->Name = 'dw5zgkcki9';
$PriceOptionGroup->Options[1]->Translations[1]->Description = 'Vel et excepturi veniam. In iusto eveniet pariatur hic labore. Et qui dolorem accusantium molestias iusto.';
$PriceOptionGroup->Options[1]->Translations[1]->Language = 'pt';
$PriceOptionGroup->Options[1]->Code = 'multiuser999';
$PriceOptionGroup->Options[1]->SubscriptionImpact = new stdClass();
$PriceOptionGroup->Options[1]->SubscriptionImpact->Impact = 'ADD';
$PriceOptionGroup->Options[1]->SubscriptionImpact->Months = 2;
$PriceOptionGroup->Options[1]->PriceImpact = new stdClass();
$PriceOptionGroup->Options[1]->PriceImpact->Method = 'FIXED';
$PriceOptionGroup->Options[1]->PriceImpact->Amounts = array();
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[0] = new stdClass();
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[0]->Currency = 'USD';
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[0]->Amount = 65.03;
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[1] = new stdClass();
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[1]->Currency = 'EUR';
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[1]->Amount = 64.58;
$PriceOptionGroup->Options[1]->PriceImpact->ImpactOn = 'BASE';
$PriceOptionGroup->Options[1]->PriceImpact->Impact = 'ADD';
$PriceOptionGroup->Options[1]->PriceImpact->Percent = 51;
$PriceOptionGroup->Options[1]->Default = true;
$PriceOptionGroup->Code = null;
$PriceOptionGroup->Required = false;

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addPriceOptionGroup',
'params' => array($sessionID, $PriceOptionGroup)
);

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

?>

Pay-per-Usage

Use this option to create and assign PAYPERUSE price options to your portfolio.

For non PAYPERUSAGE cases, the Usage and UsagePricingModel fields are not required.

Request sample with PAYPERUSE

<?php
declare(strict_types=1);

class Configuration
{
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = 'http://api.2checkout.com/rpc/6.0';
    public const ACTION = 'addPriceOptionGroup';
    public const ADDITIONAL_OPTIONS = null;
    //array or JSON
    public const PAYLOAD = <<<JSON
{
    "Type": "INTERVAL",
    "Code": "PayPerUsage-CODE",
    "Required": false,
    "Name": "Pay per usage pricing option group",
    "Description": "Test option description",
    "Usage": "PAYPERUSAGE",
    "UsagePricingModel": "STEPPED",
    "Options": [
        {
            "Code": "9876545678",
            "ScaleMin": "1",
            "ScaleMax": "9",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        },
        {
            "Code": "98765456789",
            "ScaleMin": "10",
            "ScaleMax": "19",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        }
    ],
    "Translations": [
        {
            "Name": "Pay per usage pricing option group",
            "Description": "Test option description",
            "Language": "EN"
        }
    ]
}
JSON;
}

class Client
{
    private const LOGIN_METHOD = 'login';
    private $calls = 1;
    private $sessionId;


    private function generateAuth(): array
    {
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $date = gmdate('Y-m-d H:i:s');
        $string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
        $hash = hash_hmac('md5', $string, $key);

        return compact('merchantCode', 'date', 'hash');
    }


    public function login(string $url)
    {
        $payload = $this->generateAuth();
        $response = $this->call($url, array_values($payload), self::LOGIN_METHOD);
        $this->sessionId = $response['result'];
    }


    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ): ?array {
        if (empty($this->sessionId) && $action !== self::LOGIN_METHOD) {
            $this->login($url);
        }
        if(is_string($payload)) {
            $payload = json_decode($payload, true);
        }
        if (!empty($this->sessionId)) {
            $payload = [$this->sessionId, $payload, Configuration::ADDITIONAL_OPTIONS];
        }
        $payload = array_filter($payload);

        $request = json_encode([
            'jsonrpc' => '2.0',
            'method' => $action,
            'params' => $payload,
            'id' => $this->calls++,
        ]);
        $curl = curl_init($url);
        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', 'Cookie: XDEBUG_SESSION=PHPSTORM'));
        curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
        $response = curl_exec($curl);
        if(empty($response)) {
            die('Server unavailable');
        }
        echo $response . '</br>';
        return json_decode($response, true);;
    }
}
$client = new Client();
$result = $client->call();
var_dump($result);

Request sample without PAYPERUSE  

<?php
declare(strict_types=1);

class Configuration
{
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = 'http://api.2checkout.com/rpc/6.0';
    public const ACTION = 'addPriceOptionGroup';
    public const ADDITIONAL_OPTIONS = null;
    //array or JSON
    public const PAYLOAD = <<<JSON
{
    "Type": "RADIO",
    "Code": "RADIO-CODE",
    "Required": false,
    "Name": "Radio pricing option group",
    "Description": "Test option description",
    "Options": [
        {
            "Code": "9876545678",
            "ScaleMin": "1",
            "ScaleMax": "9",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        },
        {
            "Code": "98765456789",
            "ScaleMin": "10",
            "ScaleMax": "19",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        }
    ],
    "Translations": [
        {
            "Name": "Radio pricing option group",
            "Description": "Test option description",
            "Language": "EN"
        }
    ]
}
JSON;
}

class Client
{
    private const LOGIN_METHOD = 'login';
    private $calls = 1;
    private $sessionId;


    private function generateAuth(): array
    {
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $date = gmdate('Y-m-d H:i:s');
        $string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
        $hash = hash_hmac('md5', $string, $key);

        return compact('merchantCode', 'date', 'hash');
    }


    public function login(string $url)
    {
        $payload = $this->generateAuth();
        $response = $this->call($url, array_values($payload), self::LOGIN_METHOD);
        $this->sessionId = $response['result'];
    }


    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ): ?array {
        if (empty($this->sessionId) && $action !== self::LOGIN_METHOD) {
            $this->login($url);
        }
        if(is_string($payload)) {
            $payload = json_decode($payload, true);
        }
        if (!empty($this->sessionId)) {
            $payload = [$this->sessionId, $payload, Configuration::ADDITIONAL_OPTIONS];
        }
        $payload = array_filter($payload);

        $request = json_encode([
            'jsonrpc' => '2.0',
            'method' => $action,
            'params' => $payload,
            'id' => $this->calls++,
        ]);
        $curl = curl_init($url);
        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', 'Cookie: XDEBUG_SESSION=PHPSTORM'));
        curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
        $response = curl_exec($curl);
        if(empty($response)) {
            die('Server unavailable');
        }
        echo $response . '</br>';
        return json_decode($response, true);;
    }
}
$client = new Client();
$result = $client->call();
var_dump($result);

Cross-sell

Overview

The object below is returned directly or within a successful response from the following API requests:

            Retrieve a product’s cross-sell campaigns                                                        Retrieve cross-sell campaigns

Cross-sell object

Parameter Type/Description

MasterProducts

Array

 

Array of product codes for the items you set to trigger the cross-sell campaign.

DisplayType

String

 

  • cart – Shopping cart
  • review – Review page
  • finish – Thank you page

DisplayInEmail

Boolean

 

True or false depending on whether you set the cross-sell campaign to display in payment receipt emails or not.

Products

Array of objects

 

Details below

 

ProductCode

String

 

 

Product code for the item you set as recommended for the cross-sell campaign.

 

Discount

String

 

 

Value of the discount. This is a percentage.

 

DiscountType

String

 

 

PERCENT – you can only set discounts as a percentage from the product price.

CampaignCode

String

 

Unique, system-generated cross-sell campaign code.

Name

String

 

Campaign name.

StartDate

String

 

YYYY-MM-DD. The start date you set for the cross-sell campaign.

EndDate

String

 

YYYY-MM-DD. The end date you set for the cross-sell campaign.

Restrict API calls based on request IP

Overview

Restrict API calls based on request IP address and increase the security of your account by preventing unauthorized API usage. By default, you can call the 2Checkout API from any IP.

Currently, the 2Checkout systems do not support IPv6 for customer IP.

Availability

All 2Checkout accounts.

Set up

  1. Navigate to  Settings » Users » Firewall.
  2. Specify a static IP address or a range of IP addresses. 
  3. In the Selected Users area, apply the restriction to API (Special). 
  4. Add the IP filter. 
  5. Activate the IP filtering system.

Subscription grace period

Overview

Set a grace period for your products and enable customers to renew expired subscriptions for a specific number of days after the expiration deadline. For example, for a 7 day grace period, 2Checkout will still accept payments and customers can still renew their subscriptions for up to a week after their subscriptions have expired. The expiration date of a recurring subscription is calculated based on a 'last day of the month' principle. For a subscription that is recurring on a monthly basis, and starts on January 31st, the subscription will expire as follows: in February, this subscription will expire on February 28th (or 29th for leap years). In March, the subscription will expire on the 31st.

Impact

Grace period settings impact subscriptions generated with every sale and are used as attributes of these subscriptions throughout their lifecycle.

Grace period configuration

2Checkout allows you to configure subscription grace period for multiple scenarios.

Account-level grace period

  1. Go to Setup -> Renewal -> Global Renewal Settings.
  2. Define the grace period length.
  3. Click Save.

Apply the global grace period settings to existing subscriptions

  1. Go to Setup -> Renewal -> Global Renewal Settings.
  2. Define the grace period length.
  3. Apply the settings to different types of existing subscriptions:
    • Expired (will apply the new settings to subscriptions for the product you're editing sold to your customers that expired - the number of expired subscriptions impacted is enclosed in parenthesis).
    • Past due (will apply the new settings to subscriptions for the product you're editing sold to your customers that are currently in the grace period - the number of subscriptions in their grace period impacted is enclosed in parenthesis).
    • Active (will apply the new settings to subscriptions for the product you're editing sold to your customers that are still active -  the number of active subscriptions impacted is enclosed in parenthesis).
  4. Click Save.

Product-level grace period

  1. Go to Setup -> Products.
  2. Click Edit on the product that you want to configure the grace period for.
  3. Go to the Renewal tab and select the Set custom grace period for this product option.
  4. Define the grace period length.
  5. Click Save.

Overwrite product-level grace period for existing subscriptions

Subscription sold for products with product-level grace period settings inherit the custom renewal configurations and not the global renewal setup.

  1. Go to Setup -> Renewal -> Global Renewal Settings.
  2. Define the grace period length.
  3. Apply the settings to different types of existing subscriptions:
    • Expired (will apply the new settings to subscriptions for the product you're editing sold to your customers that expired - the number of expired subscriptions impacted is enclosed in parenthesis).
    • Past due (will apply the new settings to subscriptions for the product you're editing sold to your customers that are currently in the grace period - the number of subscriptions in their grace period impacted is enclosed in parenthesis).
    • Active (will apply the new settings to subscriptions for the product you're editing sold to your customers that are still active -  the number of active subscriptions impacted is enclosed in parenthesis).
  4. Check the Apply to subscriptions with grace periods set at product-level option. This overwrites only the inherited grace period for existing subscriptions and not the custom grace period settings set at product-level.
  5. Click Save.

Usage scenarios

Prolonging the grace period for expired subscriptions

  1. The interval increase doesn't push the grace period beyond the current date when the change is operated. As a result, expired subscriptions will maintain their Expired status.

    Subscription 1

    Recurring billing

    1 month

    Lifecycle

    May 1 - May31

    Grace period

    5 days

    Current date

    June 12

    Current status

    Expired

    Update grace period to

    7 days

    Impact on subscription

    New 7 day long grace period

    Impact on status

    None

    Comment

    Because the prolonged grace period doesn't include the current date when the change is operated, the status of the subscription remains unchanged, in this case, Expired.

  2. The interval increase pushes the grace period beyond the current date when the change is operated. As a result, expired subscriptions will re-enter their grace period (Past Due status) allowing customers to renew them through manual payments.

    Subscription 1

    Recurring billing

    1 month

    Lifecycle

    May 1 - May31

    Grace period

    5 days

    Current date

    June 12

    Current status

    Expired

    Update grace period to

    14 days

    Impact on subscription

    New 14 day long grace period and subscription is returned to its grace period

    Impact on status

    Switched from Expired to Past Due

    Comment

    Because the prolonged grace period includes the current date when the change is operated, the status of the subscription is changed from Expired to Past Due. Customers will now be able to once again renew their subscriptions through manual payments (buy links previously sent in manual renewal email notification will work as the status is changed).

Prolonging the grace period for Past Due subscriptions

  1. The interval change doesn't reduce the grace period to a previous date compared to the current date when the change is operated. As a result, subscriptions in their grace period will maintain their Past Due status.

    Subscription 2

    Recurring billing

    1 month

    Lifecycle

    May 1 - May31

    Grace period

    14 days

    Current date

    June 12

    Current status

    Past Due

    Update grace period to

    13 days

    Impact on subscription

    New 13 day long grace period

    Impact on status

    None

    Comment

    Because the update doesn't shorten the grace period to an interval preceding the current date when the change is operated, the status of the subscription remains unchanged, in this case, Past Due.

  2. The interval change reduces the grace period to a previous date compared to the current date when the change is operated. As a result, subscriptions in their grace period will expire.

    Subscription 1

    Recurring billing

    1 month

    Lifecycle

    May 1 - May31

    Grace period

    14 days

    Current date

    June 12

    Current status

    Past Due

    Update grace period to

    7 days

    Impact on subscription

    New 7 day long grace period and subscription expires

    Impact on status

    Switched from Past Due to Expired

    Comment

    Because the update shortens the grace period to an interval preceding the current date when the change is operated, the subscription expires, and its status switches from Past Due to Expired.

License Change Notifications (LCN)

When you modify the grace period of subscriptions, the 2Checkout system will automatically send out License Change Notifications (LCNs) reflecting the update you made.

LICENSE_GRACE_PERIOD

The grace period impacting a subscription. Possible values:

  • Empty - the global account settings apply;
  • Numeric value (INT) - custom per-product settings - any other values overwrite the global grace period settings.

LCN corner cases

  1. You set a 1 day grace period for a subscription that's no more than 24 hours after its' expiration deadline and that did not feature a grace period previously. In this case, the 2Checkout system will send out 2 notifications:
    • 1 LCN reflecting the grace period change.
    • 1 LCN reflecting the Past Due status of the subscription.
  2. You decrease the grace period of a subscription that's less than 24 hours from the grace period deadline by 1 day. In this case, the 2Checkout system will send out 2 notifications:
    • 1 LCN reflecting the grace period change.
    • 1 LCN reflecting the expiration of the subscription.

F.A.Q.

  1. What happens if the grace period expires?
    • 2Checkout will no longer accept payments and customers will not be able to renew their expired subscriptions.
  2. Does grace period offer extra usage?
    • No. Configuring a grace period for subscriptions does not influence the recurring billing process. Grace periods provide an interval of time, after the expiration of a subscription, in which shoppers can order a renewal. After the grace period, if any, runs out for expired subscriptions, customers will have to purchase a new offering. Expirations deadlines are calculated in accordance to purchase dates and converted to the 2Checkout local time zone.
  3. Does 2Checkout send LCNs for grace period updates?
    • Yes. 2Checkout sends out LCN notifications for each change you perform per subscription that results in an update of the grace period.

Retrieve an order

Overview

Use the getOrder method to retrieve details on a specific order using its unique, system generated reference.

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.

orderReference

Required (string)

 

Order reference number of older order, which is already approved/paid.

Response

Order information

Object

Request


<?php
$host   = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/6.0/?wsdl", array(
    'location' => $host . "/soap/6.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.2checkout.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.2checkout.com/cpanel/account_settings.php
$now          = gmdate('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;
}
$orderReference = '43403739';
try {
    $fullOrderDetails = $client->getOrder    ($sessionID, $orderReference);
}
catch (SoapFault $e) {
    echo "fullOrderDetails: " . $e->getMessage();
    exit;
}
var_dump("fullOrderDetails", $fullOrderDetails);
?>

Subscription renewal notifications

Overview

Use the setRenewalNotificationStatus method to subscribe or unsubscribe shoppers from subscription renewal notifications.

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.

status

Required (boolean)

 

true – enable subscription renewal notifications.

false – disable subscription renewal notifications.

Response

Parameters Type/Description

Boolean

true or false depending on whether or not the operation succeeded.

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$status = false;

try {
    $Notifications = $client->setRenewalNotificationStatus($sessionID, $subscriptionReference, $status);
}
catch (SoapFault $e) {
    echo "Notifications: " . $e->getMessage();
    exit;
}
var_dump("Notifications", $Notifications);

Take your affiliate sales worldwide

Have your online sales reached started to slow? Do you want to get relevant traffic from countries that you're not addressing directly? Do you want to sell more through affiliate partners?

Watch this webinar to find out how to get more sales by expanding worldwide with the help of affiliates. We'll have some tested best practices exposed to you and also find out about the different issues a company faces when going international.

Watch this webinar to discover:

  • When you should think of expanding and where you should grow your online sales
  • 5 steps for you to do in order to successfully go worldwide
  • Issues and hands-on experience in global affiliate expansion
Join Our Webinar

 

Fulfillment confirmation

Overview

If you enable the Requires delivery confirmation option for 2Checkout delivery, the order processing is put on hold until you manually confirm the delivery of the order. 

For orders you fulfill using your own platform or resources (Fulfillment made by you), you need to confirm the delivery of all the products in the orders, to finalize the payment process. Only after you provide fulfillment confirmation will 2Checkout mark orders as completed and update their status to Finished. Fulfillment confirmations can be accomplished either manually or automatically, depending on the fulfillment type and automation level that you implement.

Confirm fulfillment

Confirm fulfillment for each order having the "In progress" status:

  • Select the order(s) in the Fulfillment Confirmations section by ticking the corresponding boxes.
  • Click Confirm fulfillment.
  • You can also send an automatic delivery confirmation, IDN, to 2Checkout in the form of an HTTP POST.

Please note that only after receiving the fulfillment confirmation for the order, 2Checkout can execute the money transfer from the customer's account.

FAQ

  1. Are there any restrictions on the characters that can be used in the Static Lists?
    • Only printable characters can be used in the static list.
  2. What is the format for a static list file?
    • Each line in the static list will be considered as one code to be delivered. The newline character can have any style: Windows, Mac or Linux.
  3. Can a subscription key/code be presented to the user as two lines by embedding a new line character in the key text? 
    • No, embedding a new line character in the key text will make it part of the code to be sent to the customer, thus breaking the desired output. To deliver codes on multiple lines, dynamic lists should be used instead, where more than one line of codes can be sent using the XML schema.

Subscription history

Overview

The object below is returned directly or within a successful response from the following API requests:

Retrieve subscription history

Subscription history object

Parameters Type/Description

ReferenceNo

String

 

Unique, system-generated order reference number.

Type

String

 

Purchase type:

  • SALE
  • RENEWAL
  • UPGRADE

SubscriptionReference

String

 

Unique, system-generated subscription reference.

StartDate

String

 

Subscription start date(YYYY-MM-DD) - StartDate is mandatory when importing subscription data. If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then the StartDate you provide must be in accordance with your custom configuration.

ExpirationDate

String

 

Subscription expiration date(YYYY-MM-DD) - ExpirationDate is mandatory when importing subscription data. If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then the ExpirationDate you provide must be in accordance with your custom configuration.

Lifetime

Boolean

 

Possible values:

  • True – the subscription is evergreen

False – the subscription has a recurring billing cycle less than or equal to three years.

SKU

String

 

Stock keeping unit you defined.

DeliveryInfo

Object

 

Object with information about the delivery made to the customer - structure described below

PartnerCode

String

 

Possible values:

  • Empty = ecommerce order
  • Partner Code

 

Mobile Checkout Interface Decommissioning

Overview

From August 31st, we are discontinuing the Mobile Cart solution and replacing it with updated checkout flows that offer responsive templates and additional benefits for your shoppers.

What do you need to do?

  • Switch to the new checkout flows –  You can choose between the latest hosted cart template (Omnicart Flow) or the most recent, mobile-friendly ordering engines ConvertPlus or InLine Checkout. All three shopping carts have customizable templates that you can tailor according to your shoppers' needs.
    • Once you update your buy-links for the Omnicart Flow template or for the ConvertPlus/InLine Checkout, all your shoppers will see the new template during checkout, no matter what mobile device they use to make the purchase.
  • Take no action – If you haven't made your selection before August 31st, your shoppers will be automatically redirected to the Omnicart Flow when using a mobile device to make a purchase from your website post this date.

Questions?

Should you have any questions about the Mobile cart decommissioning, please address them at supportplus@2checkout.com and our Merchant Support team will be happy to help you out.

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