Skip to main content

API Reference

This is a summary of the objects/classes and methods available.

2Pay.js - Payments Solution

Overview

The 2Pay.js Javascript library is a quick and secure way to collect sensitive credit card payments, using customizable UI components that give merchants full control over the checkout experience. It allows merchants to create seamless payment flows while keeping the need for PCI compliance to a minimum SAQ A level. This means that shoppers pass sensitive payment information directly to the 2Checkout platform without sharing their credit card details with the merchant.

Availability

The 2Pay.js payments solution is available for all 2Checkout merchants who already use or want to use the 2Checkout API integration, no matter what business model they have. 

Requirements

To benefit from the 2Pay.js solution, merchants need to be integrated with the 2Checkout API and use the latest version - API 6.0

Merchants with <20,000 transactions/year are recommended to have an SAQ-A filled in, but merchants >20,000 transactions are required to do so.

 

   To maintain reduced PCI scope, it is mandatory to always include the 2pay.js library hosted on 2Checkout’s servers. Do not use bundle libraries that contain 2pay.js or host a copy of the 2pay.js library from your own servers as this increases your PCI requirements.

Benefits

The 2Pay.js solution brings multiple benefits for both merchants and shoppers:

  • Improved payment processing with a more secure and compliant system
  • Full-cart ownership for merchants as they don't need to handle customer data, by tokenizing the payment information for them
  • Reduced complexity for the PCI DSS validation process via an SAQ-A self-questionnaire​
  • Improved security for shoppers, who will pass sensitive payment data directly to the 2Checkout platform, thus bypassing the merchant's systems.

Activation

2Pay.js can be implemented by merchants via a JavaScript library that allows them to include the payment fields at checkout without the need to handle shoppers' credit card data in any way, as shown by the steps below:

  • Merchants include a few lines of code in the interface where they need to collect payment information.​
  • Merchants will run a JS library that will replace the input fields with iframes
  • The iframes will collect and send shoppers' card data directly to the 2Checkout​ platform

How it works

Triggering an order with 2Pay.js will work like any other order placed via API​: the JavaScript library will pass the credit card data to the 2Checkout system and it will return a payment token​. The API order is placed using the payment token​.

  1. The merchant runs a JavaScript library that will change the billing form by replacing the input fields with iframes. This way the data is sent directly to the 2Checkout system.​
  2. In return, the merchant receives a token for the saved credit card information from the 2Checkout platform.​ The token is valid for 10 minutes. 
  3. The merchant submits the billing information and the payment token via the 2Checkout API.​
  4. The 2Checkout platform matches the token with the card data, extracts the card data and authorizes the payment, and stores the card in the vault. ​
  5. The merchant then redirects the customer to the Order Confirmation page​.
  6. Once the order is approved, the merchant receives a notification from the 2Checkout platform.
  7. Finally, the 2Checkout system sends a notification once the payment is settled.​

Use cases

See here some use cases for the 2Pay.js implementation.

FAQ

1. What payment methods are available for use with the 2Pay.js library?

All API version 6 accepted credit cards can be used with the 2Pay.js library.

2. What integrations does 2Pay.js support?

2Pay.js was developed for integration within web sites so that it allows full seamless integration with the merchants' checkout flow.

3. Does 2Pay.js support 3D Secure version 2?

While 2Pay.js does not need 3D Secure support, the integration for this security check is done via API once the order is placed with the payment token. More information about the 3DS flow in the API can be found here.

4. How can I include the N/A value in the required API fields?

You can easily include the N/A value in the required API fields as shown below:

// For US:

"BillingDetails": {
    "Address1": "N/A",
    "City": "n/a",
    "CountryCode": "US",
    "Email": "customer@2Checkout.com",
    "FirstName": "Customer",
    "FiscalCode": null,
    "LastName": "2Checkout",
    "Phone": "N/A",
    "State": "NY",
    "Zip": "10075"
  },


// For the rest of the world:

"BillingDetails": {
    "Address1": "N/A",
    "City": "n/a",
    "CountryCode": "RO",
    "Email": "customer@2Checkout.com",
    "FirstName": "Customer",
    "FiscalCode": null,
    "LastName": "2Checkout",
    "Phone": "N/A",
    "State": "N/a",
    "Zip": "N/A"
  },

Integrate WHMCS

Overview

WHMCS is an all-in-one Content Management System including client management, billing & support solution for online businesses and web hosts.​

Merchants can use the WHMCS connector to integrate with 2Checkout and process orders via ConvertPlus, InLine Checkout, and 2Pay.js, and provide an improved experience to their shoppers.​

Availability

The WHMCS integration is available only for 2Checkout accounts that handle their own tax and invoice management (2Sell and 2Subscribe accounts). 

WHMCS Settings

Regardless of the fact that you are already using the WHMCS connector or you want to start using it to integrate with 2Checkout, you need to follow the steps below:

  1. Download the 2Checkout payment module from GitHub by clicking on the Code button and then on Download ZIP.

whmcs_github.png

2. Sign in to your WHMCS admin panel.

3. Navigate to Setup → Payments and click on Payment Gateways.

whmcs integration with 2Checkout_1.png

4. On the Payment Gateways page, click on the All Payment Gateways tab.

whmcs integration with 2Checkout_2.png

5. On the All Payment Gateways page, select 2Checkout's ConvertPlus, InLine Checkout, and API Gateway (2Pay.js).

whmcs integration with 2Checkout_3.png

6. Go to Manage Existing Gateways and configure each cart option by adding the required information from your 2Checkout Merchant Control Panel.

whmcs integration with 2Checkout_4.png

  • Tick the Show on Order Form box if you want this information to be displayed on the order 
  • Add the Merchant Code
  • Add the Buy-Link Secret Word
  • Add the Secret key
  • Tick Test Mode if you wish to enable it. This allows you to place test orders using test payment methods, to check your integration with 2Checkout.
  • Tick the Skip 2CO Fraud Check box, if you want to mark invoices as paid without waiting for the 2Checkout fraud review
  • Add Reasons for Refunds
  • Click on Save Changes
  1. The Merchant Code is your 2Checkout Merchant Code that you can obtain by logging in to your Merchant Control Panel and navigating to Integrations → Webhooks & API. 
  2. To find the Buy-Link Secret Word, log  in to your 2 Checkout Merchant Control Panel and navigate to Integrations → Webhooks & API → Secret Word . Edit your INS Secret Word to match the Buy-Link Secret Word , copy the value and paste it in the WHMCS admin panel.
  3. The Secret key can be found in your 2Checkout Merchant Control Panel, right next to the Merchant Code. Copy and paste it in your  WHMCS admin panel.

INS secret word.png

whmcs integration with 2Checkout_5.png

Since WHMCS does not support special characters, but only letters (a-z) and digits, you can use a code generator to obtain a Secret Word that needs to be saved both in the 2Checkout Control Panel and the WHMCS admin. 

2Checkout Settings

Follow the below instructions to finalize the WHMCS integration process.

  1. Sign in to your 2Checkout Merchant Control Panel account.
  2. Navigate to Dashboard → Integrations → Webhooks & API section
  3. Follow these steps to activate Redirect URL:

4. In the Webhooks and API section, under the Instant Notification Service (INS) card, check the Enable Global URL box. 

whmcs integration with 2Checkout_6_INS.png

5. Enter http://www.yourdomain.com/whmcs/modu.../2checkout.php as the global endpoint URL.

6. Click on Update to save your changes.

7. Make sure to enable the IPN webhook notification in your Merchant Control Panel

  • Log in to the 2Checkout Merchant Control Panel and navigate to Integrations → Webhooks & API
  • Scroll down to the Notifications section and select IPN or Email Text & IPN from the drop-down, and then click on the Configure IPN button
  • On the IPN Settings page, click on Add IPN URL
  • Input the IPN URL available in the configuration page in the WHMCS admin, and click on Add IPN

whmcs integration with 2Checkout_7_IPN.png

  • After adding the IPN URL, the URL should be displayed in the IPN URLs section in your Merchant Control Panel.

whmcs integration with 2Checkout_8_IPN.png

  • Enable all triggers and response tags

set_up_IPN_in_merchant_control_panel_4.png

About WHMCS

WHMCS is an all-in-one client management, billing & support solution for online businesses. Handling everything from signup to termination, WHMCS is a powerful business automation tool that puts you firmly in control.

For more information visit: WHMCS.com

      Integrate Ecwid

      Availability

      Ecwid integration is available only for 2Checkout accounts that handle their own tax and invoice management (2Sell and 2Subscribe accounts). 

      Ecwid settings:

      1. Create a new 2Checkout account
      2. Go to Ecwid Control Panel → Payment
      3. Scroll down to Other ways to get paid
      4. Click Choose Payment Processor to see the list of payment gateways available for your country
      5. Select 2Checkout from the drop-down menu
      6. You will see 2Checkout Account Details. Find and copy your Approved and INS URL and save it somewhere as you will need it later

      2Checkout settings:

      1. Go to your 2Checkout Merchant Account
      2. Navigate to Dashboard → Integrations → Webhooks & API
      3. In the Redirect URL section, set the Return Method to “Header redirect”
        • In the Approved URL field, paste the “Approved and INS URL” that you copied earlier from your Ecwid control panel
        • Click Update to save the changes
      4. In the Instant Notification System (INS) section:
        • Select Enable INS and Enable global URL and paste the value of “Approved and INS URL” you saved earlier
        • Click Update to save the changes
      5. In the Secret word section:
        • Make sure both the INS secret word and the Buy-link secret word are set to the same value and copy it
      6. Return to the 2Checkout Account Details in your Ecwid control panel
      7. Enter your 2Checkout account number (Merchant Code) and the INS secret word
      8. Scroll to Appearance options and enable this payment method

      About Ecwid

      Ecwid is a cloud-based e-commerce platform that helps to easily create a bold, easy to use online store and start selling anywhere online or in-person. Ideal for small and medium sized businesses. Ecwid can be seamlessly integrated with your existing website, business page on a social network, your blog, marketplaces or mobile app. All the storefronts are synced and managed from one control panel. Ecwid lets you organize your products, customize your storefront, accept credit card payments, track and respond to orders — all with a few clicks of the mouse. Find out more about Ecwid here.

       

       

      Dispute balance

      Overview

      Disputes Balance is a financial mechanism designed to manage the funds of order transactions for which customers disputed the charges made using their credit / debit card or PayPal.

      When shoppers initiate chargebacks, the equivalent of the disputed charges is debited from 2Checkout's bank account. Disputed charges are also reflected in the 2Checkout system and the funds paid by shoppers for disputed transactions are retained in the Disputes Balance. Once a chargeback resolution is reached, the disputed charges are released from the Disputes Balance.

      How 2Checkout calculates Dispute Balance amounts

      Disputes Balance amounts are calculated by deducting affiliate commissions and taxes from the total order amount (the costs incurred by shoppers). Disputes Balance amounts include 2Checkout processing fees.

      2Checkout charges commissions for the initial transactions associated with orders refunded as a result of chargeback disputes initiated by shoppers.

      Dispute balance process flow

      1. Customers can dispute charges to their credit/debit cards or PayPal claiming reasons such as:
        • Order not fulfilled/not delivered
        • Product(s) not as described/unfunctional
        • Duplicate order
        • Fraud/Order not recognized: Customers claim that they don't recognize the charge
        • Agreed refund not processed
        • New/renewal order not recognized
        • Authorization problem
        • Information request
      2. 2Checkout is informed by the shopper bank or by PayPal of the chargeback initiated and the dispute is also reflected into the system. The disputed amount is debited from 2Checkout's bank account.
      3. 2Checkout retains the funds associated with disputed orders, adding the value to the Disputes Balance.
      4. 2Checkout works with the shopper bank or PayPal to resolve the disputes in your favor until a resolution is reached.
      5. There are two possible outcomes to this process:
        • You win the dispute, in which case the funds retained are released from the Disputes Balance and paid to you with the next due payment.
        • You lose the dispute , in which case the funds retained are also released from the Disputes Balance. Refunds are issued reflecting the money paid back to shoppers. As is the case with all refunds, the order processing commissions received by 2Checkout will not be returned to you.

      Dashboard account balance information

      The account balance report on the 2Checkout dashboard shows information on the Disputes Balance from the moment of the last payment you received from 2Checkout.

      • Retained to Disputes Balance - the value of all disputed charges retained for chargebacks initiated in the report period starting from the last payment you received from 2Checkout.
      • Released from Disputes Balance - the value of all disputed charges released for chargebacks closed in the report period starting from the last payment you received from 2Checkout.

      Disputes Balance email

      Disputes Balance data is reported using a standalone notification in addition to the 2Checkout Sales Report you receive each payment cycle. This email report details only the amounts retained and released from Disputes Balance.

      The 2Checkout Sales Report also includes Disputes Balance information in addition to refund info.

      Accounting Summary

      This report centralizes payment data, including upcoming transfers.

      • Balance represents an estimated value of the funds you're due to receive on the next payment.
      • Overall Disputes Balance represents the total value of unresolved disputed charges for complete orders that 2Checkout retains until a chargeback resolution is reached (Released Disputes Charges are deducted from the Overall Disputes Balance). Released Disputes amounts for transactions in non-payment currencies are reported in your account's default payment currency.
      • Retained to Disputes Balance - the value of all disputed charges retained for chargebacks initiated in the report period starting from the last payment you received from 2Checkout.
      • Released from Disputes Balance - the value of all disputed charges released for chargebacks closed in the report period starting from the last payment you received from 2Checkout.

      Products report

      The report provides an overview of the most in-demand products in your portfolio, for specific periods of time. It uses exchange rates valid on the day you generate it and can aggregate orders from the following sales channels: direct, Affiliate Network, Network Cross-Sales and Distribution Partners.

      The report gathers data from finished orders, not taking into account refunds.

      Two sorting options are available: Total products and Total amount.

      • Selecting Total products lists best-selling products, quantity-wise, while also displaying total per product information (the total amount generated by a single product through sales).
      • The Total amount option lists top-selling products organized according to revenue generated through sales (total per product values), with the quantity of sold items not reflected in the hierarchy, even though displayed.

      Selecting All currencies causes all order currencies to be converted to the default currency configured for the account. The 2Checkout exchange rate from the day when the Products Report is generated will be used.

       

      Use the Order type option to filter product sales based on the order type:

      • New acquisitions
      • Renewals (manual and automatic subscription renewals)
      • Upgrades
      • Trials (trial orders for which customers provided their credit card information)

       

      Exported CSV reports include the following information.

      Field name Description

      Product name

      The name of products sold in the selected report interval.

      Products

      Number of product units sold in the selected report interval, including new orders, trials, renewals and upgrades.

      Total per product

      The total costs incurred by shoppers per product.

      Currency

      Selected billing currency.

      Upgrades

      Number of upgrades sold in the selected report interval.

      Total per upgrades

      The total costs incurred by shoppers for upgrades.

      Renewals

      Number of renewals sold in the selected report interval.

      Total per renewals

      The total costs incurred by shoppers for renewals.

      Trials

      Number of trials accessed in the selected report interval.

      Total per trials

      The total costs incurred by shoppers for trials.

      New orders

      Number of new orders in the selected report interval.

      Total per new orders

      The total costs incurred by shoppers for new acquisitions.

      Purchase flows

      Overview

      Shoppers place orders through 2Checkout by using an ordering/checkout interface. 2Checkout offers a collection of purchase flows/funnels, enabling you to control the complexity of the ordering process, from the first page in which customers land to the final stage of the purchase. Use specific query parameters to control the purchase flow in combination with Buy Links.

      Availability

      Available to all 2Checkout accounts.

      Purchase Flows

      Buy-link

      Description

      https://secure.2checkout.com/order/checkout.php?CART=1
      

      Checkout with cart functionalities 
      Shoppers land on the billing page with the shopping cart functionalities enabled. All marketing tools are also available (cross-selling, backup media, etc.)

      https://secure.2checkout.com/order/checkout.php?CART=1&CARD=2

      One page checkout without review 
      Shoppers get an all-in-one page experience: a shopping cart, a billing form, marketing tools, and the payment form (credit card and PayPal Express Checkout). They place orders without being directed to any other pages of the shopping cart.

      https://secure.2checkout.com/order/checkout.php?CART=1&CARD=1

      One page checkout with review 
      Shoppers get an all-in-one page experience: a shopping cart, a billing form, marketing tools, and a credit card form. Plus a review page from which they can place orders. 

      https://secure.2checkout.com/order/cart.php

      Add to Shopping Cart 
      Shoppers add the selected product(s) to the shopping cart where they can modify quantities, add additional services (Backup Media, Download Insurance Service) or select more products from the cross-selling options.

      https://secure.2checkout.com/order/checkout.php

      Checkout page 
      Shoppers land on the billing page having the product options already added to their shopping cart. 

      https://secure.2checkout.com/order/product.php

      Product page 
      Shoppers see all product details (descriptions, pricing options, etc) before proceeding to the ordering process. More than one product can be selected, resulting in a "one page" online shop.

      https://secure.2checkout.com/order/download.php

      Download trial 
      Shoppers fill in the download form (based on your settings) before downloading the trial version of the selected product.

      https://secure.2checkout.com/order/trial.php

      Paid trial

      Use this to offer trial subscriptions for products, either free or at an extra charge. After the trial period expiration, clients are automatically charged with the full value of the product, unless they choose to cancel. The "Checkout page" purchase flow is used.

      CART and CARD parameters can also be used with trial links.

       

       

      API Requests

      Overview

      Perform easy account management via API Requests. The 2Checkout API portfolio contains extended capabilities that can help you automate processes as: creating products or promotions, placing orders (both with catalog and dynamic product information), issuing refunds, retrieving the shipping price for an order, handling subscriptions and many others.

       

      Lead management

      Overview

      2Checkout's lead management introduces a smart and easy way to reduce customer churn and gain useful insights into what drives customers to cancel automatic renewals. Use order recovery follow-up emails to reduce unfinished payment and cart abandonment rates with up to 20% by learning how to configure lead management campaigns. 

      You can use lead management to:

      • run a report on unfinished payments
      • send abandoned shopping cart follow-up emails
      • request invoices

      Lead management Control Panel

      Custom reports

      Overview

      Custom reports help you extract account activity data through a series of predefined filters. You can use the default custom reports provided by 2Checkout or you can create your own.

      You can use the following default custom reports:

      1. Currency breakdown. Top 5 currencies based on gross value across all your sales channels in the current month. Includes VAT, sales tax and refunds.
      2. Quarterly Revenue. Quarterly comparison of net income across all your sales channels in the last 12 months compared to the previous 12 months.
      3. Yearly Comparison. Weekly split of top customer languages based on the number of products sold in the current month, compared with the same period last year.
      4. Sales By Source (SRC) - this year. Weekly split of top 5 sales sources in the current month.
      5. Net Income from Renewals. Total net income from automatic and manual renewals in the current month.
      6. Monthly orders. Monthly comparison of the number of orders across all your sales channels for the last 12 months, compared to the previous 12 months.
      7. Sales by Region. Top 3 geographic regions based on net sales in the last 12 months. VAT and taxes not included.
      8. Sales by Channel - Last 12 Months. Monthly comparison of the top 5 sales channels based on net sales for the last 12 months compared to the previous 12 months. VAT and taxes not included.
      9. Products Sold - Last 12 Months. Monthly comparison of the top 5 products sold in the last 12 months compared to the previous 12 months.

      To access the Custom Reports section go to Reports center -> Custom reports.

      Creating a custom report

      Follow the steps below to create your own custom report.

      1. Go to Reports center -> Custom reports and click New custom report. Enter a unique name to easily identify the new report.
      2. Select a Report type.
        • Gross Sales (includes VAT, shipping, commissions and sales tax)
        • Net Sales (does not include VAT and other tax, otherwise it's the same as Gross Sales)
        • Net Income (includes earnings generated from shipping but excludes discounts, taxes such as VAT, commissions, 2Checkout fees)
        • Number of Orders
        • Number of Products​​
      3. Define the advanced filters based on your needs
      4. Click Build report.
      5. Click Save report to save the new custom report to use it later. You can find it in the Custom reports section. The latest reports created are listed first and marked in blue in the Custom reports area, with the 2Checkout default custom reports displayed last and marked in red. Once you save a report, you have the option to delete it, modify it and save it as a new report, schedule it to run at predefined intervals and email the results to recipients of your choosing, or revert changes made without saving it as a new report.

      Report settings

      While editing custom reports you can configure multiple filters to aggregate data.

      1. Grouping (top 5 or less). You can group results by:
        • Products
        • Geographic regions
        • Countries
        • Sales channels
        • Order currencies
        • Customer languages
        • Sales sources
        • License types
        • Partners (if Channel Manager is active on your account)
        • Payment method​
      2. Display additional results - Builds the report displaying additional results in the Other column.
      3. Date. Custom reports are not generated in real time. These reports centralize data available starting with the day prior to the moment you generate the report. A report built on July 10, 2015 provides information starting with July 9, 2015, 11:59:59 PM (GMT+2:00) and stretching back to the mark you set via the date drop down menu.
      4. Compare to past. Compare your business performance in a given time interval with an interval of the same length, either immediately preceding it, or from the previous year.
      5. Divide period by. Depending on the selected time interval, you can divide it by:
        • Day (selected time interval is at least 1 day long)
        • Week (selected time interval is at least 2 weeks long)
        • Month (selected time interval is at least 2 months long)
        • Quarter (selected time interval is at least 2 quarters long)
        • Year (selected time interval is at least 2 years long).
      6. Aggregate reporting data for multiple accounts. Use the Accounts to include in report selector to specify which of the multiple accounts you own should the system extract data from when compiling the report. This option is only visible if you use multiple accounts.

      Advanced filters

      Product filters

      Select products, both Active and Disabled, and extra delivery services such as Backup Media and DIS (Download Insurance), to include in the report.

      Order and License filters

      Custom reports can centralize data for completed and refunded orders. Refunded orders count as positive for custom reports. If you check the Refunded orders box, the report calculates the total revenue, and subtracts the refunds. When an order is refunded, 2Checkout generates a new order with a negative value (reflecting the amount of the refund). The total number of orders is the sum of initial and refunded orders.

      Sales source (SRC). Select the sales sources to be included in the report. This filter only applies for less than 2000 available sales sources. If you have more than 2000 sources, all of them will be selected by default.

      The report can include the following subscription types:

      • New licenses (mobile and web)
      • Renewals (automatic and manual, based on the Orders Origin filter)
      • Upgrades
      • Trials
      • New licenses from trials (trial upgrades)

      Localization filters

      Filter the data included in the report based on:

      • Geographic regions
      • Countries
      • Order language

      Use the Show only the transactions converting to filter to build the report only with the transactions converting to the specified settlement currency.

      Currency conversion rates

      For each settlement currency, only the amounts settled in that currency are included. If your account only has one settlement currency, the report will convert all transactions from other billing currencies to that settlement currency.

      Note: If your account has EUR and USD as settlement currencies and uses EUR as default, selecting EUR as the settlement currency to display amounts will include orders settled in EUR and all other currencies, with the exception of USD. When selecting USD, the report only shows the orders settled in USD.

      Sales channel filters

      Filter the report data sales channel:

      • eStore
      • Affiliates Network
      • Network cross-selling (displayed only if the module is active)
      • Partners (specific partners can be selected) (displayed only if channel manager is active)

      You can select specific affiliates only if you have less than 100 active affiliates. If the number of affiliates you're working with exceeds 100 they will all be select by default.

      Scheduling reports

      You can schedule all custom reports to be performed automatically by 2Checkout system according to the privileges of the user configuring them. Once defined, the system will send out emails daily, weekly, monthly or quarterly including the report in PDF and/or CSV format.

      You can set the recipients' email address, name the scheduled report, enter a description, set the schedule, and select specific reports that you want delivered.

      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