Skip to main content

Set external order reference

Overview

Use this method to set an external reference for a partner order. This is helpful if you use unique identifiers in your own order management system and you want to mirror the IDs in the Avangate system.

Requirements

Use this method before placeOrder.

Parameters

Parameter Type/Description
sessionID Required (String)
  Session identifier, which is the output of the Login method. An exception is thrown if the values are incorrect.
externalRef Required (String)
  The unique identifier of an order placed in the Avangate system mirroring the reference you're using to manage order data in your system.

Response

Parameter Type/Description
Response Boolean
  True or false

Request

<?php

require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner
require('PATH_TO_addProduct'); // addProduct example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/08Place_an_order/00Add_product_to_cart

$externalRef = 'NEW_ORDER_REFERENCE';

try {
    $ExternalIdentifier= $client->setExternalRef ($sessionID, $externalRef);
} catch (SoapFault $e) {
    echo " ExternalIdentifierSet: " . $e->getMessage();
    exit;
}
var_dump ("ExternalIdentifierSet", $ExternalIdentifier);

Errors

Error Description

INVALID_SOURCE

The provided external reference is empty.

 

Subscription

Overview

Use this section to handle the management of your subscriptions.

You can enable or disable your existing subscription, or choose to assign them to different customer entities.

Subscriptions can be retrieved starting with 5 minutes after their orders are generated in the 2Checkout system.

 

Place orders with dynamic product information

Overview

Use this object to create new orders and collect payments from shoppers using products with dynamic information. 

Purchase types available are PRODUCT, TAX, SHIPPING, and COUPON. The surcharge defined in the pricing option is used for calculating the order renewal price, when applicable.

You can find a list of common errors that may arise when using the placeOrder call via APIv6 here.

   This functionality is available only for merchants on the 2Sell and 2Subscribe accounts (PSP business model), for orders that are placed both through ConvertPlus/InLine ordering engines and API calls.

Supported payment methods

  1. Credit/Debit cards: Visa, Visa Electron, MasterCard, Maestro, Amex, Discover, Dankort, Carte Bleue, JCB. 2Checkout supports local Brazilian cards.
  2. PayPal
  3. Free orders (no payment information required).
  4. 2Pay.js

How to test?

Place test orders with dynamic product information by following the instructions from this article.

Requirements

The product code must be sent as null. The order currency must match the payment currency otherwise, an error is thrown. The isDynamic parameter of the Items object must be true.

For credit card orders placed using API 5.0 or newer versions, you need to pass through additional parameters that support the 3D Secure flow. 3D Secure works by redirecting customers to pages provided by their banks, where they need to enter additional security tokens or passwords to trigger the completion of the charge. By using 3D Secure, you get additional protection from liability for fraudulent card payments, with customers having to go through an extra layer of authentication.

Send the following parameters as part of the PaymentMethod object:

Parameters Description
Vendor3DSReturnURL Required (string)
  URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.
Vendor3DSCancelURL Required (string)
  URL address to which customers are redirected if the 3DS details were not validated or the order could not be authorized.
WSOrder Optional (String)
  The WSOrder parameter is used to control the website URL displayed in the email messages shoppers receive after they place an order. By default, 2Checkout reports the URL set as Homepage in the Account information area. Adding WSOrder to the buy-links for your products will cause the optional website address set by using the parameter to override and replace the Homepage URL in the email notifications sent to customers. The behavior is similar to the WS_ORDER parameter supported on checkout/cart pages and described here.

Limitations

Placing an order with both catalog and dynamic product information is not possible. Recurring options can be set only for purchase type PRODUCT and TAX.

Parameters

Parameters Type/Description

Currency

Optional (String)

 

The currency ISO code for the payment - ISO 4217. Example: “usd.”

Country

Optional (String)

 

Shopper country. ISO 3166 two-letter code. Example: “us.”

Language

Optional (String)

 

ISO 639-1 two-letter code. Language used for the purchase process. Example: “en.”

ExternalReference

Optional (String)

 

Set external reference identifiers for orders. Enables you to replicate the functionality of the REF parameter included into Buy Links. Maximum 100 characters. If there is a need for longer references, you can apply an md5 hash for any string value, resulting in a 32 characters string. You can verify the hash after the order notification, on the client-side.

Source

Optional (String)

 

The link source for the sales. Enables you to replicate the functionality of the SRC (separate link identifier) parameter when included in the buy-links. Use the SRC parameter to track sale sources.

Maximum length 255 characters.

CustomerReference

Optional (Integer)

 

External customer ID you can attach to the customer.

MachineId

Optional (String)

 

Unique, system-generated code for each unique customer, identifying returning customers.

Items

Required (Array of Objects)

 

 

 

Details below. 

 

 

Code

Optional (String)

 

 

 

Should be sent as NULL. Any other value is ignored.

 

 

Quantity

Required (Integer)

 

 

 

Number of units purchased.

  ProductExternalReference Optional (String)
  isDynamic Required (Boolean)
    Send TRUE for orders with dynamic product information.
  Tangible Required (Boolean)
   

Possible values:

  • FALSE for products delivered electronically.
  • TRUE for tangible products, that require physical delivery.
  PurchaseType Required (String)
   

Purchase types available are:

  • PRODUCT - Item purchased by the customer. Is mandatory to send the name and price of the product item. Can also have pricing options and recurring options attached.
  • TAX - additional handling fee added to the purchase.
  • SHIPPING - shipping fee applied to purchase.
  • COUPON - amount deducted from total order price. Send positive values.
  PriceOptions Optional (Array of Objects)
    Array of price option groups.
    Name   Optional (String) 
        Name of the pricing option group.
    Options   Optional (Array of Objects)
        Array of pricing options.
    Name Optional (String)
      Pricing option name. 
    Value Optional (String)
      Pricing option code. 
    Surcharge Optional (Double)
      Surcharge of the pricing option. For renewal orders, the renewal price includes the pricing option surcharge from the initial order. 
  RecurringOptions Optional (Object)
      Contains recurring options.
    CycleLength Optional (Integer)
      The length of the recurring billing cycle.
    CycleUnit Optional (String)
      Unit of measuring billing cycles (years, months).
    CycleAmount Optional (Integer)
      The amount to be billed on each renewal.
    ContractLength Optional (Integer)
      The contact length for which the recurring option will apply.
    ContractUnit Optional
      Unit of measuring contact length (years, months).
  Name   Required (String)

 

 

Price

Required (Object)

    Details below.
    Amount Required (Double)
      Amount of the product.
    Type Optional (String)
      Send "CUSTOM" for dynamic pricing.

 

 

Trial

Optional (Object) – Can be NULL

 

 

 

 

Details below. 

 

 

 

Period

Optional (Integer)

 

 

 

 

The length of the trial subscription lifetime in days.

 

 

 

Price

Optional (Double)

 

 

 

 

Total trial price in the payment currency before 2Checkout deducts any taxes, discounts, etc.

 

 

AdditionalFields

Optional (Array of Objects) – Can be NULL

 

 

 

AdditionalFieldSet

Optional (Object) – Can be NULL

        Details below
        Code Optional (String)
          Identifier code for the additional field.
        Text Optional (String)
          Text displayed in the additional field.
        Value Optional (String)
          Additional field value.
    SubscriptionStartDate Optional (String)
     

Specify the date time stamp when the subscription becomes active. Format 2016-07-02 22:22:22 (YYYY-MM-DD HH:mm:ss). Available for JSON-RPC and REST.

Send empty or NULL to activate subscriptions on the same date when customers purchase them.

You can exclude HH:mm:ss when sending the date and include only YYYY-MM-DD. In this case, 2Checkout uses 00:00:01. Default time zone GMT+02:00.

BillingDetails

Required (Object)

 

 

Details below. 

 

FirstName

Required (String)

 

 

Shopper name.

 

LastName

Required (String)

 

 

Shopper surname.

 

CountryCode

Required (String)

 

 

Shopper country. ISO 3166 two-letter code.

 

State

String/Optional – Required for US, Canada, Brazil, Turkey, India and Romania

 

 

The state in the shopper's country. Mandatory when you set the Billing Country to US, Canada, Brazil, Turkey, India and Romania. Use case insensitive utf8 strings for the full name, or just the two-letter code.

 

City

Required (String)

 

 

Shopper city.

 

Address1

Required (String)

 

 

Shopper address.

 

Address2

Optional (String)

 

 

Shopper address.

 

Zip

Required (String)

 

 

ZIP/ Postal code.

 

Email

Required (String)

 

 

Shopper email address.

 

Phone

Optional (String)

 

 

Shopper phone number. Mandatory when you set Brazil as the Billing Country. Can be NULL.

 

Company

Optional (String)

 

 

Company name. Can be null for end users. When present, you also need to provide the FiscalCode.

 

FiscalCode

Optional (String) – Required for Brazil

 

 

• For companies, it needs to be the VAT ID. 2Checkout will validate the value provided and throw an error if the VAT ID is invalid/incorrect when calling setPaymentDetails. When present, you also need to provide the Company name.

• Mandatory when you set Brazil as the Billing Country. For Brazilian customers, it represents the Fiscal Code (CPF/CNPJ).

Mandatory when you set India as the Billing Country and purchase is made by a Company.

• Can be NULL for end users.

  TaxExemptionId  Optional (string)
    Tax Exempt Certification id used to deduct taxes for US orders

Example: 1b80eecc349v

DeliveryDetails

Required (Object)

 

 

               

Details below. 

 

 

FirstName

Required (String)

 

 

 

             

Shopper name from the delivery details.

 

 

LastName

Required (String)

 

 

 

             

Shopper surname from the delivery details.

 

 

CountryCode

Optional (String)

 

 

 

             

Shopper country. ISO 3166 two-letter code from the delivery details.

 

 

State

String/Optional – Required for US, Canada, Brazil, Turkey, India and Romania

 

 

 

             

The state in the shopper's country. Mandatory when you set the Billing Country to US, Canada, Brazil, Turkey, India and Romania. Use case insensitive utf8 strings for the full name, or just the two-letter code.

 

 

City

Optional (String)

 

 

 

             

Shopper city from the delivery details.

 

 

Address1

Optional (String)

 

 

 

             

Shopper address from the delivery details.

 

 

Address2

Optional (string)

 

 

 

             

Shopper address from the delivery details.

 

 

Zip

             

Optional (String)

 

 

 

             

ZIP/ Postal code from the delivery details.

 

 

Email

Optional (String)

 

 

 

             

Shopper email address from the delivery details.

 

 

Phone

Optional (String)

 

 

 

             

Shopper phone number from the delivery details. Mandatory when you set Brazil as the Billing Country. Can be NULL.

 

 

Company

Optional (String)

 

 

 

             

Company name from the delivery details. Can be null for end users. When present, you also need to provide the FiscalCode.

DeliveryInformation

Object / Optional

For products that require physical delivery, use this object to send the shipping method.

    ShippingMethod          

Object

Details below

        Code         String
  System-generated identified for your shipping method configuration.

PaymentDetails

Required (Object)

 

Adapt this object to the desired payment method.

 

Type

Required (String)

 

 

The payment method:

  • CC (credit/debit card - including local Brazilian cards).
  • ENCRYPTED_PAYMENT_DATA (client-side encryption)
  • PAYPAL
  • PAYPAL_EXPRESS
  • TEST (for test orders).
  • PREVIOUS_ORDER(place new orders using the reference of a previous order).
  • EXISTING_PAYMENT_DATA  (use a card one of your customers already used to purchase from your account).
  • WIRE – the placeOrder response includes Wire payment details.
  • CHECK – the placeOrder response includes Check payment details.
  • WE_CHAT_PAY (for WeChat payments).
  • IDEAL (for iDEAL payments).
  • PURCHASEORDER - use for orders with POs.
  • FREE – for 0 value orders for which you’re not requiring customers to provide payment details.
  • EES_TOKEN_PAYMENT (2Pay.js)
  • GOOGLE PAY

 

Currency

Required (String)

 

 

The currency ISO code for the payment - ISO 4217. Example: “usd.”

 

PaymentMethod

Optional (Object)

                                                          RecurringEnabled Optional (Boolean)
   

true – shopper checks the auto-renewal checkbox and 2Checkout charges subscription renewals using a recurring billing process.

false – shopper doesn’t check the auto-renewal checkbox.

 

 

Object structure and parameters differ according to the payment method selected and API method (placing orders (POST) vs. retrieving order data (GET)).

 

NULL for 0 value orders for which you’re not requiring customers to enter payment details.

 

 

 

CardPayment

Optional (Object)

 

 

 

 

 

Details below. 

 

 

 

 

CardNumber

Required (String)

 

 

 

 

 

The credit/debit card number.

 

 

 

 

CardType

Required (String)

 

 

 

 

 

visa, visaelectron, mastercard, maestro, amex, discover, dankort, cartebleue, jcb, hipercard, elo

 

 

 

 

ExpirationYear

Required (String)

 

 

 

 

 

The year in which the card expires.

 

 

 

 

ExpirationMonth

Required (String)

 

 

 

 

 

The month in which the card expires.

 

 

 

 

HolderName

Required (String)

 

 

 

 

 

Card holder name.

        Vendor3DSReturnURL Required (String)
          URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.
        Vendor3DSCancelURL Required (String)
          URL address to which customers are redirected if the 3DS details were not validated or the order could not be authorized.

 

 

 

 

CCID

Optional (String)

 

 

 

 

 

Credit Card Identification - an extra ID printed on the card, usually a 3-4 digit number, the CVC2/CVV2.

        HolderNameTime Optional (Float)
         

The interval of time in seconds in which shoppers enter their name in the HolderName field. An abnormally short interval is usually a red flag for fraud attempts.

Can be NULL, but not a negative number.

        CardNumberTime Optional (Float)
         

The interval of time in seconds in which shopper enter their card number in the CardNumber field. An abnormally short interval is usually a red flag for fraud attempts.

Can be NULL, but not a negative number.

 

 

 

 

                                                     InstallmentsNumber 

Optional (Integer)

 

 

 

 

 

Number of installments. Available only when customers un Brazil pay with Visa or MasterCard using Brazilian Real as the order currency. Use 1 or exclude the parameter for full payments. 

 

CustomerIP

Optional (String)

 

 

Shopper IP.

Promotions Optional (Array of Strings)
  Array of promotion codes.

LocalTime

Optional (String)

 

Local shopper time in the following format: Y-m-d H:i:s.

This parameter can impact the fraud score of an order when it's missing, NULL or incorrectly formatted.

 

Retrieve partner invoice

Overview

Access information about partner invoices in the Avangate system based on their unique references.

Requirements

Parameters

Parameters Type/Description
sessionID Required (String)
  Session identifier, output of the Login method. An exception is thrown if the values are incorrect.
proformaNumber Required (String)
  The unique identifier of a partner invoice from the Avangate system.

Response

Request

<?php

require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner

$proformaNumber = 'YOUR_PROFORMA_NUMBER';

try {
    $Proforma= $client->getProforma ($sessionID, $proformaNumber,True);
} catch (SoapFault $e) {
    echo "ProformaOutput: " . $e->getMessage();
    exit;
}
var_dump ("ProformaOutput", $Proforma);

Errors

Error Description

INVALID_PARTNER

No partner is set.

INVALID_PROFORMA_NUMBER

Invalid partner invoice number.

 

Upgrade subscription

Overview

Use the setSubscriptionUpgrade method to upgrade a subscription.

Requirements

You can only upgrade subscriptions with automatic renewal enabled.

   The upgrade will not work if the subscription has a refund request that was not yet processed.

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.

productCode

Required (string)

 

Unique identifier of the target product for the subscription upgrade process. You control the product code and can set it up in the Control Panel.

options

Optional (string)

 

Pricing options of the target product for the subscription upgrade process.

 

String - ';' separated list of 'OptionValue' returned by getProductUpgradeOptions function.

If the pricing options groups is "scale" (interval), the Options parameter should be sent like this: [option group unique code] + "=" + value

e.g. Users=7

customPrice

Optional (string)

 

The price you want to charge customers for the upgrade. The currency used by default is the same as in the previous payment customers made.

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';
$productCode = 'YOUR_PRODUCT_CODE';
$options = 'YOUR_PRICE_CODES'; //case sensitive; include only price options codes (exclude spaces)
$customPrice = 1;

$jsonRpcRequest = array (
'method' => 'setSubscriptionUpgrade',
'params' => array($sessionID, $subscriptionReference, $productCode, $options, $customPrice),
'id' => $i++,
'jsonrpc' => '2.0');

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

Set the shipping details in the InLine Checkout

Overview

Pre-set the shipping details for the InLine checkout.

Use case

  1. Add an HTML link or button in your page like the one below.
  2. Create a JavaScript click handler to execute the Inline Client desired methods.
  3. Use theTwoCoInlineCart.products.add({code, quantity, options})method to prepare your catalog product.
  4. Call any of the following methods to pre-set the shipping details:
TwoCoInlineCart.shipping.setName('Shopper name');
  TwoCoInlineCart.shipping.setEmail('shopper.email@example.com');
  TwoCoInlineCart.shipping.setPhone('+1 202 555 0115');
  TwoCoInlineCart.shipping.setCountry('US');
  TwoCoInlineCart.shipping.setCity('Denver');
  TwoCoInlineCart.shipping.setState('Colorado');
  TwoCoInlineCart.shipping.setZip('80249');
  TwoCoInlineCart.shipping.setAddress('Pena Blvd');
  TwoCoInlineCart.shipping.setAddress2('');

5. If you want to reset the shipping details, call theTwoCoInlineCart.shipping.reset()method.

6. Use theTwoCoInlineCart.cart.checkout()method to show the cart on your page.

Sample request

HTML

<a href="#" class="btn btn-success" id="buy-button">Buy now!</a>

JavaScript

window.document.getElementById('buy-button').addEventListener('click', function() {
  TwoCoInlineCart.products.add({
    code: "74B8E17CC0"
  });
  
  // Style 1 (all data at once)
  TwoCoInlineCart.shipping.setData({
        name    : 'Shopper name',
        country : 'US',
        email   : 'shopper.email@example.com',
        city    : 'Denver',
        state   : 'Colorado',
        zip     : '80249',
        phone   : '+1 202 555 0115',
        address : '',
        address2: 'Pena Blvd'
  });

  // Reset
  TwoCoInlineCart.shipping.reset();
  
  // Style 2 (simple)
  TwoCoInlineCart.shipping.setName('Shopper name');
  TwoCoInlineCart.shipping.setEmail('shopper.email@example.com');
  TwoCoInlineCart.shipping.setPhone('+1 202 555 0115');
  TwoCoInlineCart.shipping.setCountry('US');
  TwoCoInlineCart.shipping.setCity('Denver');
  TwoCoInlineCart.shipping.setState('Colorado');
  TwoCoInlineCart.shipping.setZip('80249');
  TwoCoInlineCart.shipping.setAddress('Pena Blvd');
  TwoCoInlineCart.shipping.setAddress2('');
  
  // Reset
  TwoCoInlineCart.shipping.reset();
  
   // Style 3 (chained)
  TwoCoInlineCart.shipping
    .setName('Shopper name')
    .setEmail('shopper.email@example.com')
    .setPhone('+1 202 555 0115')
    .setCountry('US')
    .setCity('Denver')
    .setState('Colorado')
    .setZip('80249')
    .setAddress('Peña Blvd')
    .setAddress2('');
  
  TwoCoInlineCart.cart.checkout();
});

Demo

After setting the shipping details for the InLine checkout using the above methods, your cart should look like this:

Subscription

Overview

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

Retrieve a subscription             Search subscriptions            Retrieve customer's subscriptions          Retrieve specific subscriptions

Subscription object

Parameters Type/Description

SubscriptionReference

String

 

Unique, system-generated subscription identifier.

StartDate

String

 

Subscription start date(YYYY-MM-DD) - StartDate is mandatory when importing subscription data. If you changed the time zone for the Avangate 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 Avangate API by editing system settings under Account settings, then the ExpirationDate you provide must be in accordance with your custom configuration.

RecurringEnabled

Boolean

 

Possible values:

TRUE – recurring billing/automatic subscription renewals enabled

FALSE– recurring billing/automatic subscription renewals disabled

SubscriptionEnabled

Boolean

Possible values:

TRUE –subscription enabled

FALSE–subscription disabled

Product

Required (object)

 

The product for which Avangate generated the subscription. Details below.

 

ProductCode

String

 

 

Unique product identifier that you control.

 

ProductId

Int

 

 

Unique, system-generated product identifier.

 

ProductName

String

 

 

Product name.

 

ProductQuantity

Int

 

 

Ordered number of units.

 

ProductVersion

String

 

 

Product version.

 

PriceOptionCodes

Array

 

 

The product options codes the customer selected when acquiring the subscription. Pricing options codes are case sensitive.

EndUser

Object

 

The end user of the subscription. Details below.

 

Person

Object

 

 

FirstName

String

 

 

 

End user's first name

 

 

LastName

String

 

 

 

End user's last name

 

 

CountryCode

String

 

 

 

End user country code [ISO3166-1 Alpha 2].

 

 

State

String

 

 

 

End user state.

 

 

City

String

 

 

 

End user city.

 

 

Address1

String

 

 

 

End user first address line.

 

 

Address2

String

 

 

 

End user second address line.

 

 

Zip

String

 

 

 

End user zip code.

 

 

Email

String

 

 

 

End user email address.

 

 

Phone

String

 

 

 

End user phone number.

 

 

Company

String

 

 

 

Company name.

 

 

Fax  

String

 

 

End user fax.

 

 

Language  

String

 

 

Language [ISO639-2] the Avangate system uses for communications.

SKU

String

 

Stock keeping unit you defined.

DeliveryInfo

Object

 

The object contains information about the delivery/fulfillment made to the customer.

 

Description

String

 

 

Delivery description.

 

Codes

Array of objects

 

 

Code

String

 

 

 

Activation key/license code of the first order from this subscription. Use getSubscriptionHistory method if you want to retrieve the activation keys/license codes for all orders belonging to a subscription.

 

 

Description

String

 

 

 

Code description for dynamic lists from your key generator. 

 

 

ExtraInfo

Object

 

 

 

Info set by your key generator for dynamic lists only.

 

 

 

CodeExtraInfo

Object

 

 

 

Type

String

 

 

 

Label

String

 

 

 

Value

String

 

 

File

Array of objects

 

 

 

Content

String

 

 

 

 

Content of the file (base64 encoded).

 

 

 

ContentLength

Int

 

 

 

 

File size.

 

 

 

Filename

String

 

 

 

 

The name of the delivered file.

 

 

 

FileType

String

 

 

 

 

The type of the delivered file.

ReceiveNotifications

Boolean

 

1 – Subscribe: Avangate sends subscription notifications to the end user.

0 – Unsubscribe – Avangate does not send subscription notifications to the end user.

Lifetime

Boolean

 

Possible values:

  • True – the subscription is evergreen

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

PartnerCode

String

 

  • Empty: for ecommerce orders
  • Partner Code

AvangateCustomerReference

Int

 

Unique, system-generated customer identifier.

ExternalCustomerReference

String

 

Customer identifier that you control.

TestSubscription

Boolean

 

True for test subscriptions, false otherwise.

IsTrial

Boolean

 

True for trial subscriptions, false otherwise.

MerchantCode String
  Unique, system-generated ID in the Avangate system.

Subscription upgrade

Overview

Retrieve information about the upgrade options for a specific subscription.

Trigger upgrade for your existing subscriptions, or set external references to a subscription by using the API methods displayed below.

 

Place orders with cross-sell campaigns

Overview

Cross-selling allows you to recommend additional products to customers and increase the average order value. The 2Checkout Public API supports classic cross-sell campaigns which means you can recommend more products from your own product catalog to your shoppers.

CrossSell Object for the placeOrder API method

Use the CrossSell object below to recommend additional products to customers via the SOAP API 6.0.

Parameter name Type Required/Optional Description
ParentCode String Required Product code of the product to be recommended to the shopper.
CampaignCode String Required The upsell campaign code.

Request Example

{ 
  "Currency": "USD", 
  "Language": "EN", 
  "Country": "US", 
  "CustomerIP": "10.10.10.10", 
  "Source": "sourceAPI.net", 
  "CustomerReference": 421820775, 
  "Items": [ 

    { 
      "Code": "15", 
      "Quantity": 1 
    }, 
    { 
      "Code": "34924C876E", 
      "Quantity": 1, 
      "CrossSell":{ 
        "ParentCode" : "15", 
        "CampaignCode" : "2Xrl83KSkemCv3G3dL%2B9eA%3D%3D" 
      } 
    } 
  ], 

   "BillingDetails":{ 

      "FirstName":"Customer First Name", 
      "LastName":"Customer Last Name", 
      "CountryCode":"US", 
      "State":"California", 
      "City":"San Francisco", 
      "Address1":"Example Street", 
      "Zip":"90210", 
      "Email":"example@email.com" 

   }, 

  "PaymentDetails": { 
    "Type": "CC", 
    "Currency": "USD", 
    "CustomerIP": "10.10.10.10", 
    "PaymentMethod": { 

      "Vendor3DSReturnURL": "https:\/\/example.com", 
      "Vendor3DSCancelURL": "https:\/\/example.com", 
      "CardNumber": "4111111111111111", 
      "CardType": "VISA", 
      "ExpirationYear": "2020", 
      "ExpirationMonth": "12", 
      "CCID": "123", 
    } 
  } 
} 

Response

Using the same structure, the getContents method will take into account the discount associated with the cross-sell campaign and display the appropriate prices and taxes.

{ 
    "Country": "DE", 
    "Currency": "EUR", 
    "Items": [ 
        { 
            "Code": "NIQRPI0GTU", 
            "Quantity": 1 
        }, 

        { 
            "Code": "0XICS3OVDK", 
            "Quantity": 1, 

"CrossSell":{ 
        "ParentCode" : " NIQRPI0GTU ", 
        "CampaignCode" : "2Xrl83KSkemCv3G3dL%2B9eA%3D%3D" 
      } 

        } 
    ], 

    "BillingDetails": { 
        "FirstName": "Customer First Name", 
        "LastName": "Customer Last Name", 
        "CountryCode": "DE", 
        "City": "Bucharest", 
        "Address1": "Example Street", 
        "Zip": "73331", 
        "Email": "example@email.com" 
    } 
} 

 

Implement Google Universal Analytics in ConvertPlus and InLine Checkout (with GTM)

Overview

You can implement Google Universal Analytics and Google Tag Manager tracking tools to help you track and monitor your ConvertPlus and InLine checkout orders to improve the shopping experience and increase the conversion rate.

   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 as soon as possible to Google Analytics 4 using the data layer that we have on GA4 format.

Availability

Google Universal Analytics and Google Tag Manager can be set for all 2Checkout accounts.

Google Universal Analytics Settings

Implement Google Universal Analytics

To implement Google Universal Analytics through Google Tag Manager (GTM) for your ConvertPlus and InLine Checkout, follow these steps:

1. In your browser window, navigate to Tag manager → All accounts.

2. Click on the Create Account button.

Google analytics via GTM_1.png

3. Fill in all the required fields:

  • Account Name
  • Country
  • Container name
  • Target platform → Web

4. Click on the Create button.

5. Copy the Google Tag Manager Container ID. It will be used in the 2Checkout Merchant Control Panel for the Google Tag Manager set-up.

Google analytics via GTM_2.png

Create a Google Universal Analytics Settings variable in Google Tag Manager

If you already have a Google Universal Analytics Settings variable with your Google Universal Analytics Tracking ID, then skip to step 5.

If you do not have a Google Universal Analytics Settings variable created for your website tracking, you will need to create one to add the Google Universal Analytics property to which you want to send data by following these steps:

1. In your Google Tag Manager account, navigate to Variables → User-Defined Variables → New.

Google analytics via GTM_3.png

2. From the list provided by Google, select the Google Universal Analytics Settings option as Variable Type. Name your variable “Google Analytics Settings”, so you can easily identify it.

3. Under Tracking ID add the Google Universal Analytics Tracking ID to which you wish to send data.

4. To get your Google Universal Analytics Tracking ID, navigate to Google Universal Analytics → Admin → Tracking Info → Tracking Code. You will find the code under Tracking ID. Copy and add it to your variable.

google analytics tracking id.png

5. For cross-domain tracking between your website and the 2Checkout shopping cart, you need to configure cross-domain settings in the Google Universal Analytics variable. This set-up is needed so that Google Universal Analytics counts a shopper coming from your website to the 2Checkout shopping cart, as the same visitor.

Go to More Settings → Cross Domain Tracking and type the following domains separated by a comma in the field named Auto Link Domains: secure.2checkout.com,tracking.avangate.net.

6. Append flags to the Google Universal Analytics cookie with “secure” and “samesite=none”. To do this, in the Google Universal Analytics Settings variable, click on Fields to set, add a new field and type cookieFlags as Field Name and samesite=none as Value secure, as in the example below.

google analytics with GTM_step6_new.png

7. Click Save.

Create the trigger for the Google Universal Analytics Convert Plus Tag

1. In Google Tag Manager, click on the Triggers section and then click to add a new trigger.

Google analytics via GTM_5.png

2. Create two triggers to track the Convert Plus and InLine shopping carts:

  • One for non-interactive events: checkout and purchase.
  • One for interactive events: removeFromCart (for the removeFromCart type of event, the user interacts with an element on the page by clicking the Remove from cart button. This is why this type of event is considered an interactive event by Google Universal Analytics) and addToCart.

Create the non-interactive event trigger

  1. Name your trigger Event Ecommerce Non-interactive.
  2. From the list provided, choose Custom event as Trigger Type.
  3. In the field Event name, type  .*  and check the box Use RegEx matching.
  4. For the "This trigger fires on" section, select Some custom events.
  5. As rule, fill in the boxes with Event matches RegEx (Ignore case) checkout|purchase.
  6. Click Save.

Google analytics via GTM_6.png 

Create the interactive event trigger

  1. Name your trigger Event Ecommerce Interactive.
  2. From the list provided, choose Custom event as Trigger Type.
  3. In the field Event name, type  .*  and check the box Use RegEx matching.
  4. For the "This trigger fires on" section, select Some custom events.
  5. As rule, fill in the boxes with Event matches RegEx (Ignore case) addToCart|removeFromCart .
  6. Click Save.

trigger configuration.jpg

Create the tag for ConvertPlus eCommerce tracking in Google Tag Manager

  1. In the Google Tag Manager interface, click on New Tag.
  2. Create two tags to track the ConvertPlus & InLine shopping carts.
  • One tag for non-interactive events: checkout and purchase
  • One tag for interactive events: removeFromCart

Google analytics via GTM_8.png

Create the tag for Non-interactive events

  1. Name your tag "Google Analytics Convert Plus – Event Type Non-Interactive”, to keep track of your tags easier.
  2. From the list provided by Google, select the option “Google Analytics: Universal Analytics” as Tag Type.
  3. For Category type Ecommerce, select Event as Track Type.
  4. For Action, select Event from the list provided by Google.
  5. In the Non-Interaction Hit field, select True.
  6. For the “Google Universal Analytics Settings” section, select your Google Universal Analytics Settings variable that contains the Google Analytics ID of your account.
  7. Check the box Enable overriding settings in this tag.

Google analytics via GTM_9.png

8. Under More Settings → Ecommerce → Enable Enhanced Ecommerce Features, select True.

9. Check the Use Data Layer box to capture eCommerce information from the data layer provided by 2Checkout.

Google analytics via GTM_10.png

10. In the Triggering section, select the previously configured trigger for non-interactive events: Event Ecommerce Non-interactive.

Google analytics via GTM_11.png

11. Click Save.

Create the tag for Interactive events

  1. Name your tag “Google Analytics Convert Plus – Event Type Interactive”, to keep track of your tags easier.
  2. From the list provided by Google, select the Google Analytics: Universal Analytics option as Tag Type.
  3. Select Event as Track Type.
  4. Select Ecommerce for Category type.
  5. From the list provided by Google, select Event for Action.
  6. In the Non-Interaction Hit field, select False.
  7. For the Google Universal Analytics Settings section, select your Google Universal Analytics Settings variable that contains the Google Analytics ID of your account.
  8. Check the Enable overriding settings in this tag box.

Google analytics via GTM_12.png

 9. Under More Settings → Ecommerce → Enable Enhanced Ecommerce Features, select True.

10. Check the Use Data Layer box to capture eCommerce information from the data layer provided by 2Checkout.

Google analytics via GTM_13.png

11. In the Triggering section, select the previously configured trigger for Interactive events: Event Ecommerce Interactive.

Event Ecommerce Interactive.JPG

12. Click Save.

Enable Enhanced Ecommerce in your Google Universal Analytics account

1. To enable Enhanced Ecommerce in your Google Universal Analytics account, go to Admin → View Settings → Ecommerce settings.

2. Make sure the settings for Enable Ecommerce & Enable Enhanced Ecommerce Reporting are both ON.

Google analytics via GTM_15.png

This information applies to Google Universal Analytics without GTM as well.

Exclude the 2Checkout domains from the referral list

To exclude the 2Checkout domains from the referral list in your Google Universal Analytics account, follow these steps:

 1. Go to Admin → Property settings → Tracking info → Referral Exclusion List.

 2. Add your website’s domain and the following 2Checkout domains: secure.2checkout.com and tracking.avangate.net.

 

Google analytics via GTM_16.png

This information applies to Google Universal Analytics without GTM as well.

Test your Google Universal Analytics Settings

To test if your Google Universal Analytics settings are correct, follow the steps below (make sure your browser is not set to Incognito mode):

 1. Download and install the Tag Assistant Companion browser extension found here.

 2. Click on Preview.

preview GTM.png

3. Delete all existing domains.

delete all domains.png

4. Click on Add domain.

add domain.png

5. Add https://tracking.avangate.net/ and click Start.

click start.png

6. Go back to the Google Tag Manager tab but DON’T close the tab with tracking.avangate.local.

tracking URL.png

7. Click on X in the top-left corner.

connecting to avangate.png

8. In the Tag Assistant Tab, click on Add domain.

add domain tag assisstant tab.png

9. Enter the buy-link you want to debug and click Start.

debug buy-link.png

10. Go back to the Google Tag Manager debugger tab.

debugger.png

11. Click on the Enable button behind the “Connecting this window to avangate.net” pop-up.

enable popup.png

12. Click on Continue.

click continue.png

13. You are now debugging tracking.avangate.net, but this domain receives tags from the shopping cart.

debug success.png

Submit and publish your settings

Google analytics via GTM_20.png

Merchant Control Panel Settings

The Analytics section in your Merchant Control Panel allows you to integrate Google Universal Analytics or/and Google Tag Manager in the ConvertPlus or InLine ordering engines and thus track the behavior of your shoppers on the 2Checkout pages.

Follow these steps to complete your analytics integration:

  1. Log into your Merchant Control Panel.
  2. Navigate to Setup → Ordering options.
  3. Click on the Analytics tab.
  4. Click on the ConvertPlus and InLine Checkout tab.

web analytics in Merchant Control Panel_5.png

 

5. In the Google Tag Manager box, click on Set up.

Select Google Tag Manager with UA

 

6. Fill in the Google Tag Manager code (Here is how you obtain it) and click Save.

GTM with UA insert container ID

7. Complete the integration by using the slider to activate Google Tag Manager. It is not recommended to activate both Universal Analytics and Google Tag Manager to send data to the same Google Universal Analytics view, otherwise, duplicate data will occur.

ConvertPlus & Inline Checkout - Activate Google Tag Manager with UA

1. 2Checkout data layer for tracking through Google Tag Manager is placed in an iFrame. This data layer has an eCommerce object, that contains eCommerce information built on the structure required by Google Universal Analytics reporting for the following events: checkout, add to cart, product impressions (for cross-sells), purchase, and remove from cart.

2. For fully enhanced eCommerce reporting in Google Universal Analytics, it is recommended that you send information to Google Universal Analytics from your website that includes product impression, product detail, and add to cart. More information on enhanced eCommerce reporting and how to send Product View and Add to Cart data to Google Universal Analytics can be found here: https://developers.google.com/tag-manager/enhanced-ecommerce

3. In addition to the eCommerce object, the data layer also contains an event called cartUpdated that includes additional parameters with information on the shopping cart. These parameters can be used to capture further information in custom dimensions. Refer to the Google Documentation on how to build custom dimension through Google Tag Manager: https://support.google.com/tagmanager/answer/6164990?hl=en .

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