Skip to main content

One click (1-click) purchase

Overview

2Checkout supports 1-click purchases for returning customers who paid for their previous orders with:

  • Credit/Debit cards
  • PayPal
  • iDEAL
  • Alipay

Availability

Select 2Checkout accounts. Contact 2Checkout for more details. 

How does this work?

  1. Identify returning customers. 
  2. Access data on the previous purchases of returning customers.
  3. Validate previous order references for 1-click purchase scenarios using the isValidOrderReference method.
  4. Place a new order using a valid previous order reference as the payment method. 
  5. 2Checkout charges returning customers using their payment-on-file information, either a card or their PayPal account. 

Requirements

  • Use only references of previous orders with one of the following statuses AUTHRECEIVED or COMPLETE.
  • The email address of the BillingDetails object is mandatory and it needs to match the email address used as a part of the billing details of the initial order whose reference you're now using to place a new order. 2Checkout checks whether the email addresses are identical, and throws an error if they're not, blocking the order placement process. Note: You need to provide only the email address of the shopper, and can ignore the rest of the required customer billing information. If you enter any billing details in addition to the email address, you'll have to provide all information required in the BillingDetails object.
  • For orders paid with PayPal, the original order must have automatic renewal enabled so that it can be reused for future 1-click purchases.

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.

Order

Required (Object)

 

Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details.

Response

Order information

Object

Request


<?php
echo "<pre>";
$host   = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/3.0/?wsdl", array(
    'location' => $host . "/order/3.0/soap",
    "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 = "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 = "SECRET_KEY";// your account's secret key available in the 'System settings' area of the Merchant Control Panel: https://secure.2checkout.com/cpanel/account_settings.php
$now = date('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);
try {
    $sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage();
    exit;
}
$orderReference = '45452071';
try {
    $validOrderRef = $client->isValidOrderReference($sessionID, $orderReference);
}
catch (SoapFault $e) {
    echo "validOrderRef: " . $e->getMessage();
    exit;
}
var_dump("validOrderRef", $validOrderRef);
try {
    $existentOrder = $client->getOrder($sessionID, $orderReference);
}
catch (SoapFault $e) {
    echo "existentOrder: " . $e->getMessage();
    exit;
}
$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'usd';
$Order->Country = 'US';
$Order->Language = 'en';
$Order->CustomerIP = '91.220.121.21';
$Order->ExternalReference = NULL;
$Order->Source = NULL;
$Order->AffiliateId = NULL;
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1';
$Order->Items[0]->Quantity = 1; 
$Order->Items[0]->PriceOptions = NULL;
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false; 
$Order->Items[0]->AdditionalFields = NULL;
$Order->BillingDetails = new stdClass();
$Order->BillingDetails = $existentOrder->BillingDetails;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'PREVIOUS_ORDER';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->CustomerIP = '10.10.10.10';
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = true;
$Order->PaymentDetails->PaymentMethod->RefNo = $orderReference;
$Order->Promotions = NULL;
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;
try {
    $newOrderPaidWithPreviousRef = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
    echo "newOrderPaidWithPreviousRef: " . $e->getMessage();
    exit;
}
var_dump("newOrderPaidWithPreviousRef", $newOrderPaidWithPreviousRef);
?>

 

Add promotion translations

Overview

Use the addPromotionTranslations method to add localized texts to existing promotions.

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 add translations to.

promotions

Required (array of PromotionTranslations objects)

PromotionTranslations  Object

 

language

Required (string)

 

 

ISO country code corresponding to the country you want to set the translation for.

 

name

Required (string)

 

 

Localized promotion name applicable to the selected country.

Response

Parameters Type/Description

promotionTranslation

Object

Request

<?php

function callRPC($Request, $host, $Debug = true) {
    $curl = curl_init($host);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_VERBOSE, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);
    if ($Debug) {
        $RequestString;
    }
    $ResponseString = curl_exec($curl);
    if ($Debug) {
        $ResponseString;
    }
    if (!empty($ResponseString)) {
        var_dump($ResponseString);
        $Response = json_decode($ResponseString);
        if (isset($Response->result)) {
            return $Response->result;
        }
        if (!is_null($Response->error)) {
            var_dump($Request->method, $Response->error);
        }
    } else {
        return null;
    }
}

$host = 'https://api.avangate.com/rpc/3.1/';

$merchantCode = "YOUR_MERCHANT_CODE"; // your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY"; // your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php

$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);

$i = 1;

$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;

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

// Promotion code corresponding to the promotion you want to add translations to
$promotionCode = '';

// Defining a translation for German shoppers
$promotionTranslation1 = new stdClass;
$promotionTranslation1->Language = 'de'; 
$promotionTranslation1->Name = 'YOUR_GERMAN_PROMOTION_NAME';

// Defining a translation for Bulgarian shoppers
$promotionTranslation2 = new stdClass;
$promotionTranslation2->Language = 'bg'; 
$promotionTranslation2->Name = 'YOUR_BULGARIAN_PROMOTION_NAME';

$translations = [$promotionTranslation1, $promotionTranslation2];

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

 

Assign to product group

Overview

Use the assignProductGroup method to assign a product to a product group. Following the assignation, the 2Checkout system uses the shopping cart template associated with the product group as the default cart design when shoppers purchase a subscription plan/product.

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.

productCode

Required (string)

 

The code of the product you wish assigned to the group.

groupCode Required (string)
  Unique, system-generated identifier assigned to product groups. 

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$productCode = "YOUR_PRODUCT_CODE";
$groupCode = "YOUR_PRODUCT_GROUP_CODE";

try {
    $AssignedProductGroup = $client->assignProductGroup($sessionID, $ProductCode, $Code);
}

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

var_dump("AssignedProductGroup", $AssignedProductGroup);

?>

 

eCommerce Order Integration

Overview

Verifone CPQ will integrate orders placed by customers on their eCommerce websites, as well as orders placed by customers accepting proposals created in the CPQ application using the B2B flow.

How it works

The order information will be sent to Salesforce so that salespeople can choose to manage deals later on. Order information (create/update account/contact, create opportunity) will be passed via IPN webhooks.
Orders are created in the Verifone CPQ platform on subscription activation or during the subscription lifetime, each time a new billing cycle is initiated.

See here how Salesforce objects are mapped in the 2Checkout system.

Retrieve product info by code

Overview

Use getProductByCode to extract product information using the unique identifier you assign to subscription plans/products.  

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.

ProductCode

String

 

The product code that you control.

Response

Parameters Type/Description
Product Object

Request

<?php

require ('PATH_TO_AUTH');

$ProductCode = "subscr1";

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

?>

Advanced Partner Control Panel customization

Overview

Use HTML, CSS and JavaScript to customize the look and feel of the Control Panel used by your partners/resellers/distributors.

Availability

This feature is available in tandem with the 2Checkout Channel Manager (Partner) package.

Requirements

Customization work can be done by you or by 2Checkout (contact us directly for more details).

How do I enable a custom template for the Partner Control Panel?

  1. Navigate to Interface Templates under Setup.
  2. Click on the Partners tab.
  3. Select the Advanced customization option.
  4. Click on Add template.

How do I customize the template?

  1. Enter a unique name.
  2. Select the languages for which the customization will be displayed:
    • English (default)
    • German
    • French
    • Spanish
    • Japanese
    • Portuguese
    • Italian
  3. Use external JavaScript and CSS files for customization or use the inline editors available in the template customization page.

What are the Partner Control Panel pages that I can customize?

  • Partner Control Panel Dashboard (full customization, it includes the PartnerCPanel JS object). The remaining Control Panel pages do not feature this object, so customization capabilities are limited.
  • Partner ordering process (partial customization, as the process requires loading pages with AJAX. Hint: you could use a hidden DIV and personalize the contents).
  • Partners SignupPartners LoginPartners product registration by using a cart template available in the Default Template area.

Partner Control Panel templates are standalone designs that do not share code with cart or myAccount templates. As such, if you check the Partners option on either a cart or a myAccount template, the template impacts exclusively the Partner Control Panel and gets moved to the Partner templates area. You cannot undo this process.

External JavaScript and CSS files

Upload one or more .CSS files, and similarly use a single or multiple .JS files, but also graphical elements to 2Checkout's server via the Media center. Unless uploaded to the 2Checkout server, these files will not allow for an SSL connection to be established.

When multiple .CSS or .JS files are uploaded, the last ones added will take precedence over previous items. Important: 2Checkout recommends that you use only a single .CSS file and a single .JS file in order to optimize page load time.

2Checkout Interface Templates use JavaScript and CSS external files to ensure a fast page loading time. 2Checkout will automatically merge the external JavaScript and CSS files uploaded via "Media Center" with the built-in interface files and serve them from a CDN (Content Delivery Network) for increased performance.

Once uploaded, the CSS and JS files will be featured in the External JavaScript and CSS files area of custom templates.

When added to a template, the custom .CSS and .JS files will override the default .CSS and .JS files.

Inline code editors

You can edit the:

  • Doctype Declaration
  • Page Title
  • Meta & CSS
  • HTML Code
  • JavaScript code

Click Save per-editor after inline changes.

CSS classes

You can use the following CSS classes to further customize the look and feel of the Partner Control Panel.

 

Class

Scope

Availability

partners__breadcrumb

Breadcrumbs area

All partner Control Panel pages

partners__header__bar

Header area

All partner Control Panel pages

partners__footer

Footer area

All partner Control Panel pages

partenrs__body__table

Content area

All partner Control Panel pages

partners__languages

Language selector area

All partner Control Panel pages and in the header

partners__main__menu

Menu area

All partner Control Panel pages

partners__errors

Error display area

All partner Control Panel pages

partners__messages

Message/notification display area

All partner Control Panel pages

partners__favorite__links

Favorites display area

If used

partners__quick__links

Quick link display area

If used

partners__quick__links__sidebar

Quick links sidebar display area

If used

partners__quick__stats

Statistics area

Homepage/dashboard

partners__proformas__listing

Partner invoices area

Homepage/dashboard

partners__orders__listing

Order listing area

Homepage/dashboard

In addition, you can also use the following JavaScript object included on the dashboard, the Partner Control Panel homepage.

window.PartnerCPanel = {
    /*optional - present on all pages that display the breadcrumb*/
    Breadcrumb: {
        All: [ /*ordered array of breadcrumb items, the last item is the one related to the current page*/ {
                Label: string,
                /*translated label of the breadcrumb item*/
                Url: string /*url to go to the breadcrumb item*/
            }
            /*, ...*/
        ]
    },
    /*optional - present if the partner is assigned to more than one vendor*/
    Companies: [ /*array of companies the partner can switch between and login into*/ {
            CompanyName: string,
            /*partner company name*/
            FirstName: string,
            /*partner first name*/
            LastName: string,
            /*partner last name*/
            MerchantCommercialName: string,
            /*vendor commercial name for this partner*/
            Selected: boolean,
            /*true if this is the current selected partner*/
            Url: string /*url to allow switching to this partner*/
        }
        /*, ...*/
    ],
    IS_LOGGED_IN: boolean,
    /*true when the partner is logged in, false otherwise*/
    Languages: { /*object with available languages*/
        All: [ /*array of all available languages*/ {
                Lang: string,
                /*3-letter language code*/
                LangAbr: string,
                /*2-letter language code*/
                Language: string,
                /*language name*/
                LanguageEN: string /*language name, translated in english*/
            }
            /*, ...*/
        ],
        Selected: string /*2-letter code of the selected language*/
    },
    Links: {
        /*optional - present only if any favorite links are defined by the partner*/
        Favorites: {
            All: [ /*array with all favorite links*/ {
                    Label: string,
                    Url: string
                }
                /*, ...*/
            ]
        },
        General: { /*object with all general links*/
            Contact: {
                Label: string,
                /*translated link label*/
                Url: string /*link url*/
            },
            /* same for Help, Home, Info, Logout*/
        },
        /*optional - present only if any top links are defined by the partner*/
        Top: {
            All: [ /*array with all top links*/ {
                    Label: string,
                    Url: string
                }
                /*, ...*/
            ]
        },
        /*optional - present only if any quick links are defined by the partner*/
        Quick: {
            All: [ /*array with all quick links*/ {
                    Label: string,
                    Url: string
                }
                /*, ...*/
            ]
        }
    },
    /*optional - present only if the vendor has a specific logo image*/
    Logo: {
        CompanyName: string,
        /*vendor company name*/
        Url: string /*Url of the image*/
    },
    Menu: { /*menu item details*/
        All: { /*object with keys for all the menu items details - below are examples based on the menu items at the current release date*/
            ACC_INFO: {
                Label: string,
                /*translated menu item*/
                Parent: string,
                Url: string /*url of the menu item*/
            },
            /* same for ADD_ORDER, ALL_ORDERS, CUSTOMERS, GRAPHICAL_REPORTS, PARTNERSHIP_DETAILS, PRODUCTS, PROFORMA_LISTING, REFUNDS, RESOURCES, USER_ACCESS */
        },
        Selected: string /*Url of the selected menu item*/
    },
    /*partner information*/
    Partner: {
        FirstName: string,
        LastName: string
    },
    /*vendor information*/
    Vendor: {
        CompanyName: string,
        CommercialName: string
    },
    /*optional - present only on specific pages, as needed; this element contents are to be changed over time*/
    SECTION: { /*relevant information on specific areas on the current page*/
        /*optional - present only on homepage*/
        INDEX: { /*relevant information on different homepage areas*/
            ORDERS: [ /*array of last 5 orders - exposes the orders data - present on homepage*/ {
                    Currency: string,
                    /*3-letter uppercase code*/
                    OrderDate: string,
                    /*yyyy-mm-dd*/
                    RefNo: string,
                    StatusCode: string,
                    /*ex: AWAITING_PAYMENT*/
                    Total: string,
                    /*user-friendly amount, two digits*/
                    Url: string /*url to access the order details*/
                }
                /*, ... */
            ],
            PROFORMAS: { /*data regarding the overdue proforma invoices - present on homepage*/
                count: {
                    amount: string,
                    /*user-friendly amount of all overdue proformas, converted to the default partner decont currency*/
                    count: string /*count of all overdue proformas*/
                },
                data: [ /*array of first 5 overdue proformas*/ {
                        IdProforma: string,
                        ProformaNumber: string,
                        /*proforma number*/
                        Status: string,
                        /*proforma invoice status*/
                        amount: string,
                        /*user-friendly proforma amount, converted to the default partner decont currency*/
                        due: string /*days overdue*/
                    }
                    /*, ... */
                ]
            },
            STATS: { /*data regarding the last week stats data - present on homepage*/
                licences_no: {
                    count: integer /*count of last week delivered subscriptions*/
                },
                orders: {
                    amount: float,
                    /*amount of last week complete orders, converted to the default partner decont currency*/
                    count: integer /*count of last week complete orders*/
                },
                orders_ni: {
                    amount: float,
                    /*amount of last week orders not yet invoiced, converted to the default partner decont currency*/
                    count: integer /*count of last week orders not yet invoiced*/
                },
                profit: { /*last week profit*/
                    amount: float /*converted to the default partner decont currency*/
                },
                proformas: {
                    amount: float,
                    /*amount of last week unpaid proforma invoices, converted to the default partner default currency*/
                    count: integer /*count of last week unpaid proforma invoices*/
                }
            },
            TOTAL_ORDERS: string /*count of all partner orders*/
        }
    }
};

 

Use the inline editors to overwrite specific lines in the existing .CSS or .JS files. Note: Changing these files is an advanced operation best handled by experienced programmers.

Add your custom CSS and JS files. To upload the files, use the Media Center area of the Control Panel. Unless custom CSS and JS files are uploaded to a secure 2Checkout server, a secure connection (SSL) cannot be established for your customers.

When present, code in the inline editor overrides both the custom .CSS and .JS files added to a template as well as the default .CSS and .JS files.

Make sure to delete from the inline editors any pieces of code that you customized using external .CSS and .JS files. For example, if you defined the full CSS through an external file, delete the code in the inline editor completely. However, in scenarios in which you customized only some portions of the template using the .CSS file, leave the necessary code in the inline editor.

HTML tags

Use the following tags to include/exclude specific content such as the language selector, the menu, footer and breadcrumbs. All tags are optional with the exception of PAGECODE, that is mandatory.

  • Mandatory content:
    • <--{PAGECODE}--> Loads the dynamic content of the Partner Control Panel.
  • Optional content:
    • <--{LANGUAGES}--> Language selector
    • <--{MENU}--> Main menu
    • <--{HEADER}--> Header area
    • <--{FOOTER}--> Footer area
    • <--{BREADCRUMB}--> Navigation breadcrumbs for Control Panel pages
    • <--{QUICK_LINKS}--> Quick links - the grey top bar above the breadcrumbs
    • <--{FAVORITE_LINKS}--> Favorite links - displayed in the right sidebar only after you mark pages as favorites
    • <--{SIDE_LINKS}--> Side links - the links below the Favorite links area (only available in certain scenarios)
    • <--{TOP_LINKS}--> Top links - the top left row of links next to the language selector

Simple customization settings

Simple customization settings are automatically migrated to your templates when you start using advanced customization. You will be able to find your personalized settings in the Meta & CSS inline editor.

How does the preview work?

The preview functionality uses a dummy Partner Control Panel account. To access it:

  1. Navigate to Interface Templates under Setup.
  2. Click on the Partners tab.
  3. Select the Advanced customization option.
  4. Click on Add template.
  5. Select Click here under Preview.

FAQ

Can I create multiple templates?

Yes. But you can have only a single design active at any given time.

Google Universal Analytics Integration for Default Flows (without GTM)

Overview

analytics.js library is a JavaScript library that helps the vendor measure how users interact with their website. This guide explains how to add analytics.js to your website.

   This documentation refers to Google Universal Analytics, which is a deprecated version that will be sunset starting July 1st 2023 for free Universal Analytics properties and starting July 1st 2024 for 360 Universal Analytics properties. We strongly recommend you to migrate to Google Analytics 4 as soon as possible.

If you don’t have experience with code, you might want to seek assistance from a developer for the following steps.

Add the Google Universal Analytics code to the 2Checkout template

Integrate the code below (also called JavaScript tracking snippet) into your website's templates to enable analytics.js. The code snippet contains the data layer and must be added to the template file in the JavaScript code section. Depending on your having a custom domain or not, the appropriate code must be added.

Add the JavaScript tracking snippet code near the top of the <head> tag and before any other script or CSS tags. Also, the ‘UA-123156882-1’ highlighted string below needs to be replaced with your Google Universal Analytics property ID (or tracking ID).

If you don’t know the Google Universal Analytics property ID, you can find it here.

The JavaScript tracking snippet code can be pasted after the existing code, as shown in the image of the JavaScript code section of the Control Panel template files below.  

javascript code.png

Implementation with a custom domain

If you have a custom domain, the below JavaScript tracking code will be added in the JavaScript code section of your Merchant Control Panel template files:

<script> 
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 
ga('create', 'UA-123156882-1', 'auto'); 
ga('require', 'ec'); 
  if (omniture_vars.BILLING_CURRENCY) {ga('set', 'currencyCode', omniture_vars.BILLING_CURRENCY)};
if (omniture_vars.PAGE_NAME == "product"){   
 for (var i=0;i<omniture_vars.CART_PRODUCTS.length;i++)   
 {        
    ga('ec:addProduct', {                    
     'id': omniture_vars.CART_PRODUCTS[i].ProductCode,                     
     'name': omniture_vars.CART_PRODUCTS[i].ProductName,                    
     'category': omniture_vars.CART_PRODUCTS[i].ProductCategory,                    
     'brand': omniture_vars.CART_PRODUCTS[i].ProductGroup       
    });         
   }      
   ga('ec:setAction', 'detail'); 
}
 else if (omniture_vars.PAGE_NAME == "cart")
 {   
  for (var i=0;i<omniture_vars.PRODUCT_ADDED_DETAILS.length;i++)   
  {        
    ga('ec:addProduct', {                   
     'id': omniture_vars.PRODUCT_ADDED_DETAILS[i].ProductCode,                    
     'name': omniture_vars.PRODUCT_ADDED_DETAILS[i].ProductName,                    
     'category': omniture_vars.PRODUCT_ADDED_DETAILS[i].ProductCategory,         
     'brand': omniture_vars.PRODUCT_ADDED_DETAILS[i].ProductGroup       
    });         
   }      
     ga('ec:setAction', 'add'); 
}
 else if (omniture_vars.PAGE_NAME == "checkout" || omniture_vars.PAGE_NAME == "checkcart")
 {   
  for (var i=0;i<omniture_vars.CART_PRODUCTS.length;i++)
{        
    ga('ec:addProduct', {         
     'id': omniture_vars.CART_PRODUCTS[i].ProductCode,
     'name': omniture_vars.CART_PRODUCTS[i].ProductName,         
     'category': omniture_vars.CART_PRODUCTS[i].ProductCategory,          
     'brand': omniture_vars.CART_PRODUCTS[i].ProductGroup,         
     'quantity': omniture_vars.CART_PRODUCTS[i].ProductQuantity       
    });         
   }      
    ga('ec:setAction', 'checkout',{'step': 1}); 
}
 else if (omniture_vars.PAGE_NAME == "verify")
 {   
  for (var i=0;i<omniture_vars.CART_PRODUCTS.length;i++)   
  {        
    ga('ec:addProduct', { 
        'id': omniture_vars.CART_PRODUCTS[i].ProductCode, 
        'name': omniture_vars.CART_PRODUCTS[i].ProductName,        
        'category':omniture_vars.CART_PRODUCTS[i].ProductCategory,           
        'brand': omniture_vars.CART_PRODUCTS[i].ProductGroup,          
        'quantity': omniture_vars.CART_PRODUCTS[i].ProductQuantity       
    });         
   }      
    ga('ec:setAction', 'checkout',{'step': 2}); 
}
else if (omniture_vars.PAGE_NAME == "finish" && omniture_vars.PURCHASE_COMPLETE === true)
{   
  if (typeof myOrder != "undefined" && typeof myOrder.productsPrices != "undefined")
  {
    for (var k=0;k<myOrder.productsIds.length;k++)
    {
      ga('ec:addProduct', {
        'name': myOrder.productsNames[k],         // Name or ID is required.
        'id': myOrder.productsIds[k],
        'price': myOrder.productsPrices[k],
        'category': "",
        'quantity': myOrder.productsQuantities[k]
      });
    }
  }  
ga('ec:setAction', 'purchase', {     
   'id': omniture_vars.ORDER_REFNO,     
      'revenue': myOrder.totalPrice,     
            'tax': myOrder.tax    
   });
}
ga('send', 'pageview');</script>

Implementation without a custom domain 

If you are using the secure.2checkout.com domain, the additional JavaScript code below must be added to the second paragraph of the Google Universal Analytics code shown above, after the snippet ga('create', 'UA-123156882-1', 'auto');  and before the snippet ga('require', 'ec');.

Thus, the second paragraph will have the following form: the first yellow highlighted field needs to be replaced with your Google Universal Analytics property ID (or tracking ID), and the second highlighted field needs to be updated with your own website domain.

ga('create', 'UA-123156882-1', 'auto', {'allowLinker': true}); 
ga('require', 'linker'); 
ga('linker:autoLink', ['mywebsite.com'] );
ga('require', 'ec');  

This additional code above is required for cross-domain tracking so that the visitor on your own website is recognized as the same visitor when entering the 2Checkout template.  

Step 2: Set the Google Universal Analytics JavaScript code on your own website

Implementation with a custom domain

You should use the default Google Universal Analytics tracking script for analytics.js provided by Google, which has the following form (the string highlighted in yellow must be updated with the property ID of the vendor):

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>

Implementation without a custom domain 

If you are using the secure.2checkout.com domain, the following settings must be applied: the Google Universal Analytics JavaScript tracking code on your own website must be updated and have the following form (highlighted in yellow is the Google Analytics property ID that needs to be replaced with your own GA property ID code).

<script>  
(function(i,s,o,g,r,a,m){i['GoogleAn alyticsObject']=r;i[r]=i[r]||function(){  
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),  
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)  
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-123156882-1', 'auto', {'allowLinker': true});  
ga('require', 'linker');  
ga('linker:autoLink', ['secure.2checkout.com'] );  
ga('send', 'pageview');
</script>

Below are the elements that are different from the default Google Universal Analytics analytics.js tracking code and that enable cross-domain tracking. This code snippet is integrated into the rest of the code provided in the Google documentation here

{'allowLinker': true});  
ga('require', 'linker');  
ga('linker:autoLink', ['secure.2checkout.com'] );

Sending MyOrder Data to Google Universal Analytics

By default, the myOrder object is displayed only for orders with payments authorized instantly (this includes usually credit cards and PayPal), after the payment is complete (transaction needs to be authorized successfully). To have the myOrder object available for all placed orders regardless of the payment status (to send revenue to Google Universal Analytics based on myOrder.TotalPrice, or more offline payment methods orders), follow the steps below.

  1. Log in to your Merchant Control Panel account.
  2. Go to Setup → Ordering Options.
  3. Scroll down to the After sale message area and check the checkbox for the Show message for all placed orders option.

web analytics in Merchant Control Panel_2.png

3. Click Save settings at the bottom of the page.

A JavaScript object called myOrder is available on the ‘Thank you’ page providing information about the purchased products including ID, quantity, name, price, etc.

To see information about orders in Google Universal Analytics, follow these steps:

  1. Log in to your Merchant Control Panel account.
  2. Navigate to Setup → Ordering Options and click on the Analytics tab.

web analytics in Merchant Control Panel_1.png

3. Scroll down to the Tracking script section and add a code snippet (for example add <div></div>).

4. Apply the code to all languages or to the languages for which you want your template to be tracked.

5. Click Save at the bottom of the page.

web analytics in Merchant Control Panel_3.png 

Enable Enhanced E-commerce tracking in Google Universal Analytics

In your Google Universal Analytics Control Panel, go to Admin → All Web Site Data → Ecommerce Settings and enable both the Enable Ecommerce and the Enable Enhanced Ecommerce Reporting buttons, as shown in the image below.

ecommerce setup.png

Increase your chances of winning a chargeback

Overview

Dealing with chargebacks can turn into a painful process for online businesses. Chargebacks can cost you more than just lost sales; those losses combined with associated fees can result in a major business drop.

To protect you from the downsides of the chargeback process, we have a dedicated chargeback team whose main objective is to ensure a high winning rate for your disputes, while making the entire experience better for you and your customers. The reasons why you should care about chargebacks are obvious:

  • Chargebacks are expensive, both in fees, and lost revenue
  • Chargebacks are time-consuming from a labor perspective

Chargebacks are disputed by 2Checkout on your behalf, as we attempt to win a chargeback reversal in order to save the value of the transaction. But there is no proven process for winning, and there is no way to guarantee success. 

    Separation of chargeback requests

    To ensure lower costs and resolution time for all the parties involved, Visa has started to differentiate between 2 dispute types: allocation and collaboration. This separation has been made to allow Visa's internal system to use their own internal data more effectively and incorporate automation whenever possible.

      Allocation Collaboration
    Management style Liability-Assessment Model Litigation-Based Model
    Action taken Visa will consult internal data and assess liability to either the cardholder or the merchant. The merchant has a chance to respond to the dispute with compelling evidence; the outcome will be determined by issuer and acquirer together (similar to current processes)
    Dispute categories Fraud, Authorization Customer Dispute, Processing Error

    Maximize your chargeback winning rate

    Obviously, the best protection is to do everything you can to prevent chargebacks from being filed. But no matter how vigilant you are, chargebacks are inevitable, so preparation and anticipation are the keys. Winning a chargeback dispute is difficult, but not impossible.

    Digital goods

    For the Collaboration chargeback type, you can help us improve your chargeback winning rate by providing the following documents (where applicable), in PDF format:

    • Evidence of cardholder or customer is in possession of the merchandise and making use of the service
    • Evidence of e-correspondence if available (email communication between you and the customer)
    • Description of merchandise or service purchased
    • Evidence that the goods or services described on the invoice were delivered or provided as described (authentic merchandise)
    • Evidence that the cardholder did not attempt to return the merchandise or cancel the service
    • Proof that the cardholder failed to meet the cancelation terms of the signed contract 
    • Evidence to demonstrate that the cardholder received the merchant's cancelation or return policy and did not cancel according to the disclosed policy
    • Description of the goods or services successfully downloaded, the date and time such goods or services were downloaded and two or more of the following:
      • Purchaser’s name and email address linked to the customer profile on record with the merchant
      • Evidence that the profile set up by the purchaser on the merchant’s website or application was accessed by the cardholder and successfully verified by the merchant before the transaction date
      • Proof that the merchant’s website or application was accessed by the cardholder for goods or services on or after the transaction date
    • Documentation confirming the cardholder or authorized user is registered to purchase goods with a password and must provide one or more of the following documentation
      • Other completed undisputed purchases prior to, or after, the alleged fraudulent transaction
      • Details of the purchase
      • Proof of delivery
      • Email addresses to support digital download delivery
      • Evidence that the cardholder or authorized user registered the disputed goods and services for purposes of warranty or future software updates
      • Evidence that the disputed goods or services were used

    Physical goods

    For the Collaboration chargeback type, you can help us improve your chargeback winning rate by providing the following documents (where applicable), in PDF format:

    • Emails or photographs to prove a link between the shopper and the cardholder, or to prove that the cardholder disputing the transaction is in possession of the merchandise and/or is using the merchandise or services
    • For an e-commerce transaction in which the merchandise is delivered or collected from the merchant's location, documentation (proof of delivery, tracking numbers) that the item was delivered or any of the following:
      • Signature of the cardholder on the pick-up form
      • Copy of identification presented by the cardholder
      • Details of identification presented by the cardholder
      • Copy of the invoice
    • Evidence, such as photographs or emails, to prove that the merchandise or service matched what was described
    • Documentation to prove that the cardholder did not attempt to return the merchandise
    • Evidence that returned merchandise has not been received
    • Evidence that the merchant tried to repair or replace merchandise/services
    • Documentation to prove that the merchandise is not counterfeit
    • Evidence that the terms and conditions were clearly communicated to the cardholder before the transaction was processed
    • Cancelation and return policy
    • Any communication with the customer, including emails or social media interactions
      • Proof that the merchandise delivered was not damaged or defective

    Customer

    Overview

    Use the object below to create, update and retrieve customers in 2Checkout.

    Input parameters

    Parameters Type/Description

    ExternalCustomerReference

    Optional (string)

     

    Unique customer alphanumeric (string) identifiers you control. Aggregate subscriptions under the same Customer account by adding the CUSTOMERID (case sensitive) parameter to Buy-links.

    FirstName

    Required (string)

     

    Customer's first name. 

    LastName

    Required (string)

     

    Customer's last name.

    Company

    Optional (string)

     

    Company name.

    FiscalCode

    Optional (string)

     

    Can be null for end users. For companies, it needs to be the VAT ID, which 2Checkout validates.

    2Checkout throws an error if the VAT ID is invalid/incorrect. When present, you also need to provide the company name.

     

    Can be null for end users.

    Address1

    Required (string)

     

    Customer's address.

    Address2

    Optional (string)

     

    Customer's address.

    City

    Required (string)

     

    Customer's city.

    State

    Optional (string)

     

    Customer's state. For example, "Alabama","Alaska","Arizona".

    Zip

    Required (string)

     

    Zip code.

    CountryCode

    Required (string)

     

    Customer's country code (ISO 3166 two-letter code).

    Phone

    Optional (string)

     

    Customer's phone number.

    Fax

    Optional (string)

     

    Customer's fax number.

    Email

    Required (string)

     

    Customer's email.

    Enabled

    Optional (boolean)

     

    true or false, depending on whether the customer account is active or inactive. An active customer account features at least one Active or Past due subscription. Possible customer statuses:

     

    • Active - Customer account status is Active even if Trial and Canceled/Expired subscriptions exist for the customer, as long as there's at least one Active subscription. Customers with a single subscription featuring the Past due status (expired but in the grace period) are considered Active.
    • Inactive - All subscriptions associated with this Customer account are canceled, expired or both.
    • Trial - Customer account status is Trial if all Active subscriptions for this customer are trials, regardless of any Canceled/Expired subscriptions.

    Trial

    Optional (boolean)

     

    true or false, depending on whether the customer account features only trials or also paid subscriptions.

    Language

    Optional (string)

     

    ISO 639-1 two-letter code. Example: “en.”

     

    Unassign a price option

    Overview

    Use the unassignPricingConfigurationOptionGroup method to remove a PricingOptionGroup from 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.

    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_PRICING_CONFIG_CODE';
    $priceOptionsGroupAssigned = new stdClass();
    $priceOptionsGroupAssigned->Code = 'STORAGE';
    $priceOptionsGroupAssigned->Required = false;
    
    try {
        $UnassignedOption = $client-> unassignPricingConfigurationOptionGroup ($sessionID, $PricingConfigurationCode, $PriceOptionsGroupAssigned);
    }
    
    catch (SoapFault $e) {
        echo "Options: " . $e->getMessage();
        exit;
    }
    
    var_dump("Options", $UnassignedOption);
    
    
    ?>
    

    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