Skip to main content

Cross-sell

Overview

Use the CrossSellCampaign object to retrieve information about the cross-sell campaigns you configured for your account. 

Parameters

CrossSellCampaign

Object

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

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.

 

Products

Object

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.

 

Retrieve shipping price

Overview

Use getShippingPrice to retrieve the shipping method and price available, based on a current cart configuration. This API call returns the available shipping methods defined in your Control Panel, together with the fees you configured based on order total amount/weight/country.

Requirements

It's mandatory to have tangible products defined in your Control Panel, to retrieve shipping method and price information.

Parameters

Parameters Type/Description
Items

Object / Required

Contains information on the tangible product added in cart.

  Code

String / Required

Product code defined in the Information tab from the Product level, in the Control Panel.

  Quantity

Integer / Optional

Quantity of the product that is being purchased.

Default value is 1.

BillingDetails

Object / Required

Contains customer billing information.

  CountryCode

String / Required

Two-digits code of customer billing country. Example: 'US'.

DeliveryDetails

Object / Required

Contains customer delivery information.

  CountryCode

String / Required

Two-digits code of customer delivery country. Example: 'US'.

Currency

String / Optional

Three-digits code of purchase currency. Example: 'USD'.

CouponCodes

Array of strings / Optional

Discount codes that can be applied to the purchase.

Sample request

<?php

require ('PATH_TO_AUTH'); // authentication call

$cartItems = [];
$cartItem = new stdClass();
$cartItem->Code = 'my_product_code_1'; // product code defined in the Information tab, at product level
$cartItem->Quantity = 2; // quantity that is being purchased
$cartItems[0] = $cartItem;
$billingDetails = new stdClass();
$billingDetails->CountryCode = 'US'; // billing country
$deliveryDetails = new stdClass();
$deliveryDetails->CountryCode = 'AU'; // delivery country

$currency = 'USD'; // purchase currency

$couponCode = ['TANGIBLEPROMO']; // apply discount to promotion

try {
    $shippingPrice = $client->getShippingPrice($sessionID, $cartItems, $billingDetails, $deliveryDetails, $currency);
}
catch (SoapFault $e) {
    echo "ShippingPrice: " . $e->getMessage();
    exit;
}
var_dump("ShippingPrice", $shippingPrice);

Response

Parameters Type/Description
ShippingPrice

Object

This method returns an object, containing the shipping price available for a certain cart configuration.

Retrieve product tax categories

Overview

Use the getProductTaxCategories method via SOAP API 6.0 to retrieve the available tax categories and manage them for your catalog products.

Request Parameters

Parameters Type Required/Optional Description

sessionID

String Required

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.

ProductTaxCategories

String Required The product tax category for the product.

Request Example

<?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 = 'getTaxCategories';
    public const ADDITIONAL_OPTIONS = null;
    //array or JSON
    public const PAYLOAD = [];
}

class Client
{
    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ) {
        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, $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);
    }
}

$client = new Client();
$result = $client->call();
var_dump($result);

Response

Parameters Type/Description
Product Object

Pause subscription

Overview

For a paused subscription 2Checkout suspends all automatic charges for a predefined time period. When subscribers request to pause a subscription, this remains active until the end of the current billing cycle, at which point the subscription will move into a paused status.

Availability

Available free of charge for the 2Subscribe and 2Monetize accounts as part of the base package. Available for merchants on 2Sell accounts only if they have purchased the 2Bill add-on. Contact 2Checkout to request the activation of this functionality.

Benefits

For your Subscribers

Sometimes, for various reasons, your subscribers might want to interrupt their services for a period rather than just canceling them. By using the pause functionality, subscribers will be able to:

  • Pause a subscription to a service they use only infrequently.
  • Pause a subscription to a service they won't have access to for an extended period.
  • Pause a subscription to a seasonal service and renew it when they need to.
  • Pause a subscription to reduce certain costs for a period.

For you (Merchant)

As a merchant, you can benefit in multiple ways by allowing your customers to pause their subscriptions:

  • You can reduce churn​. How? Well, considering an important number of subscribers who plan to re-subscribe after canceling a subscription forget to ​do so, having an automated system in place to take care of this mishap ensures a sizable chunk of these sales would be renewed. Also, when given the alternative to pause a subscription, your customers will be less likely to cancel their subscriptions​.
  • You can reduce spillage​. You may choose to pause certain subscriptions that have payment issues likely to be resolved. This way you can simply pause the access of your subscribers to a certain service until their payment issues are solved, and thus stop spillage.
  • You can get insights on why your customers want to cancel or pause subscriptions and use that reason to offer them customized options for packaging, pricing, promotions, lead management, etc​.
  • Last but not least! You can increase customer satisfaction​, as your subscribers will be able to return to the services they like in a more simple and easier way.

Pause a subscription

Via the Merchant Control Panel

  1. Once the pause feature is enabled for your account, you can pause subscriptions directly from your Merchant Control Panel.
  2. Navigate to the subscription page and click on the Pause button next to the Cancel immediately option. The Pause button is displayed only for subscriptions that are eligible to be paused according to the requirements mentioned below. 
  3. When clicking the Pause button, a pop-up window opens allowing you to define the pause end date (resume date). The same pop-up notifies you of the interval during which the pause subscription is active, and when the next billing date is.
  4. Once the next billing date is reached, the subscription automatically resumes and becomes Active again if billing is successful. If billing is not successful, the status will either be Past-Due or Expired, depending on the previous expiration date, grace period, and resume date.  

Pause periods cannot be greater than 3 years.

Pause subscription events will be logged and displayed in the subscription history section of your Merchant Control Panel.

Via API 6.0

To allow pausing via API, we added the pauseSubscription method, available in the latest API version (6.0) for all protocols (JSON-RPC, SOAP, REST). 

To set pause subscription via API calls, see the following:

Via Shopper myAccount

Your shoppers can pause their subscriptions by themselves via their shopper MyAccount page as part of the churn prevention campaign flow.

Requirements

The following subscriptions cannot be paused: 

  • Inactive, Past-Due, Expired or Canceled subscriptions
  • Trial subscriptions
  • Lifetime subscriptions
  • Channel Manager subscriptions
  • Subscriptions set to manually renew
  • Subscriptions with usage billing pricing

Resume a subscription

Pauses associated with subscriptions can be canceled and subscriptions can be resumed before the pause starts or while the pause is in effect. When the pause is canceled, the following occurs:

  • If the pause is only scheduled, but not in effect
    • If there are other billing attempts scheduled in the time between the cancelation of the pause and the expiration of the subscription (i.e. NOW < Pre-expiration attempt < Expiration), the next billing date is set to the first billing attempt scheduled to happen.
    • If there are no other billing attempts scheduled in the time between the cancelation of the pause and the expiration of the subscription (i.e. Pre-expiration attempt < NOW < Expiration), the next billing date is set to NOW, and a billing attempt is made and the subscription status becomes ACTIVE until the subscription expiration date.
  • If the pause is in effect, the next billing date is set to NOW, and a renewal attempt is made. Depending on the success of the attempt one of the following happens:
    • If the renewal attempt is successful, the subscription status becomes ACTIVE, and the new expiration date is set to NOW() + Bill cycle length
    • If the renewal attempt is not successful, the subscription status will be based on the previous expiration date and grace period settings, in other words:
      • PAST DUE – if the moment the subscription is canceled is less than the previous expiration date + grace period.
      • EXPIRED – if the moment the subscription is canceled is greater than previous expiration date + grace period

Subscription pauses can be canceled as part of the following actions:

  • Manually
    • via Merchant Control Panel: Only for test subscriptions, using the Renew Subscription button.
    • via Manual renewal links: Redirecting to shopping cart where shoppers have a Manual renewal link
    • via API: Using the renewSubscription, placeOrder, and cancelPause methods
    • via 2Checkout Customer myAccount: Using the Renew now button and the Change credit card and payment flow.
  • Automatically
    • At a scheduled date and time – Subscription will resume automatically when the pause end date is reached.

Reporting

Pause subscription events will be logged and displayed in the subscription history section of your Merchant Control Panel. You can see all your paused subscriptions by navigating to your Merchant Control Panel - Orders & customers - Subscriptions and checking the Paused filter in the Subscription status field.

FAQ

1. Can paused subscriptions still be manually renewed?

Yes. There are several ways to manually renew a subscription scheduled to pause.

2. Can I cancel a subscription that is already paused?

Yes. You can always cancel a subscription that is already paused either via your Merchant Control Panel or via API or as part of the Refund/Chargeback process. Canceling the subscription from any of these sources will cause any pauses associated with the subscription to be marked as canceled only after the subscription itself is canceled.

Update a subscription

Overview

Change specific details about a subscription. Use the updateSubscription method to change specific details about a subscription. 

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 sessionIDexpires in 10 minutes.

Subscription

Required (Object)

 

You need to include the entire Subscription object keeping its structure unchanged (retrieve it using getSubscription) but you can update only specific parameters enumerated below.

 

EndUser

Object

 

 

End user details.

 

ExpirationDate

String

 

 

Subscription expiration date - If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then 2Checkout calculates the ExpirationDate according to your custom configuration. Note: The default 2Checkout API time zone is GMT+02:00.

 

SubscriptionEnabled

Boolean

 

 

Possible values: TRUE/FALSE

 

RecurringEnabled

Boolean

 

 

Possible values: TRUE/FALSE

 

ExternalCustomerReference

String

 

 

Unique customer alphanumeric (string) identifiers that you control. 

Move a subscription from under a customer to another customer entity.

Use the updateSubscription method. 2Checkout moves subscription under the customer for which you provide the 2Checkout customer reference or theExternal customer reference during the subscription update process. View example.

 

ProductId

Int

 

 

System-generated unique product ID. Needs to be the ID of an existing product in the 2Checkout system created under your account.

The product ID governs the product with which the subscription is associated.

Product types must match Regular - Regular or Bundle - Bundle.

IDs must identify products with the renewal system enabled (max billing cycle 36 months).

 

ProductName

String

 

 

The name of the product for identifier used under ProductID.

 

ProductQuantity

Int

 

 

Ordered quantity.

 

PriceOptionCodes

Array

 

 

Array of product options codes. Pricing options codes are case-sensitive.

To impact the renewal price, the PriceOptionsCodes need to belong to price options of pricing configurations used for the product with which the subscription is associated.

  ActivationKey String
    The subscription activation key.

All other parameters of the Subscription object are non-editable.

The 2Checkout system uses the updated subscription information for:

  • Manual and automatic renewals
  • Upgrades
  • Trial conversions

Response

Boolean

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

Request


<?php
$host   = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
    'location' => $host . "/soap/4.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;
}
$SubscriptionReferenceTest = '0177AAA92B';
try {
    $retrievedSubscription = $client->getSubscription($sessionID, $SubscriptionReferenceTest);
}
catch (SoapFault $e) {
    echo "retrievedSubscription: " . $e->getMessage();
    exit;
}
var_dump("retrievedSubscription", $retrievedSubscription);
var_dump ($retrievedSubscription);
$retrievedSubscription->RecurringEnabled = false;
$retrievedSubscription-> SubscriptionEnabled = true;
$retrievedSubscription->ExpirationDate = '2020-12-12';
try {
    $updatedSubscription = $client->updateSubscription($sessionID, $retrievedSubscription);
}
catch (SoapFault $e) {
    echo "updatedSubscription: " . $e->getMessage();
    exit;
}
var_dump("updatedSubscription", $updatedSubscription);

Assign price option group

Overview

Use the assignPricingConfigurationOptionGroup method to assign a PricingOption Group to a PricingConfiguration.

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.

PricingConfigurationCode

Required (string)

 

Unique, system-generated pricing configuration identifier.  

PriceOptionsGroupAssigned

Required (Object)

 

Details below.

 

Parameters Type/Description

PriceOptionsGroupAssigned

Object

Code

Required (string)

 

PricingOption Group identifier.

Required

Required (Object)

 

True or false depending on whether the pricing options group is required during the purchase process or not.

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$PricingConfigurationCode = 'YOUR_CODE';
$PriceOptionsGroupAssigned = new stdClass();
$PriceOptionsGroupAssigned->Code = 'USERSUSERS';
$PriceOptionsGroupAssigned->Required = TRUE;

try {
    $AssignedOption = $client-> assignPricingConfigurationOptionGroup ($sessionID, $PricingConfigurationCode, $PriceOptionsGroupAssigned);
}

catch (SoapFault $e) {
    echo "Options: " . $e->getMessage();
    exit;
}

var_dump("Options", $AssignedOption);

?>

Import usage from CSV

Overview

Upload usage data through the 2Checkout API from a CSV (comma-separated values) file for active and trial subscriptions. Usage data uploaded via JSON-RPC APIv6 will be used to charge subscribers for the metered resources they consume. Metered billing allows for usage fees in arrears to be added to recurring subscription costs.

2Checkout will capture the parameters sent via JSON-RPC APIv6 and import the usage data into the system. Once the upload process is complete, you'll be able to access the uploaded file in the Usage area of the Merchant Control Panel.

Set the DATE parameter to GMT+2 time zone, when making the API call to the Usage Upload endpoint.

Method and URL

POSThttps://api.2checkout.com/subscription/payperusage/receiver/index.php

Parameters

Parameters

Type

Required/Optional

Description

Used in HASH validation*

merchant

String

Required

Your unique 2Checkout merchant code. View merchant code.

YES

secret_key

String

Required

The secret key associated to your account. View secret key.

YES

file_MD5

String

Required

The md5 hash of the CSV file used to upload usage.

YES

hash

String

Required

The MD5 hmac key for the request.

N/A

UsageStart Datetime Required The datetime when the usage started; can be the same as UsageEnd. For existing records, this will be updated to time 00:00:00. N/A
UsageEnd Datetime Required The datetime when the usage ended and was recorded.  For existing records this will be updated to time 23:59:59, this will be enforced in the CSV upload as well. N/A
OptionCode String Required Unique codes you provided as identifiers of specific Pricing Options in the Usage Scale Pricing Options Group scheme. Example: metered pricing.   N/A
Description String Optional It can be used to store a short merchant comment of the usage being uploaded. This can be anything, from the source of usage (mobile, web, etc.), to why changes occurred, etc. Example: Subscription usage for September. N/A
SubscriptionRef String Required Unique code that represents a subscription. Example: 83FE4FEF2. N/A

Request Example

<?php
//hmac
$date             = date("Y-m-d");
$fileReceived_md5 = md5_file("[Path to the CSV file used for usage upload]");
$merchantCode     = "";
/* 2Checkout Code */
$merchantKey      = "";
/* Merchant Secret Key */
$hashParams       = "MERCHANT={$merchantCode}&FILE={$fileReceived_md5}&DATE={$date}";
$hmac             = hash_hmac('md5', $hashParams, $merchantKey);
?>

<html>
<body>
<form method="post" action="https://api.2checkout.com/subscription/payperusage/receiver/index.php" enctype="multipart/form-data">
<input type="text" name="MERCHANT" value="<?php
echo $merchantCode;
?>" /><br />
<input type="text" name="HASH" value="<?php
echo $hmac;
?>" /><br />
<input type="file" name="OPTIONS" /><br />
<input type="hidden" name="FILE_MD5" value="<?php
echo $fileReceived_md5;
?>" />
<input type="hidden" name="DATE" value="<?php
echo $date;
?>" />
<input type="submit" /><br />
</form>
</body>
</html>

Error handling

Message code

Message description

Resolution

1

The upload operation completed successfully.

N/A

Invalid account!

The merchant code provided does not belong to a vendor in the 2Checkout system.

Please check your merchant code and make sure you're using the correct version. View merchant code.

Bad signature on the received file!

The upload CSV file's md5 signature is different than the one sent as a parameter.

Please make sure that you're using the correct md5 signature for the CSV file, or that you're uploading the CSV file for which the signature was generated.

Invalid signature

The HMAC calculated by the 2Checkout system is different from the one you're sending.

Please make sure that all parameters use correct values.

Add a subscription plan/product

Overview

Use the addProduct method to create subscription plans/products for your 2Checkout account. 

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.

Product

Required (object)

 

Use this object to configure your subscription plans/products.

 

You can set all Product parameters except AvangateID. The 2Checkout system sets the unique product ID. The AvangateID is not editable.

Mandatory parameters

 

ProductName
ProductCode
PricingConfigurations

Response

bool(true)

Request

<?php
 
require ('PATH_TO_AUTH');
 
$Product = new stdClass();
$Product->AvangateId = null;
$Product->ProductCode = 'API_Imported_1234567899';
$Product->ProductType = 'REGULAR';
$Product->ProductName = 'API_Subscription Imported New';
$Product->ProductVersion = '1.0';
$Product->GroupName = 'General';
 
//Shipping classes
 
/* $Product->ShippingClass = new stdClass();
$Product->ShippingClass->Name = '2o9rlujkvg';
$Product->ShippingClass->Amount = 89.40;
$Product->ShippingClass->Currency = 'GBP';
$Product->ShippingClass->ApplyTo = 'ct29dr3fj4';
$Product->ShippingClass->Type = 'bii521vp6k'; */
 
$Product->GiftOption = false;
$Product->ShortDescription = 'Placeat cumque necessitatibus est minus praesentium ut non quibusdam. Molestias provident tempore eligendi mollitia quia.';
$Product->LongDescription = 'Corrupti inventore vitae nesciunt ab. Nemo cum non maiores. Non repudiandae est iste voluptatibus.';
$Product->SystemRequirements = null;
$Product->ProductCategory = null;
$Product->Platforms = array();
$Product->Platforms[0] = new stdClass();
$Product->Platforms[0]->PlatformName = null;
$Product->Platforms[0]->Category = null;
$Product->Platforms[1] = new stdClass();
$Product->Platforms[1]->PlatformName = null;
$Product->Platforms[1]->Category = null;
$Product->ProductImages = array();
$Product->ProductImages[0] = new stdClass();
$Product->ProductImages[0]->URL = null;
$Product->ProductImages[0]->Default = false;
$Product->ProductImages[1] = new stdClass();
$Product->ProductImages[1]->URL = null;
$Product->ProductImages[1]->Default = true;
$Product->TrialUrl = null;
$Product->TrialDescription = null;
$Product->Enabled = True;
 
//Product additional fields
 
/* $Product->AdditionalFields = array();
$Product->AdditionalFields[0] = new stdClass();
$Product->AdditionalFields[0]->Label = 'i44wak1dzp';
$Product->AdditionalFields[0]->Code = 'ITYAK0OEWJ';
$Product->AdditionalFields[0]->Enabled = false;
$Product->AdditionalFields[0]->Required = false;
$Product->AdditionalFields[0]->URLParameter = 'id1ktigl6d';
$Product->AdditionalFields[1] = new stdClass();
$Product->AdditionalFields[1]->Label = 'aig699lmo1';
$Product->AdditionalFields[1]->Code = 'V28TP07PQN';
$Product->AdditionalFields[1]->Enabled = false;
$Product->AdditionalFields[1]->Required = true;
$Product->AdditionalFields[1]->URLParameter = '8to9p6y54j'; */
 
//Product localization
 
/* $Product->Translations = array();
$Product->Translations[0] = new stdClass();
$Product->Translations[0]->Name = 'zsg7wtg4e5';
$Product->Translations[0]->Description = 'Voluptate iure ut quam omnis impedit. Deserunt facere id dolores doloribus quis. Minima nostrum ut possimus incidunt vel est sint. Odit tempora omnis iste nesciunt commodi accusantium placeat.';
$Product->Translations[0]->Language = 'pt';
$Product->Translations[0]->LongDescription = 'Pariatur molestiae sit dignissimos modi. Aut modi libero numquam repudiandae. Doloribus explicabo delectus fugiat amet. Excepturi quo consequatur sint adipisci.';
$Product->Translations[0]->SystemRequirements = 'c16tvyg88c';
$Product->Translations[0]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[0]->TrialDescription = 'Voluptas rem sit ut voluptas molestias quidem ut. Maiores facilis tempora voluptates. Consequuntur illum recusandae hic magni iste.';
$Product->Translations[1] = new stdClass();
$Product->Translations[1]->Name = 'cv2sx15aby';
$Product->Translations[1]->Description = 'Ut distinctio asperiores et a placeat voluptatem et. Et eveniet temporibus aut vel. Nemo occaecati praesentium dolor fugiat rerum assumenda expedita.';
$Product->Translations[1]->Language = 'fr';
$Product->Translations[1]->LongDescription = 'Et ut nostrum molestiae voluptates soluta. Molestiae cum in ut qui. Voluptatem voluptates vero odit quia corporis. In impedit eligendi sed expedita nihil temporibus nobis.';
$Product->Translations[1]->SystemRequirements = 'cfv2amk25j';
$Product->Translations[1]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[1]->TrialDescription = 'Voluptatem ut possimus consequatur iste. Recusandae id quia sed quibusdam aut debitis. Cupiditate harum architecto quod quia.'; */
 
 
$Product->PricingConfigurations = array();
$Product->PricingConfigurations[0] = new stdClass();
$Product->PricingConfigurations[0]->Default = false;
$Product->PricingConfigurations[0]->Code = null;
$Product->PricingConfigurations[0]->Name = 'API Pricing Configuration Test';
$Product->PricingConfigurations[0]->BillingCountries = array();
$Product->PricingConfigurations[0]->PricingSchema = 'DYNAMIC';
$Product->PricingConfigurations[0]->PriceType = 'NET';
$Product->PricingConfigurations[0]->DefaultCurrency = 'USD';
$Product->PricingConfigurations[0]->Prices = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular = array();
$Product->PricingConfigurations[0]->Prices->Regular[0] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[0]->Amount = 100;
$Product->PricingConfigurations[0]->Prices->Regular[0]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Regular[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Regular[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Regular[1] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[1]->Amount = 200;
$Product->PricingConfigurations[0]->Prices->Regular[1]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Regular[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Regular[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal = array();
$Product->PricingConfigurations[0]->Prices->Renewal[0] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Amount = 50;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal[1] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Amount = 60;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->PriceOptions = array();
 
/* $Product->BundleProducts = array();
$Product->BundleProducts[0] = new stdClass();
$Product->BundleProducts[0]->ProductCode = '540Q45PQBN';
$Product->BundleProducts[0]->ProductId = 48439;
$Product->BundleProducts[1] = new stdClass();
$Product->BundleProducts[1]->ProductCode = 'PA3JDB5SZ2';
$Product->BundleProducts[1]->ProductId = 46439;
 */
$Product->Fulfillment = 'NO_DELIVERY';
$Product->Prices = array();
 
$Product->GeneratesSubscription = True;
$Product->SubscriptionInformation = new stdClass();
$Product->SubscriptionInformation->DeprecatedProducts = array();
$Product->SubscriptionInformation->BundleRenewalManagement = null;
$Product->SubscriptionInformation->BillingCycle = 1;
$Product->SubscriptionInformation->BillingCycleUnits = 'M';
$Product->SubscriptionInformation->IsOneTimeFee = false;
 
$Product->SubscriptionInformation->ContractPeriod = new stdClass();
$Product->SubscriptionInformation->ContractPeriod->Period = -1;
$Product->SubscriptionInformation->ContractPeriod->PeriodUnits = 'days';
$Product->SubscriptionInformation->ContractPeriod->IsUnlimited = TRUE;
$Product->SubscriptionInformation->ContractPeriod->Action = 'RESTART';
$Product->SubscriptionInformation->ContractPeriod->EmailsDuringContract = 'altenwerth.elise@gmail.com';
 
//$Product->SubscriptionInformation->UsageBilling = 77;
 
$Product->SubscriptionInformation->GracePeriod = new stdClass();
$Product->SubscriptionInformation->GracePeriod->Type = 'GLOBAL';
$Product->SubscriptionInformation->GracePeriod->Period = 14;
$Product->SubscriptionInformation->GracePeriod->PeriodUnits = 'D';
$Product->SubscriptionInformation->GracePeriod->IsUnlimited = false;
 
$Product->SubscriptionInformation->RenewalEmails = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Type = 'CUSTOM';
$Product->SubscriptionInformation->RenewalEmails->Settings = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before30Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before15Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before7Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before1Day = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->OnExpirationDate = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After5Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After15Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before30Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before15Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before7Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before1Day = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->OnExpirationDate = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After5Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After15Days = true;
 
$Product->FulfillmentInformation = new stdClass();
$Product->FulfillmentInformation->IsStartAfterFulfillment = false;
$Product->FulfillmentInformation->IsElectronicCode = false;
$Product->FulfillmentInformation->IsDownloadLink = false;
$Product->FulfillmentInformation->IsBackupMedia = false;
$Product->FulfillmentInformation->IsDownloadInsuranceService = false;
$Product->FulfillmentInformation->IsInstantDeliveryThankYouPage = false;
$Product->FulfillmentInformation->IsDisplayInPartnersCPanel = false;
 
/* $Product->FulfillmentInformation->CodeList = new stdClass();
$Product->FulfillmentInformation->CodeList->Code = '5C6F821DA1';
$Product->FulfillmentInformation->CodeList->Name = 'General delivery';
$Product->FulfillmentInformation->CodeList->Type = 'STATIC';  */
 
//$Product->FulfillmentInformation->BackupMedia = new stdClass();
 
//$Product->FulfillmentInformation->ProductFile = new stdClass();
 
/* $Product->FulfillmentInformation->AdditionalInformationByEmail = 'arlene03@hotmail.com';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations = array();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0] = new stdClass();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Name = 'kbaa1aj7po';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Description = 'Velit delectus sed amet sunt. Sunt deserunt quos recusandae consequuntur est. Velit aut optio error eius rerum. Nihil ipsam possimus ipsum dolores consequatur adipisci.';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Language = 'fr';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1] = new stdClass();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Name = 'l4ocvz9wwa';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Description = 'Esse voluptatem delectus officiis eos quas asperiores. Quas non hic reiciendis enim. Consequatur similique recusandae laboriosam et autem.';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Language = 'pt';
$Product->FulfillmentInformation->AdditionalThankYouPage = 'rvlhvkmxkp';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations = array();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0] = new stdClass();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Name = 'rl981w4nua';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Description = 'Qui explicabo molestiae dolorem consequuntur. Ullam maiores temporibus vitae. Totam eos et consequatur. Est sit minima animi nam ut aut.';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Language = 'en';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1] = new stdClass();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Name = 'qye8hlwz3e';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Description = 'Id est rerum deserunt non et quia magnam. Minus aut nostrum dicta est officiis quia. Commodi nobis sit porro accusamus rerum quis. Fugit et asperiores eum.';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Language = 'fr';
 */
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addProduct',
'params' => array($sessionID, $Product)
);
 
$addedProduct = callRPC($jsonRpcRequest, $host);
var_dump ($addedProduct);

Track affiliates via affiliate ID URL parameters

Overview

2Checkout has expanded affiliate tracking capabilities with the introduction of support for the inclusion of Affiliate ID parameters ?AVGAFFILIATE=[affiliate identifier] in certain URLs pointing to your web properties.

Availability

This feature is available on-demand. Please contact 2Checkout directly if you'd like to take advantage of Affiliate ID URL Parameters,

Affiliate ID URL Parameters are available in concert with two types of Product Links that your affiliates can generate, namely links to:

  • Your website (vendor website): when clicking on this type of links, shoppers from your affiliates are sent to the homepage of your website. Affiliates using this type of links get credited for sales no matter what products are purchased by shoppers during the validity period of the cookie set on their machines by 2Checkout (30 to 180 days, according to vendor preferences).
  • Custom URL: affiliates create these types of links themselves, redirecting shoppers to a URL of their choice, such as special landing pages on your website.

How it works

When shoppers click on links on the affiliates' site such as the ones described above, pointing to your website they're taken to 2Checkout server (page loader), where affiliate cookies are set, and then redirected to your website. The redirect process involves adding the AVGAFFILIATE parameter to the link automatically.

For example, the following link:

http://wwww.yourwebsite.com/shop.html

becomes

http://wwww.yourwebsite.com/shop.html?AVGAFFILIATE=12345

(for an affiliate with the 12345 affiliate ID).

By including affiliate ID parameters in redirects to your website, 2Checkout enables you to better monitor the traffic generated by your affiliates.

Use case

AVGAFFILIATE functionality needs to be enabled for your account.

  1. Affiliates create vendor website or custom URL links and place them on their websites.
  2. AVGAFFILIATE is included automatically into links.
  3. Customers click the links to access a free trial of your service.
  4. Customers are taken to the 2Checkout server (page loader), where affiliate cookies are set (this stage of the process is invisible to end users) and then redirected to your website when they access the free trial of the service.
  5. Customers visit your site directly to buy the full product at a later date, or send the link to the financial department in a B2B scenario to purchase the service on their behalf.
  6. Because of the presence of the AVGAFFILIATE, the member of the 2Checkout Affiliate Network who provided the initial referral is credited for the sale and paid the appropriate commission.

Update a cross-sell campaign

Overview

Use the updateCrossSellCampaign method to update a cross-sell campaign for your 2Checkout account. 

Request parameters

Parameters Type Required Description

CampaignCode 

 String 

Required

The campaign code that can be used when placing orders. 

MasterProducts 

Array of strings 

Required

Array of product codes to apply to this campaign. 

DisplayType 

String 

Required

The display type of the campaign; Can be cart, review, finish.

DisplayInEmail 

Boolean 

Required

Determines if the campaign will be displayed in payment receipt emails.

Products 

Array of objects 

Required

Array of objects containing the product codes pointing to the promoted products when tied to each master product, the discount value, and the discount type (can only be percent).

ProductCode 

String 

Required

Product code of the product to be recommended to the shopper.

Discount 

Float 

Required

Value of the discount.

DiscountType 

String 

Required

Can only be 'PERCENT'.

Name 

String 

Required

Name of the campaign.

CampaignStatus

String 

Optional 

The status of the cross-sell campaign.

StartDate 

String 

Optional 

The date when the cross-sell campaign starts, formatted as YYYY-MM-DD.

EndDate 

String 

Optional 

The date when the cross-sell campaign ends, formatted as YYYY-MM-DD.

Response parameters

Parameters Type Required Description

CampaignCode 

 String 

Required

The campaign code that can be used when placing orders. 

MasterProducts 

Array of strings 

Required

Array of product codes to apply to this campaign. 

DisplayType 

String 

Required

The display type of the campaign; Can be cart, review, finish.

DisplayInEmail 

Boolean 

Required

Determines if the campaign will be displayed in payment receipt emails. Can be 'true' or 'false'.

Products 

Array of objects 

Required

Array of objects containing the product codes pointing to the promoted products when tied to each master product, the discount value, and the discount type (can only be percent).

ProductCode 

String 

Required

Product code of the product to be recommended to the shopper.

Discount 

Float 

Required

Value of the discount.

DiscountType 

String 

Required

Can only be 'PERCENT'.

Name 

String 

Required

Name of the campaign.

CampaignStatus

String 

Optional 

The status of the cross-sell campaign.

StartDate 

String 

Optional 

The date when the cross-sell campaign starts, formatted as YYYY-MM-DD.

EndDate 

String 

Optional 

The date when the cross-sell campaign ends, formatted as YYYY-MM-DD.

Request sample

<?php 
$require ('PATH_TO_AUTH'); 
 
$csCampaign = new stdClass(); 
$csCampaign->CampaignCode = '2Xrl85eSkemBv3G3ea+9fg=='; 
$csCampaign->MasterProducts = ['C8851A5BC9']; 
$csCampaign->DisplayType = 'review'; 
$csCampaign->DisplayInEmail = true; 
$csCampaign->Name = 'testingSoap'; 
$csCampaign->StartDate = '2019-10-21'; 
$csCampaign->EndDate = '2021-10-21'; 
$csCampaign->CampaignStatus = 'ACTIVE'; 
$csCampaign->Products = []; 
$csCampaign->Products[0] = new stdClass(); 
$csCampaign->Products[0]->ProductCode = '512712FA53'; 
$csCampaign->Products[0]->Discount = 19; 
$csCampaign->Products[0]->DiscountType = 'PERCENT'; 
 
try { 
    $csCampaignResponse = $client->updateCrossSellCampaign($sessionID, $csCampaign); 
} catch (SoapFault $e) { 
    echo  $e->getMessage(); 
} 

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