Skip to main content

2CO Data Share in Snowflake

Overview

2CO Snowflake Data Share enables users to query their data collected in the 2CO platform directly using SQL or retrieve it using other business intelligence (BI) tools, with more user-friendly interfaces, such as Power BI or Looker Studio to create reports efficiently.

The 2CO Snowflake Data Share is available only for organizations with their own Snowflake instance.

Availability

2CO Data Share with Snowflake is available on request starting from January 2025. Get in touch with our Sales teams to request the integration with Snowflake.

Benefits

  • 2 CO offers vendors the possibility to generate reports easier and faster via Snowflake Data Share than by using other out-of-the-box reporting tools.
  • Reports generated from Snowflake have increased accuracy and can provide vendors with more complex data sets.
  • Vendors can use Snowflake data together with other reporting tools in their portfolio to obtain even better and more accurate data about their business.

Requirements

  • The target account must be an enterprise snowflake edition.
  • The user must have “accountadmin” privileges to access the share.

Workflow

  1. Login to the Snowflake Account and select the Account Admin Role from bottom left.
    Snowflake Account
  2. Navigate to the left panel, select Data Products and then choose Private Sharing.
  3. Navigate to the right panel and select SHARE_[ACCOUNT].
    SHARE_[ACCOUNT]
  4. Select the download icon and Snowflake will then download the shared object under a database.
    download icon

To query and retrieve 2CO data stored in Snowflake, you can use standard SQL directly in the Snowflake interface or other external BI tools such as Power BI or Looker Studio.

Integrate your favorite BI tool

Snowflake supports integration with many BI platforms. Refer to the Snowflake documentation for details.

Data sets available in Snowflake

Data sets available in Snowflake

Tables

 
The below described tables are the standard tables offering. For more fields or tables, contact your account manager.

Subscriptions Events Table

  • Key Information:
    • This table stores events (meaning that there will be more than 1 entry for the same LICENSE_CODE).
    • The row containing the most recent event (EVENT_DATE) for a subscription (LICENCE_CODE) reflects its’ last state.
    • License code, purchase date, expiration date, order IDs.
  • Available fields:
Field Name Type Description
EVENT_DATE TIMESTAMP_TZ A snapshot of the subscription at EVENT_DATE.
LICENCE_CODE
(SUBSCRIPTION_BILLING_CYCLES.LICENCE_CODE)
VARCHAR Unique subscription identifier.
PREVIOUS_EXPIRATION_DATE TIMESTAMP_TZ Expiration date before current snapshot renewal.
EXPIRATION_DATE TIMESTAMP_TZ Expiration date of the current snapshot.
IS_AUTORENEWING BOOLEAN Current snapshot at status.
STATUS VARCHAR The status of the subscription.
AUTORENEWAL_DISABLE_REASONS VARIANT Reasons for disabling auto-renewal.
AUTORENEWAL_DISABLE_DATE TIMESTAMP_TZ Date auto-renewal was disabled.
AUTORENEWAL_DISABLE_SOURCE VARCHAR  
DISABLE_REASONS VARIANT The reason for which the subscription is disabled.
DISABLE_DATE TIMESTAMP_TZ The date when the subscription is disabled.
DISABLE_SOURCE VARCHAR  
INITIAL_PURCHASE_DATE TIMESTAMP_TZ Date of the first purchase for the subscription.
PRODUCT_CODE VARCHAR Catalog product code.
PAYMENT_METHOD_ON_FILE VARCHAR  
IS_TRIAL BOOLEAN True for trial subscriptions, false otherwise.
IS_LIFETIME BOOLEAN True if the subscription is evergreen, of false if the subscription has a recurring billing cycle less than or equal to three years.
PARTNER_ID NUMBER Vendor’s partner/reseller ID.
IS_TEST BOOLEAN True for test subscriptions, false otherwise.
ACCOUNT_ID NUMBER Vendor ID
CURRENT_ORDER_ID
(ORDERS_PRODUCTS.ORDER_ID)
NUMBER ID of the order which initiated current / most recent billing cycle of the subscription.
CURRENT_PRODUCT_ID NUMBER Product ID of the product pertaining to the current / most recent billing cycle of the subscription.
PREVIOUS_ORDER_ID
(ORDERS_PRODUCTS.ORDER_ID)
NUMBER ID of the order before the most recent. Can be null in case of a new acquisition.
PREVIOUS_PRODUCT_ID NUMBER Can be different from current product ID if an upgrade occurred on the subscription.
SUBSCRIPTION_PRODUCT_ID
(SUBSCRIPTION_PRODUCT_EVENTS.SUBSCRIPTION_PRODUCT_ID)
NUMBER Unique identifier of the product association between product and the license code. Identifies uniquely the product with its product options and quantity selected for that subscription.
CUSTOMER_ID NUMBER 2CO internal customer identifier.
NEXT_RENEWAL_PRICE FLOAT Renewal price for the next billing cycle.
NEXT_RENEWAL_PRICE_CURRENCY VARCHAR Renewal currency for the next billing cycle.
RENEWAL_COUNTER NUMBER The number of renewals.

Customer Events Table

  • Purpose: analyze customer-specific metrics such as CLV (Customer Lifetime Value).
  • Key Information:
    • This table stores events (meaning that there will be more than 1 entry for the same customer).
    • The row containing the most recent event (EVENT_DATE) for a customer (CUSTOMER_ID) reflects its’ last state.
    • Customer demographics (email, name).
    • Product and order details.
    • Payment methods and promotions.
  • Available fields:
Field Name Type Description
CUSTOMER_ID
(ORDERS_PRODUCTS.CUSTOMER_ID)
NUMBER 2CO internal customer identifier.
ACCOUNT_ID NUMBER Vendor ID.
ADDRESS_DELIVERY VARCHAR Address for delivery.
CITY VARCHAR City
COMPANY VARCHAR Company name.
COUNTRY_CODE VARCHAR Country code from the billing details.
CREATION_DATE TIMESTAMP_TZ Customer creation date.
EMAIL VARCHAR Customer’s email address.
EMAIL_DELIVERY VARCHAR Email address for delivery.
EVENT_DATE TIMESTAMP_TZ Date when a change on the entity happened. In this case the customer.
EXTERNAL_CUSTOMER_ID VARCHAR External customer ID.
FIRST_NAME VARCHAR Customer’s first name.
FIRST_NAME_DELIVERY VARCHAR First name for delivery.
FISCAL_CODE VARCHAR Company VAT ID / Tax ID.
LAST_NAME VARCHAR Customer last name.
LAST_NAME_DELIVERY VARCHAR Last name for delivery.
PHONE VARCHAR Customer's phone number.
STATE VARCHAR Customer's state.
STATUS VARCHAR The status of the order.
TAX_OFFICE VARCHAR Tax office code.
ZIP VARCHAR Zip code.

Orders Products Table

  • Purpose: use this table to calculate average order value, refund amounts, chargebacks, or to reach out to customers to ask them to update payment details.
  • Key Information:
    • This table stores events (meaning that there will be more than 1 entry for the same order).
    • If there are more products in one order, then, we will have more rows associated to the same ORDER_ID.
    • Order ID, product IDs, customer data, payment type, card expiration date, chargebacks, refunds, discounts.
  • Available fields:
Field Name Type Description
CUSTOMER_ID
(CUSTOMER_EVENTS.CUSTOMER_ID)
NUMBER 2CO internal customer identifier.
EMAIL VARCHAR Customer email address.
FIRST_NAME VARCHAR Customer first name.
LAST_NAME VARCHAR Customer last name.
ORDER_FINISH_DATE VARCHAR Date and time when order was completed.
STATUS VARCHAR

The status of the order.
Possible values:

  • ORDER_SHIPPED
  • AUTH_INVALID
  • PURCHASE_COMPLETE
  • APPROVED
  • CHARGEBACK_CLOSED
  • PURCHASE_PENDING
  • PURCHASE_CANCELED_TIMEOUT
  • REFUND
  • SUSPECT
  • PROCESSING
  • CHARGEBACK_OPEN
  • CANCELED
  • DELIVERED_ORDER_FOR_PARTNER
  • VENDOR_APPROVED
  • COMPLETE
  • SHOPPER_INVOICE
  • PURCHASE_EXPIRED_NOT_PAID
  • PENDING
CARD_LAST_DIGITS VARCHAR The last 4 digits of the shopper credit/debit card.
CARD_EXPIRATION_DATE VARCHAR Card expiration month and year.
CARD_TYPE VARCHAR

Shopper card type.
Possible values:

  • visa
  • carte_bleue
  • discover
  • jcb
  • visaelectron
  • amex
  • hipercard
  • maestro
  • elo
  • unionpay
  • mastercard
  • american express
SRC_CODE VARCHAR Issued by vendor; examples look like affiliate referral IDs.
PRODUCT_PCODE VARCHAR SUBSCRIPTIONS_BILLING_CYCLES -> PRODUCT_CODE.
PRODUCT_DISCOUNT VARCHAR Discount amount.
PRODUCT_PROMOTION_CATEGORY VARCHAR

One of the product promotion categories.
Possible values:

  • UPSELL
  • CROSS_SELLING
  • PROMOTION
PRODUCT_PROMOTION_NAME VARCHAR The name given to the newly added promotion.
PRODUCT_PROMOTION_CODE VARCHAR Promotion code automatically generated by adding a new promotion.
CHARGEBACK_RESOLUTION VARCHAR

Chargeback status information.
Possible values:

  • OPEN
  • ACCEPTED
  • NONE
  • WON
  • LOST
CHARGEBACK_REASON_CODE VARCHAR

Identifier for the chargeback dispute reason from the 2Checkout system.
Possible values:

  • CREDIT_NOT_PROCESSED
  • NOT_RECOGNIZED
  • NOT_AS_DESCRIBED
  • UNKNOWN
  • FRAUD / NOT_RECOGNIZED
  • INFO_REQUEST
  • DUPLICATE_TRANSACTION
  • CANCELED_RECURRING
  • AUTHORIZATION_PROBLEM
  • MERCHANDISE_NOT_RECEIVED
CHARGEBACK_OPEN_DATE VARCHAR The date when the chargeback dispute was initiated.
REFUND_TYPE VARCHAR

Describes the type of the refund.
Possible values:

  • Total
  • Partial
REFUND_REASON VARCHAR

The reason for the refund.
Possible values:

  • Unwanted auto renewal
  • Technical issue
  • Duplicate Order
  • Purchased wrong amount (devices)
  • Other
  • No reason
  • Refund – doesn’t want auto-renewal
  • custom reason
  • Accidental order
  • Tax exemption issue
  • Delayed License Key
  • Multiple subscriptions
  • Price too high
  • Upgrade seat refund
  • Project Tollbooth
  • Uses a different provider
  • Duplicate order
  • Purchased wrong product (iOS)
  • Product not received
  • Update Payment Method
  • Not satisfied with the product
  • Purchased wrong product
  • Unwanted auto-renewal
  • Avoid chargeback
  • Incorrect product ordered
  • Chargeback
  • Purchased/renewed more seats than needed
  • Technical issue with the product
  • Chargebacks
ORDER_TOTAL VARCHAR Total amount paid for order.
SALEDATA_CURRENCY VARCHAR Currency for the above amount.
PRODUCT_QTY VARCHAR Number of products per order.
PRODUCT_PRICE VARCHAR Price of the product in order (excluding taxes).
ORDER_ORIGIN VARCHAR

Source of the order from which was placed.
Possible values:

  • Automatic Billing
  • API
  • Web
  • Mobile
ORDER_ID
(SUBSCRIPTIONS_EVENTS.CURRENT_ORDER_ID, SUBSCRIPTION_EVENTS.PREVIOUS_ORDER_ID, SUBSCRIPTION_BILLING_CYCLES.ORDER_ID)
VARCHAR ID of the order.
COUNTRY_CODE VARCHAR Country code.
ACCOUNT_ID NUMBER Company acc ID.
PRODUCT_ID NUMBER Catalogue product ID.
EVENT_DATE TIMESTAMP_TZ Date of the change triggering an update.

Exchange Rates Table

  • Purpose: allows conversion one currency to another based on historical rates.
  • Key Information:
    • Each row contains exchange rates from one currency to another for each day stating on 2002/09/05.
  • Available fields:
Field Name Type Description
EXCHANGE_DATE TIMESTAMP_TZ The date when the exchange was made.
FROM_CURRENCY VARCHAR The currency from which the exchange was made.
TO_CURRENCY VARCHAR The currency to which the exchange was made.
EXCHANGE_RATE FLOAT The exchange rate used to convert the amount.

Mandatory 2Checkout information in custom shopper emails

As a Merchant of Record (MoR), 2Checkout is legally responsible for complying with the scheme, acquirer, as well as local/regional consumer protection regulations, when it comes to communication distributed to shoppers through emails triggered by our platform.

Item Content can be customized Requirement
Email sender address Yes The email sender address can be personalized with the vendor’s name, while keeping the 2Checkout domain.
This will make it easy for the shopper to recognize where the email is coming from and ensure that if they reply, a ticket will be submitted to the 2Checkout Support team.
e.g., vendor@2checkout.com
Do not use subdomains e.g., vendor@subdomain.2checkout.com
Email sender name/alias Yes The sender must be 2Checkout or include the 2Checkout name e.g., [Vendor_name]/2Checkout
Header No Display the 2Checkout logo The vendor can add their logo, but not remove the 2Checkout logo. From a UX perspective, it is recommended that the two logos be displayed at the same height.
Email copy (text) Yes Clearly state the reason for sending the email  
Clear CTA button e.g., Complete your order, Retry payment, Renew subscription
Link to myAccount for transactional emails, such as payment receipt emails, automatic renewal reminders The shopper should be able to find an easy path to request a refund or cancel auto-renewal for an order they have placed or manage their subscription (in terms of its recurring status).
Support section No Section title 'Need help with your order?' (recommended by Shopper Support team)
2Checkout contact support information and disclaimer ‘If you have any questions or need assistance for topics related to order processing and returns, please contact our support team at support@2checkout.com.’
Footer No 2Checkout logo  
2Checkout MOR disclaimer ‘Your order is securely processed by our Merchant of Record and reseller, 2Checkout.’
2Checkout's name and address Verifone Payments BV dba 2Checkout
Mail address: P.O. Box 11334, 1001 GH Amsterdam
Singel 250, Amsterdam, Netherlands
+31 88 0000008

Avangate Inc dba 2Checkout
Mail address: 1170 Great Oaks Way no. 210, 30022 Alpharetta, Georgia, USA

Note: Depending on the processing route, 2Checkout can also act using the Avangate INC entity. For the platform default emails, the entity can be displayed dynamically from the back end. For emails customized by vendors without support from 2Checkout Professional Services, we recommend referencing both entities.
Terms & Conditions link https://www.2co.com/terms.html
Privacy Policy link https://www.2co.com/privacy.html
Unsubscribe link for lead management and manual renewal reminders Emails that are part of the service delivery (e.g., order confirmation emails, payment receipt emails, electronic delivery emails, shopper invoices, automatic renewal reminders, etc.) should not include the option to unsubscribe.

Example of a compliant follow-up email:

compliant follow-up email

Implement Facebook Pixel in ConvertPlus and Inline carts through Google Tag Manager

A. Create a tag for Facebook Pixel Page View Initialization

Create this tag if you don’t already have a Facebook Pixel tag on your website that fires on all pages where you have the Google Tag Manager code.

  1. Click to create a new tag.
  2. As Tag Type select Custom HTML. In the script below, under '{your-pixel-id-goes-here}' type your Facebook pixel. The script below is the Pixel Base Code and can be found in the Facebook/Meta Pixel documentation.

    <!-- Facebook Pixel Code -->
    <script>
      !function(f,b,e,v,n,t,s)
      {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
      n.callMethod.apply(n,arguments):n.queue.push(arguments)};
      if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
      n.queue=[];t=b.createElement(e);t.async=!0;
      t.src=v;s=b.getElementsByTagName(e)[0];
      s.parentNode.insertBefore(t,s)}(window, document,'script',
      'https://connect.facebook.net/en_US/fbevents.js');
      fbq('init', '{your-pixel-id-goes-here}');
      fbq('track', 'PageView');
    </script>
  3. As Triggering select All Pages.
    All Pages

B. Create a User-defined variable in Google Tag manager called “ecommerce”

  1. Click on New, to create a new user-defined-variable.
    User-defined variable ecommerce”
  2. As Variable Type, select Data Layer Variable.
  3. As Data Layer Variable Name, add ecommerce in the field.
  4. As Data Layer Version select Version 2.
    Data Layer Variable ecommerce

C. Create a User-defined variable in Google Tag Manager for Facebook called ConvertPlus - FacebookEventsScript

  1. Click on New to create a new user-defined-variable.
    a new user-defined-variable
  2. As Variable Type select Custom JavaScript.
  3. In the Custom JavaScript section paste the below code.

    function(){
      var attr = {};
      attr.currency = "USD";
      attr.content_type = "product";
      var fbContents,fbIds,fbNames,i;
    //function fbData
    var fbData = function() {
    fbContents = [];
        fbIds = [];
        fbNames = [];
        attr.num_items = {{ecommerce}}.items.length;
        for(i=0;i<{{ecommerce}}.items.length;i++){
          fbContents.push({
           'id':{{ecommerce}}.items[i].item_id,
           'name':{{ecommerce}}.items[i].item_name,
           'quantity':{{ecommerce}}.items[i].quantity
          });
         	fbIds.push({{ecommerce}}.items[i].item_id);
          fbNames.push({{ecommerce}}.items[i].item_name);
       	 }
        attr.contents = fbContents;
        attr.content_ids = fbIds;
        attr.content_name = fbNames;
    	};
      if({{Event}} === 'begin_checkout'){         
        attr.value = {{ecommerce}}.actionField.checkout_valueUSD; 
        fbData();   
      }
      if({{Event}} === 'purchase'){
       attr.value = {{ecommerce}}.actionField.valueUSD; 
        fbData();
      }
      return attr;
    }

D. Create a trigger specifically for the purchase event

Create a new trigger which is restricted only to the purchase event and name it Event Ecommerce Purchase Only.

  1. As Trigger Type, select Custom Event.
  2. As Event name, type purchase.
  3. For this trigger to fire on, select All Custom Events.
    Event Ecommerce Purchase Only

E. Create a tag for the Facebook Pixel for the purchase event

  1. Create a new tag named for example Facebook Purchase ConvertPlus.
  2. As Tag Type select Custom HTML.
  3. In the HTML section, paste the following code:

    <script>
     fbq('track', 'Purchase', {{ConvertPlus - FacebookEventsScript}},{eventID:
    {{ecommerce}}.transaction_id});
    </script>
    
  4. For Triggering, select the Trigger for Event Ecommerce Purchase only, the trigger that is only restricted to the purchase event.
    Event Ecommerce Purchase Only

Optional! – send information with the Facebook Pixel at checkout if needed

Create a trigger specifically for the checkout event

Create a new trigger which is restricted only to the purchase event and name it Event Ecommerce Checkout Only.

  1. As Trigger Type, select Custom Event.
  2. As Event name, type begin_checkout.
  3. For this trigger to fire on, select All Custom Events.
    Event Ecommerce Checkout Only

Create a tag for the Facebook Pixel for the checkout event

  1. Create a new tag named for example Facebook Checkout ConvertPlus.
  2. As Tag Type select Custom HTML.
  3. In the HTML section, paste the following code:

    <script>
      fbq('track', 'InitiateCheckout', {{ConvertPlus - FacebookEventsScript}});
    </script>
    
  4. For Triggering, select the Trigger for Event Ecommerce Checkout only, the trigger that is only restricted to the checkout event.
    Facebook Checkout ConvertPlus

Implement Facebook Pixel in Default Carts through Google Tag Manager

A. Create a tag for Facebook Pixel Page View Initialization

Create this tag if you don’t already have a Facebook Pixel tag on your website that fires on all pages where you have the Google Tag Manager code.

  1. Click to create a new tag.
  2. As Tag Type select Custom HTML. In the script below, under '{your-pixel-id-goes-here}' type your Facebook pixel ID. The script below is the Pixel Base Code and can be found in the Facebook/Meta Pixel documentation.

    <!-- Facebook Pixel Code --> 
    <script> 
      !function(f,b,e,v,n,t,s) 
      {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 
      n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 
      if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 
      n.queue=[];t=b.createElement(e);t.async=!0; 
      t.src=v;s=b.getElementsByTagName(e)[0]; 
      s.parentNode.insertBefore(t,s)}(window, document,'script', 
      'https://connect.facebook.net/en_US/fbevents.js'); 
      fbq('init', '{your-pixel-id-goes-here}'); 
      fbq('track', 'PageView'); 
    </script> 
  3. As Triggering select All Pages.
    All Pages

B. Configure dataLayer variables in Google Tag Manager

Configure dataLayer variables in Google Tag Manager to further use them in the Facebook implementation.

2checkout shopping carts contain a dataLayer with eCommerce information on the Google Analytics 4 structure. You can view this by typing dataLayer into the browser console and under gtag4, you can see the eCommerce information on Google Analytics 4 structure both at checkout and at purchase on the order Finish page.

dataLayer variables

  1. Configurate variables in Google Tag Manager
    To capture the eCommerce information from the dataLayer, you will first need to configurate certain data layer variables in Google Tag Manager. You can then use those variables in the script for the Facebook Pixel tracking.
    1. Create a variable called gtag4.event in Google Tag Manager
      Click to create a new User-Defined Variable in Google Tag Manager. Name you variable “gtag4.event” to keep track of it easier.
      User-Defined Variable
      As Variable Type select Data Layer Variable from the options provided by Google.
      Under Data Layer Variable Name type gtag4.event.
      Under Data Layer Version select Version 2.
      variable configuration
    2. Create a variable called gtag4.currency in Google Tag Manager
      Click to create a new User-Defined Variable in Google Tag Manager. Name your variable “gtag4.currency” to keep track of it easier.
      As Variable Type select Data Layer Variable from the options provided by Google.
      Under Data Layer Variable Name type gtag4.currency.
      Under Data Layer Version select Version 2.
      variable gtag4.currency
    3. Create a variable called gtag4.items in Google Tag Manager
      Click to create a new User-Defined Variable in Google Tag Manager. Name your variable “gtag4.items” to keep track of it easier.
      As Variable Type select Data Layer Variable from the options provided by Google.
      Under Data Layer Variable Name type gtag4.items.
      Under Data Layer Version select Version 2.
      variable gtag4.items
    4. Create a variable called gtag4.tax in Google Tag Manager
      Click to create a new User-Defined Variable in Google Tag Manager. Name your variable “gtag4.tax” to keep track of it easier.
      As Variable Type select Data Layer Variable from the options provided by Google.
      Under Data Layer Variable Name type gtag4.tax.
      Under Data Layer Version select Version 2.
      variable gtag4.tax
    5. Create a variable called gtag4.transaction_id in Google Tag Manager
      Click to create a new User-Defined Variable in Google Tag Manager. Name your variable “gtag4.transaction_id” to keep track of it easier.
      As Variable Type select Data Layer Variable from the options provided by Google.
      Under Data Layer Variable Name type gtag4.transaction_id.
      Under Data Layer Version select Version 2.
      variable gtag4.transaction_id
    6. Create a variable called gtag4.value in Google Tag Manager to capture the total value of the order, including tax
      Click to create a new User-Defined Variable in Google Tag Manager. Name your variable “gtag4.value” to keep track of it easier.
      As Variable Type select Data Layer Variable from the options provided by Google.
      Under Data Layer Variable Name type gtag4.value.
      Under Data Layer Version select Version 2.
      variable gtag4.value

C. Create a User-defined variable in Google Tag Manager for Facebook called FacebookEventsScript

  1. Click on New to create a new user-defined-variable.
    FacebookEventsScript
  2. As Variable Type select Custom JavaScript.
  3. In the Custom JavaScript section paste the below code. This code will capture product, transaction id and transaction value data, using the dataLayer variables previously created.

    function(){
      var attr = {};
      attr.currency = {{gtag4.currency}};
      attr.content_type = "product";
      var fbContents = [];
      var fbIds = [];
      var fbNames = [];
    //function fbData
    var fbData = function() {
        attr.num_items = {{gtag4.items}}.length;
        for(var i=0;i<{{gtag4.items}}.length;i++){
          fbContents.push({
           'id':{{gtag4.items}}[i].item_id,
           'name':{{gtag4.items}}[i].item_name,
           'quantity':{{gtag4.items}}[i].quantity
          });
         	fbIds.push({{gtag4.items}}[i].item_id);
          fbNames.push({{gtag4.items}}[i].item_name);
       	 }
        attr.contents = fbContents;
        attr.content_ids = fbIds;
        attr.content_name = fbNames;
    	};
    if ({{gtag4.event}} === 'begin_checkout' && window.omniture_vars && window.omniture_vars.CART_PRODUCTS){
    	var checkoutValue=0;
    	var checkoutCartProducts = omniture_vars.CART_PRODUCTS;
    	for (var i=0; i<checkoutCartProducts.length;i++){
    	checkoutValue += Number(checkoutCartProducts[i].ProductTotalPriceWithTaxAndDiscount * checkoutCartProducts[i].ProductQuantity); 
    	}
        checkoutValue = parseFloat(checkoutValue.toFixed(2))
        attr.value=checkoutValue;
    	fbData();
    }
      if({{gtag4.event}} === 'purchase'){
       attr.value = {{gtag4.value}}; 
        fbData();
      }
      return attr;
    }

D. Create a trigger specifically for the purchase event

Create a new trigger which is restricted only to the purchase event and name it Purchase Event Only.

  1. As Trigger Type, select Custom Event.
  2. As Event name, type 2checkout event.
  3. For this trigger fires on, select Some Custom Events.
  4. Add the condition that variable gtag4.event equals purchase.
    Purchase event only

E. Create a tag for the Facebook Pixel for the purchase event

  1. Create a new tag, named, for example Facebook Purchase.
  2. As Tag Type select Custom HTML.
  3. In the HTML section, paste the following code (this code will send product, transaction id and transaction value data to Meta when a purchase takes place).

    <script>
      fbq('track', 'Purchase', {{FacebookEventsScript}}, {eventID: {{gtag4.transaction_id}}});
    </script>
  4. For Triggering, select the Trigger for Event Ecommerce Purchase only, the trigger that is only restricted to the purchase event.
    Create a tag for the Facebook Pixel for the purchase event

Optional! – send information with the Facebook Pixel at checkout if needed

Create a trigger specifically for the checkout event

Create a new trigger which is restricted only to the checkout event and name it Checkout Event Only.

  1. As Trigger Type, select Custom Event.
  2. As Event name, type 2checkout event.
  3. For this trigger to fire on, select Some Custom Events.
  4. Add the condition that variable gtag4.event equals checkout.
    Checkout Event Only.

Create a tag for the Facebook Pixel for the checkout event

  1. Create a new tag, named, for example Facebook Checkout.
  2. As Tag Type select Custom HTML.
  3. In the HTML section, paste the following code:

    <script>
      fbq('track', 'InitiateCheckout', {{FacebookEventsScript}});
    </script>
    
  4. For Triggering, select the Trigger for Event Ecommerce Checkout only, the trigger that is only restricted to the checkout event.
    Facebook Checkout.
 
The tags for Facebook Pixel need to be based on consent. You should further adjust the tags described above to condition them based on your way of collecting consent.

Instant Tax Rate Export (ITE)

Overview

Instant Tax Rate Export allows you to extract the tax rate information for your products as a JSON. The resulting file will contain the tax rates for each country & state (where applicable) for the product tax category provided, including zip codes* if requested (where applicable).

 
*US tax rates by zip code are informative only, final tax rate is calculated at checkout. 

Availability

ITE is available to all 2Checkout accounts.

Rate limit: this service is rate limited and can only be accessed by an account 20 times each day. Tax Rates exported at the beginning of the day should be stored by you for the rest of the day, do not call this service for each customer.

Method and URL

POST: https://secure.2checkout.com/action/taxes.php

Request parameters

2Checkout captures the parameters you send and exports the data to the client.

Field Description Required Used in HASH validation
MERCHANT Your 2Checkout merchant code. The merchant code and secret key for your account are available here. Required, cannot be empty YES
REQ_DATE The time of request (UTC), in format Y-m-d H:i:s:
Y = year, 4 digits
m = month, 2 digits
d = day, 2 digits
H = hour, 2 digits
i = minute, 2 digits
s = seconds, 2 digits
Required, cannot be empty YES
PRODUCT_TAX_CATEGORY Unique, system-generated 2Checkout product tax category identifier in the form of a UUID. Use getProductTaxCategories API method to retrieve the list of product tax categories available for your account. Required, cannot be empty YES
SHOPPER_TYPE

Indicates the type of customer (individual or company) you would like to export tax rates for. 

Possible values:
EMPTY – Exports tax rates for all possible combinations of shopper type.
B2B – Exports tax rates exclusively applicable to company type shoppers.
B2C – Exports tax rates exclusively applicable to individual type shoppers.
Both – exports tax rates exclusively applicable to both B2B and B2C customers at the same time.

Required, can be empty YES
INCLUDE_ZIP_CODES Indicates whether the export should include the zip code level tax rates where applicable.
*Note US tax rates by zip code are informative only, final tax rate is calculated at checkout.
Possible values:
0 – Do not include zip code level tax rates
1 – Include zip code level tax rates
Required, cannot be empty YES
HASH The SHA2/SHA3 HMAC key for the request. Required N/A
SIGNATURE_ALG

The hashing algorithm used to authenticate the request. 

Supported algorithms:
sha256
sha3-256

Required NO

Requirements

HASH validation

  • To validate the SHA2/SHA3 hash signature, you're required to include all mandatory parameters. 2Checkout throws an error if one of these parameters is missing.
  • Use UTC for the time zone of REQ_DATE. The difference between the value of REQ_DATE and the moment when you send the request to 2Checkout must be smaller than 5 minutes, or 2Checkout will respond with the 'Request expired' error message.

Authentication

Authenticate requests using:

  • HASH. This ia a SHA2/SHA3 Hash-based message authentication code (HMAC) that you create using your account's secret key and the parameters marked as mandatory for HASH validation. To build the source string, prepend each value with its own length in bytes. Use 0 for null or empty values without prepending their length. However, when the value is 0 (zero), you do need to prepend its length (1). Note that for UTF-8 characters the length in bytes can be longer that the string length.
  • REQ_DATE. Use UTC time zone.

Optional: The authentication can be restricted by IP or range of IPs from firewall (Accounts settings > User access > Firewall) for the special service user. If the IP from where you make the request is not configured in 2Checkout, the authentication fails.

Response

Provided that your request is valid, you will receive the information in line, in JSON format with HTTP code 200.

Code sample

<?php
// init
$host = 'https://secure.2checkout.com/action/taxes.php';

$merchantCode = 'YOUR_MERCHANT_CODE';
$key = 'YOUR_SECRET_KEY';
$signatureAlgo = 'sha256';

$jsonRpcRequest = array (
    'MERCHANT' => $merchantCode,
    'REQ_DATE' => (new DateTime("now", new DateTimeZone("UTC")))->format('Y-m-d H:i:s'),
    'PRODUCT_TAX_CATEGORY' => '997391d5-48d2-48d4-8914-6d48307b1307', // uuidProductTaxCategory received from API method getProductTaxCategories 
    'SHOPPER_TYPE' => '',// B2B, B2C, Both or empty
    'INCLUDE_ZIP_CODES' => '0'
);

$string = '';
foreach ($jsonRpcRequest as $value) {
    $string .= strlen($value) . $value;
}

$hash = hash_hmac($signatureAlgo, $string, $key);

$jsonRpcRequest['HASH'] = $hash;
$jsonRpcRequest['SIGNATURE_ALG'] = $signatureAlgo;

header('Content-Type: application/json');
echo call($jsonRpcRequest, $host, false);


function call($Request, $hostUrl, $Debug = true) {
    $curl = curl_init($hostUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_VERBOSE, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_PROXY, '');

    curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);

    if ($Debug) {
        var_dump($Request);
    }

    $ResponseString = curl_exec($curl);
    if ($Debug) {
        var_dump($ResponseString);
    }

    if (!empty($ResponseString)) {
        return $ResponseString;
    } else {
        return null;
    }
}

Subscription churn prevention campaigns

Overview

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

Parameters Type/Description
AvailableCancellationReasons Object with dynamic properties (as reasons number can change in time)
  REASON_CODE_1 Required (string)
  REASON_CODE_3 Required (string)
  REASON_CODE_5 Required (string)
  REASON_CODE_6 Required (string)
  REASON_CODE_7 Required (string)
  REASON_CODE_9 Required (string)
Campaigns Array of objects
  Code String
    Unique, system-generated campaign identifier.
  Name String
    Name of the campaign.
  DefaultMessage String
    Default message of the campaign displayed to shoppers.
  CancellationReasonRequired Boolean
    Used to decide if you want to collect feedback from customers.
  OfferPause Boolean
    Used to decide if you want to allow shoppers to pause subscription.
  OfferDiscount Object
    Message String
      Discount message.
    Discount String
      Discount value in decimal number.
    BillingCycles String
      Billing cycles number.

Subscription churn prevention campaigns

Overview

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

Parameters Type/Description
AvailableCancellationReasons Object with dynamic properties (as reasons number can change in time)
  REASON_CODE_1 Required (string)
  REASON_CODE_3 Required (string)
  REASON_CODE_5 Required (string)
  REASON_CODE_6 Required (string)
  REASON_CODE_7 Required (string)
  REASON_CODE_9 Required (string)
Campaigns Array of objects
  Code String
    Unique, system-generated campaign identifier.
  Name String
    Name of the campaign.
  DefaultMessage String
    Default message of the campaign displayed to shoppers.
  CancellationReasonRequired Boolean
    Used to decide if you want to allow shoppers to pause subscription.
  OfferDiscount Object
    Message String
      Discount message.
    Discount String
      Discount value in decimal number.
    BillingCycles String
      Billing cycles number.

Enter campaign

Overview

Use the enterChurnCampaign method to confirm the campaign you want for the churn campaign process.

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.
CampaignCode Required (string)
  The code of the campaign you want to confirm.

Response

Parameters Type/Description
Boolean true or false depending on whether the changes were successful or not.

Request

<?php

require('PATH_TO_AUTH');

$subscriptionReference = '351D8F557E';
$campaignCode          = 'UGPPKKJY5L1LHBFPHKQ3';

$jsonRpcRequest = [
    'method' => 'enterChurnCampaign',
    'params' => [$sessionID, $subscriptionReference, $campaignCode],
    'id' => $i++,
    'jsonrpc' => '2.0'
];

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

Accept campaign discount

Overview

Use the acceptChurnCampaignDiscount method to confirm the campaign you want for the churn campaign process.

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.
CampaignCode Required (string)
  The code of the campaign you want to confirm.

Response

Parameters Type/Description
Boolean true or false depending on whether the changes were successful or not.

Request

<?php

require('PATH_TO_AUTH');

$subscriptionReference = '351D8F557E';
$campaignCode          = 'UGPPKKJY5L1LHBFPHKQ3';

$jsonRpcRequest = [
    'method' => 'acceptChurnCampaignDiscount',
    'params' => [$sessionID, $subscriptionReference, $campaignCode],
    'id' => $i++,
    'jsonrpc' => '2.0'
];

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

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