Data Share in Snowflake
Overview
2Checkout Snowflake Data Share gives you direct, SQL-based access to your real-time transactional, subscription, and customer data from the 2Checkout platform.
This feature allows you to:
-
Query 2Checkout data using standard SQL
-
Process your data using any BI tool that supports Snowflake (including popular platforms like Power BI, Tableau, Sigma, or Looker Studio), thanks to Snowflake's broad compatibility and wide industry adoption
-
Build custom dashboards and reports with near real-time data
-
Blend 2Checkout data with internal datasets to unlock deep business insights
Availability
It's available exclusively for organizations with their own Snowflake instance.
2Checkout Data Share with Snowflake is available on request starting January 2025. Contact our Sales team to request integration with Snowflake.
Benefits
- Faster, more flexible reporting - generate reports more easily and efficiently compared to out-of-the-box tools
- Higher accuracy & richer datasets - access to detailed, near real-time transactional data allows for more granular insights
- Seamless integration with your BI stack - use Snowflake data alongside other tools and sources to build comprehensive business views
Snowflake datasets
Subscriptions events
-
Purpose: These fields can be used for calculating subscription-specific metrics, such as renewal and disable rates.
-
Key Information:
-
The dataset 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.
-
Contains: license code, purchase date, expiration date, order reference number, etc.
-
-
Available fields:
Field Name | Type | Description |
---|---|---|
EVENT_DATE | TIMESTAMP_TZ | A snapshot of the subscription at EVENT_DATE. |
LICENCE_CODE | VARCHAR | Unique subscription identifier. |
PREVIOUS_EXPIRATION_DATE |
TIMESTAMP_TZ | Expiration date of the subscription in case the current snapshot is taken after a renewal. Can be NULL if snapshot is taken after an acquisition and before any renewal. |
EXPIRATION_DATE | TIMESTAMP_TZ | Expiration date of the subscription at EVENT_DATE. |
IS_AUTORENEWING | BOOLEAN | True if the subscription's next renewal is automated, false if it’s manual. |
STATUS | VARCHAR |
The status of the subscription at EVENT_DATE.
Possible values:
|
AUTORENEWAL_DISABLE_REASONS | VARIANT | Reasons for disabling auto-renewal. |
AUTORENEWAL_DISABLE_DATE | TIMESTAMP_TZ | Date auto-renewal was disabled. |
AUTORENEWAL_DISABLE_SOURCE | VARCHAR | The origin of the action that disabled the automatic renewal of a subscription. |
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 |
The origin of the action that led to the deactivation or disabling of the subscription. It identifies the system or user interface responsible for terminating the subscription lifecycle.
Possible values:
|
INITIAL_PURCHASE_DATE | TIMESTAMP_TZ | Date of the first purchase of the subscription. |
PRODUCT_CODE | VARCHAR | Catalog product code. |
PAYMENT_METHOD_ON_FILE | VARCHAR | The active stored payment method (e.g., credit card, PayPal, SEPA, digital wallet) that is securely tokenized and used to charge the customer for current or future transactions under a subscription or account. |
IS_TRIAL | BOOLEAN | True for trial subscriptions, false otherwise. |
IS_LIFETIME | BOOLEAN | True if the subscription is evergreen, or 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_REFNO | 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 billing cycle of the subscription active at EVENT_DATE. |
PREVIOUS_REFNO | NUMBER | ID of the order before the most recent before EVENT_DATE. Can be null in case of a new acquisition. |
PREVIOUS_PRODUCT_ID | NUMBER | Product ID of the product purchased in the order identified as PREVIOUS_REFNO. Can be different from CURRENT_PRODUCT_ID if an upgrade occurred on the subscription in the order identified with the CURRENT_REFNO. |
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 | 2Checkout internal customer identifier. |
NEXT_RENEWAL_PRICE | FLOAT | Renewal price for the billing cycle starting after EVENT_DATE. |
NEXT_RENEWAL_PRICE_CURRENCY | VARCHAR | Renewal currency for the billing cycle starting after EVENT_DATE. |
RENEWAL_COUNTER | NUMBER | The number of renewals completed before EVENT_DATE. |
Customer events
-
Purpose: Analyze customer-specific metrics such as CLV (Customer Lifetime Value).
-
Key Information:
-
This dataset 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.
-
Contains: customer ID, demographics (email, name), lifetime value, etc.
-
-
Available fields:
Field Name | Type | Description |
---|---|---|
CUSTOMER_ID | NUMBER | 2Checkout internal customer identifier. |
ACCOUNT_ID | NUMBER | Vendor ID. |
ADDRESS_DELIVERY | VARCHAR | Address for codes delivery. |
CITY | VARCHAR | Customer city as found in the billing information. |
COMPANY | VARCHAR | Company name. |
COUNTRY_CODE | VARCHAR | Country code from the billing details. |
CREATION_DATE | TIMESTAMP_TZ | Customer creation date. |
VARCHAR | Customer’s email address. | |
EMAIL_DELIVERY | VARCHAR | Email address for delivery. |
EVENT_DATE | TIMESTAMP_TZ | Date of the event that generated the current snapshot of the entity. |
EXTERNAL_CUSTOMER_ID | VARCHAR | External customer ID. |
FIRST_NAME | VARCHAR | First name as found in the billing information. |
FIRST_NAME_DELIVERY | VARCHAR | First name as found in the delivery information. |
FISCAL_CODE | VARCHAR | Company VAT ID/Tax ID. |
LAST_NAME | VARCHAR | Customer last name as found in the billing information. |
LAST_NAME_DELIVERY | VARCHAR | Last name as found in the delivery information. |
PHONE | VARCHAR | Customer's phone number. |
STATE | VARCHAR | Customer's state. |
STATUS | VARCHAR |
Customer status at EVENT_DATE. Possible values:
|
TAX_OFFICE | VARCHAR | Tax office code. |
ZIP | VARCHAR | Zip code. |
CUSTOMER_LIFETIME_VALUE | VARCHAR | The total revenue the customer has generated from the start of their lifecycle up to EVENT_DATE. |
CUSTOMER_LIFETIME_VALUE_CURRENCY | VARCHAR | Currency the CUSTOMER_LIFETIME_VALUE is expressed in. |
Orders events
- Purpose: Use this dataset to calculate average order value, refund amounts, or chargebacks.
- Key Information:
- This dataset stores events (meaning that there will be more than 1 entry for the same order).
- Contains: order reference number, refunds, chargebacks, taxes associated with the whole order, commissions, etc.
- Available fields:
Field Name | Type | Description |
---|---|---|
ACCOUNT_ID | NUMBER | Vendor ID. Can't be null. |
AFFILIATE_ORDER_COMMISSION | VARCHAR | Amount paid to affiliate for enabling the sale (applied to the whole order). |
AFFILIATE_ID | VARCHAR | Unique identifier used to track the source of a transaction that was referred to your platform via an affiliate partner. It links revenue to specific affiliates for commission and attribution purposes. |
APPROVE_STATUS | VARCHAR |
Order status:
|
COMMISSION | VARCHAR | 2Checkout commission for processing the sale. |
CARD_EXPIRATION_DATE | VARCHAR | Card expiration month and year. |
CARD_LAST_DIGITS | VARCHAR | The last 4 digits of the shopper credit/debit card. |
CARD_TYPE | VARCHAR |
The card type used by the shopper.
|
CHARGEBACK_CLOSE_REASON | VARCHAR |
Possible values:
|
CHARGEBACK_CLOSED_DATE | VARCHAR | Date when chargeback received a resolution. |
CHARGEBACK_OPEN_DATE | VARCHAR | Date when chargeback was opened by shopper. |
CHARGEBACK_OPEN_REASON | VARCHAR |
Possible values:
|
COMPLETE_DATE | VARCHAR | Date when order was completed. |
COUNTRY | VARCHAR | Billing country of the shopper. |
CURRENCY | VARCHAR | Sale currency. |
ORDER_DISCOUNT | VARCHAR | Discounted amount applied to the order. |
ORDER_EXCHANGE_RATE | VARCHAR | Exchange rate between vendor currency and currency the order was paid in at the moment the order was paid. |
INVOICE | VARCHAR | Shopper invoice number. |
EVENT_DATE | TIMESTAMP_TZ | The date and time when a change happened on the order entity. |
ORDER_DATE | VARCHAR | Date when order was placed. |
ORDER_DISCOUNT_CODE | VARCHAR | Order promotion code set by vendor in Control Panel. |
ORDER_DISCOUNT_NAME | VARCHAR | Order promotion name. |
ORDER_DISCOUNT_PRICE | VARCHAR | It should always have a negative value, as it represents the amount deducted from the whole order price calculated in cart at the order placement time. |
ORDER_DISCOUNT_TAX | VARCHAR | It should always have a negative value, as it represents the amount deducted from the taxes calculated in cart at the order placement time. |
ORDER_FLOW | VARCHAR |
Possible values:
|
ORDER_STATUS | VARCHAR |
Current order status.
|
ORDER_ORIGIN | VARCHAR |
Possible values:
|
PARTNER_CODE | VARCHAR | Set by vendor. If available, it means that the order was placed via a vendor's reseller. |
PARTNER_ID | NUMBER | 2checkout platform reseller identifier. |
PAYABLE_AMOUNT | VARCHAR | Order amount payable to vendor displayed in vendor's accounting currency. |
PROFIT_GROSS | VARCHAR | Order amount payable to vendor displayed in vendor's accounting currency. |
REFNO | VARCHAR | 2Checkout order reference number. |
REFUND_COMMENT | VARCHAR | Free text comment placed by shopper when requesting a refund. |
REFUND_DATE | VARCHAR | Date when refund order is completed. |
REFUND_REASON | VARCHAR |
Refund reason if one was specified in the refund request by shopper. Will be classified in one of the following categories when refund is processed:
|
REFUND_TOTAL | VARCHAR | Amount refunded. |
REFUND_TYPE | VARCHAR |
Possible values:
|
SHIPPING | VARCHAR | Shipping costs expressed in the same currency as the field CURRENCY. |
SRC | VARCHAR | Issued by vendor. |
TEST_ORDER | VARCHAR | This order is a test. |
ORDER_PRICE | VARCHAR | Order total price. |
Subscription orders events
-
Purpose: Use this table for product/license prices, discounts, and taxes, or to reach out to customers to ask them to update payment details
-
Key Information:
-
This dataset stores events (meaning that there will be more than 1 entry for the same order).
-
If there are more products in one order, then more rows are associated with the same REFNO.
-
Contains: order reference number, product IDs, customer data, payment type, card expiration date
-
-
Available fields:
Field Name | Type | Description |
---|---|---|
ACCOUNT_ID | NUMBER | Vendor ID. Can't be null. |
AFFILIATE_PRODUCT_COMMISSION | VARCHAR | Amount paid to affiliate for enabling the sale of that product. |
AFFILIATE_ID | VARCHAR | Unique identifier used to track the source of a transaction that was referred to your platform via an affiliate partner. It links revenue to specific affiliates for commission and attribution purposes. |
CARD_EXPIRATION_DATE | VARCHAR | Card expiration month and year. |
CARD_LAST_DIGITS | VARCHAR | The last 4 digits of card PAN. |
CARD_TYPE | VARCHAR |
The card type used by the shopper.
|
COUNTRY | VARCHAR | Billing country. |
CURRENCY | VARCHAR | Sale currency. |
EXPIRATION_DATE | VARCHAR | Subscription expiration date. |
CUSTOMER_ID | VARCHAR | 2Checkout internal customer identifier. |
EXTERNAL_CUSTOMER_ID | VARCHAR | Vendor customer ID. |
IMPORTED | VARCHAR | The subscription was imported to the 2Checkout platform. |
LAST_ORDER_CURRENCY | VARCHAR | Previous order currency. |
LAST_ORDER_PRICE | VARCHAR | Previous order price. |
EVENT_DATE | TIMESTAMP_TZ | The date and time when a change happened on the order entity to which the subscription pertains. |
ORIGIN | VARCHAR |
Possible values:
|
PRODUCT_PRICE | VARCHAR | Unit catalogue price of the product in order (sometimes excluding taxes). |
PRODUCT_CODE | VARCHAR | Catalogue product code. |
PRODUCT_DISCOUNT | VARCHAR | Discount amount applied to a product in an order. The amount is calculated by applying the discount percentage to each unit price and multiplying by quantity. |
PRODUCT_EXTERNAL_REFERENCE | VARCHAR | Product identifier in vendor's system. |
PRODUCT_ID | VARCHAR | Product identifier in the 2Checkout system. |
PRODUCT_NAME | VARCHAR | The name given to the product. |
PRODUCT_PROMOTION_CATEGORY | VARCHAR |
Possible values:
|
PRODUCT_PROMOTION_CODE | VARCHAR |
Promotion code automatically generated when creating a promotion. Example code: XKN53JVEHD |
PRODUCT_PROMOTION_COUPON | VARCHAR |
Promotion coupon offered to shopper and applied in cart. Example: 10OFF |
PRODUCT_PROMOTION_NAME | VARCHAR | Promotion name given by vendor when creating it in Control Panel. |
PROMOTION_TYPE | VARCHAR |
Possible vales:
|
PURCHASE_DATE | VARCHAR | Date when license was initially purchased. |
QUANTITY | VARCHAR | Number of seats per license in order in eCommerce. |
IS_AUTORENEWING | BOOLEAN | True if the subscription next renewal is automated, false if it’s manual. |
REFNO | VARCHAR | 2Checkout order reference number. |
REFUND_REASON | VARCHAR |
Refund reason if one was specified in the refund request by shopper. Will be classified in one of the following categories when refund is processed:
|
CURRENCY | VARCHAR | Currency of the order amount. |
SHIPPING | VARCHAR | Shipping costs expressed in the same currency as the field CURRENCY. |
SHIPPING_TAX | VARCHAR | Product specific. |
SRC | VARCHAR | Issued by vendor; examples look like affiliate referral IDs. |
LICENSE_CODE | VARCHAR | License code. |
SUBSCRIPTION_START_DATE | VARCHAR | The date the subscription became active. |
TAX | VARCHAR | Tax associated to each product paid by the shopper. |
Exchange rate events
- Purpose: Allows conversion from one currency to another based on historical rates.
- Key Information:
- Each row contains exchange rates from one currency to another for each day starting 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. |
PayPal Credit
Overview
PayPal Credit is an open end (revolving), reusable line of credit that when approved, will automatically be added to the shopper’s PayPal account.
With PayPal Credit, the shopper can enjoy the flexibility to pay overtime for everyday purchases. PayPal Credit can be used just about anywhere PayPal is accepted online. PayPal Credit is subject to credit approval and is issued by Synchrony Bank.
How to apply for PayPal Credit
When a shopper applies for PayPal Credit, they’ll be asked to provide the date of birth, net income after taxes, the last 4 digits of the Social Security number and agree to the Terms and Conditions. The shopper will be provided any required disclosures in electronic form. The shopper will know within seconds if they are approved. If approved, the PayPal Credit payment instrument will automatically appear in the PayPal account where the shopper can start to use it right away.
PayPal Credit is subject to credit approval and is offered by Synchrony Bank.
Availability
PayPal Credit is currently available for US residents who are of legal age in their state of residence.
Supported currencies: USD
Supporting recurring payments: Yes
Benefits
- Increased conversion rates - buy now, pay later (BNPL) options like PayPal Credit reduce friction at checkout by allowing customers to defer payments.
- Higher average order value (AOV) - Customers using PayPal Credit often spend more per transaction, boosting AOV.
- Immediate payment to vendors as they are paid upfront and in full by PayPal, while PayPal handles customer financing and collections. No additional risk or delay in funds settlement for the merchant.
Activate PayPal Credit
Steps to activate PayPal Credit in Control Panel:
- Navigate to Dashboard.
- Go to Setup.
- Click on Ordering options.
- Click on Payment methods.
- Activate PP Credit from the list.
Shopper flow
- The shopper initiates an online purchase.
- Once the products for purchase are selected, the 2Checkout checkout page will be displayed.
- The shopper selects PayPal Credit as a payment method and continues the checkout process.
- On the confirmation page, the shopper clicks on the PayPal Credit button.
- The shopper logs into it’s PayPal account.
- Shopper selects PayPal Credit as the payment option.
- If the shopper has not yet applied for PayPal Credit, they will follow an application process.
- If the shopper has already applied for PayPal Credit, they place the order by clicking the Continue to Review Order button.
- Once all steps are completed, the Finish page is displayed, as the order is confirmed.
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:
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.
- Click to create a new tag.
-
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>
- As Triggering select All Pages.
B. Create a User-defined variable in Google Tag manager called “ecommerce”
- Click on New, to create a new user-defined-variable.
- As Variable Type, select Data Layer Variable.
- As Data Layer Variable Name, add ecommerce in the field.
- As Data Layer Version select Version 2.
C. Create a User-defined variable in Google Tag Manager for Facebook called ConvertPlus - FacebookEventsScript
- Click on New to create a new user-defined-variable.
- As Variable Type select Custom JavaScript.
-
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.
- As Trigger Type, select Custom Event.
- As Event name, type purchase.
- For this trigger to fire on, select All Custom Events.
E. Create a tag for the Facebook Pixel for the purchase event
- Create a new tag named for example Facebook Purchase ConvertPlus.
- As Tag Type select Custom HTML.
-
In the HTML section, paste the following code:
<script> fbq('track', 'Purchase', {{ConvertPlus - FacebookEventsScript}},{eventID: {{ecommerce}}.transaction_id}); </script>
- For Triggering, select the Trigger for Event Ecommerce Purchase only, the trigger that is only restricted to 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 purchase event and name it Event Ecommerce Checkout Only.
- As Trigger Type, select Custom Event.
- As Event name, type begin_checkout.
- For this trigger to fire on, select All Custom Events.
Create a tag for the Facebook Pixel for the checkout event
- Create a new tag named for example Facebook Checkout ConvertPlus.
- As Tag Type select Custom HTML.
-
In the HTML section, paste the following code:
<script> fbq('track', 'InitiateCheckout', {{ConvertPlus - FacebookEventsScript}}); </script>
- For Triggering, select the Trigger for Event Ecommerce Checkout only, the trigger that is only restricted to the checkout event.
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.
- Click to create a new tag.
-
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>
- As Triggering select 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.
- 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.- 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.
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. - 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. - 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. - 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. - 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. - 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.
- Create a variable called gtag4.event in Google Tag Manager
C. Create a User-defined variable in Google Tag Manager for Facebook called FacebookEventsScript
- Click on New to create a new user-defined-variable.
- As Variable Type select Custom JavaScript.
-
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.
- As Trigger Type, select Custom Event.
- As Event name, type 2checkout event.
- For this trigger fires on, select Some Custom Events.
- Add the condition that variable gtag4.event equals purchase.
E. Create a tag for the Facebook Pixel for the purchase event
- Create a new tag, named, for example Facebook Purchase.
- As Tag Type select Custom HTML.
-
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>
- For Triggering, select the Trigger for Event Ecommerce Purchase only, the trigger that is only restricted to 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.
- As Trigger Type, select Custom Event.
- As Event name, type 2checkout event.
- For this trigger to fire on, select Some Custom Events.
- Add the condition that variable gtag4.event equals checkout.
Create a tag for the Facebook Pixel for the checkout event
- Create a new tag, named, for example Facebook Checkout.
- As Tag Type select Custom HTML.
-
In the HTML section, paste the following code:
<script> fbq('track', 'InitiateCheckout', {{FacebookEventsScript}}); </script>
- For Triggering, select the Trigger for Event Ecommerce Checkout only, the trigger that is only restricted to the checkout event.
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).
Availability
ITE is available to all 2Checkout accounts.
Disclaimer: Although ITE is also available on PSP, the data exported is from 2Checkout's tax engine and is representative of the regions where 2Checkout is registered for tax remittance. Taxes may differ for you depending on your applicable fiscal laws.
If you are interested in 2Checkout calculating and collecting the taxes for your PSP account, consult our Tax calculator documentation.
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: |
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: |
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. |