Skip to main content

InLine Checkout methods and parameters

InLine Checkout methods and parameters

Last updated: 29-Feb-2024
Rate this article:

Overview

Minimize your customers' effort by collecting their order/billing information and passing it to InLine Checkout. Simplify the checkout experience and enable your customers to place orders only by confirming their payment information.

 

Related links

Advanced InLine Checkout experience

InLine Checkout offers you advanced control over the ordering process, for minimizing the customer's effort during the purchase. You can send the billing and delivery information directly to the cart if they are collected on your website by a shopping cart application. InLine Checkout enables you to:

  • Place test orders
  • Set coupons codes in cart
  • Set the cart language
  • Set the cart currency
  • Set a redirect URL after a finalized purchase

We recently improved the perceived loading time for the InLine checkout ordering engine by pre-loading the cart iframe. Faster loading time for the InLine cart means an enhanced shopping experience and helps you to increase conversion rates with no other effort on your side. See more details below in the Cart methods table.

Send information to InLine Checkout

After you integrate the InLine Checkout JavaScript code in your website application, you get access to the library that allows you to add products, control billing and shipping details, and start the checkout process. Follow the instructions below to control the information displayed by InLine Checkout.

Handling products

Products are handled by the products' service. This service allows you to retrieve the list of added products, add products to cart, remove individual products, or remove all the products from the cart.

Use the methods and product attributes listed below to add/remove products from the cart.

Product attributes

Attributes Type/Description
code

String

Product code assigned by you when creating the product. Required for catalog products.

type

String

Product type. Required only for dynamic products. Possible values:

[PRODUCT, SHIPPING, TAX]. Default value is PRODUCT.

name

String

Product name. Required for dynamic products.

price

String - for dynamic products

Product price. It is required for dynamic products.

 

Object - for catalog products with on-the-fly pricing

Product price. It is required for catalog products with on-the-fly pricing and includes value and currency.

tangible

String

Product tangible flag. Required only for dynamic products. Default value is FALSE.

quantity

String

Product quantity. Default value is 1. Required for catalog products with on-the-fly pricing.

options

Array

The product price options. It is supported for both catalog and dynamic products. Required for catalog products with on-the-fly pricing.

 

Product price options structure for dynamic products:

  • Name (String)- The price option name
  • Value (String, Number, Array of strings or numbers) - The price option value
  • Surcharge (string) - The price option surcharge - applicable only for dynamic products

Product price options structure for catalog products:

  • Name (String) – The unique code of the pricing OPTION GROUP
  • Value (String) – The unique code of the pricing OPTION
recurrence

Object

Required for dynamic products.

Possible values:

  • DAY
  • WEEK
  • MONTH
  • YEAR
  • FOREVER (available only for duration)

This parameter is conditioned by two other parameters: duration and renewalPrice.

duration

Object

Sets the duration of the recurrence. Required for dynamic products.

renewalPrice

Integer

Sets the price to be applied to the renewal order. Required for dynamic products.

Product methods

Methods Description
add Adds a single product to the list. Use the above list of parameters to add a product to cart.
remove Removes a product from the list.
addMany

Adds an array of product objects to the main list.

removeAll

Removes all products from the list.

getAll

Retrieves the products list.

HANDLING billing details

Billing details are handled by the billing service. Each billing information is controlled by a setter method.

Use the attributes and methods listed below to control the billing information displayed in the cart. Customers are able to fill in their billing information in the overlay provided by InLine Checkout. In case your shopping cart application collects customer's billing information, use the attributes and methods listed below to pass that information over to the cart.

Billing details attributes

Attributes Type/Description
name

String

Customer billing name. Example: "John Doe". 

email

String

Customer billing email. Example: "john.doe@email.com".

phone

String

Customer billing phone number. Example: "403940281923".

country

String

Customer billing country. Example: "US".

city

String

Customer billing city. Example: "Los Angeles".

state

String

Customer billing state. Example: "California".

zip

String

Customer billing zip code. Example: "90078".

address

String

Customer billing address. Example: "1093 Rodeo Drive".

address2

String

Customer billing additional address information. "293 Postal Box".

company-name

String

CompanyName

When sending the Company name the Company checkout flow will be triggered. Otherwise, the default checkout flow for InLine cart is the individual flow.

fiscal-code

String

fiscalCode

When sending the Fiscal code, the Company checkout flow will be triggered only if also another company flow relevant parameter will be also sent (Company name and/or Tax office). Otherwise, the default checkout flow for InLine cart is the individual flow.

tax-office

String

taxOffice

When sending the Tax office the Company checkout flow will be triggered. Otherwise, the default checkout flow for InLine cart is the individual flow.

Billing details methods

Methods Description
setData

Sets the entire billing data.

setName Sets the billing name.
setEmail Sets the billing email.
setPhone

Sets the billing phone.

setCountry Sets the billing country.
setCity Sets the billing city.
setState Sets the billing state.
setZip

Sets the billing zip code.

setAddress Sets the billing address.
setAddress2 Sets additional billing address information.
reset Resets the billing data.

setCompanyName

Sets the billing Company name

setFiscalCode

Sets the billing Fiscal code

setTaxCode

Sets the billing Tax code

Handle shipping details 

Shipping details are handled by the shipping service. Each shipping information is controlled by a setter method.

Use the attributes and methods listed below to control the shipping information displayed in the cart. In case you use a shopping cart application that collects the shipping information, use the attributes and methods listed below to pass that information over to the cart.

Shipping details attributes

Attributes Type/Description
name

String

Customer shipping name. Example: "John Doe". 

email

String

Customer shipping email. Example: "john.doe@email.com".

phone

String

Customer shipping phone number. Example: "403940281923".

country

String

Customer shipping country. Example: "United States of America".

city

String

Customer shipping city. Example: "Los Angeles".

state

String

Customer shipping state. Example: "California".

zip

String

Customer shipping zip code. Example: "90078".

address

String

Customer shipping address. Example: "1093 Rodeo Drive".

address2

String

Customer shipping additional address information. "293 Postal Box".

Shipping details methods

Methods Description
setData

Sets the entire shipping data.

setName Sets the shipping name.
setEmail Sets the shipping email.
setPhone

Sets the shipping phone.

setCountry Sets the shipping country.
setCity Sets the shipping city.
setState Sets the shipping state.
setZip

Sets the shipping zip code.

setAddress Sets the shipping address.
setAddress Sets additional shipping address information.
reset Resets the shipping data.

HANDLE the Checkout process 

Control the cart behavior by using the cart service. Use the checkout method to start the InLine Checkout experience.

Cart attributes

Attributes Type/Description
source

String

Sale originating source. Example: "YouTube Channel".

language

String

Cart language code. Example: "FR".

currency

String

Cart currency code. Example: "USD".

test

Boolean

Test order flag. Possible values:

  • true for test orders
  • false for real orders
setReturnMethod

String

Sets the ReturnMethod object. 

URL to which customer is redirected after a successful payment. Example: https://www.merchant-website.com.

coupon

String

Order promotion coupon. Example: "50%off".

token

String

Token for the authorization code.

expiration

String

The expiration date for the authorization.

orderExternalRef

String

The unique identifier of an order placed in the 2Checkout system, mirroring the reference you're using to manage order data in your system.

CustomerReference Integer. The 2Checkout system generates default customer numerical (integer) IDs automatically for all orders containing products that feature subscriptions. Can be used for new acquisitions aggregating new subscriptions under an existing Customer account.
ExternalCustomerReference String. The external customer reference.
autoAdvance

Boolean. Auto-advanced flag.

 

Possible values:

  • true for auto-advance
  • false for cart flow without auto-advance

Cart methods

Methods Description
register*

Makes the products, billing, shipping, cart and formParser services available.

These services are unavailable unless this method is called.

checkout

Starts the cart service which displays the overlay payment form.

addCoupon

Adds a coupon to the coupons list.

addCoupons Adds coupons in the cart from a list array.
removeCoupon

Removes a coupon from the coupons list.

removeCoupons

Clears all coupons from the cart instance.

setSource

Sets the order source.

setCurrency

Sets the currency on the cart instance.

setLanguage

Sets the language code for the order.

setReturnMethod

Sets the ReturnMethod object by calling TwoCoInlineCart.cart.setReturnMethod({url, type}). 

URL to which customer is redirected after a successful payment. Example: https://www.merchant-website.com.

setTest

Send true for placing a test order.

setLoaderState Handles the overlay window visibility.
setIframeState

Handles the loader visibility.

reloadCart

Reloads the cart instance.

setOrderExternalRef Sets the order external reference.
setCustomerReference Sets 2Checkout customer reference.
setExternalCustomerReference Sets external customer reference.
setCartLockedFlag

Boolean

Lock cart flag. Possible values:

  • true 
  • false

setIframeLoad

One string parameter: 'immediate' or 'delayed'. Additionally, the InLine cart can also be set by using TwoCoInlineCart',{"app":{"merchant":"MERCHANT_CODE", "iframeLoad": "immediate"} instead of TwoCoInlineCart.setup.setIframeLoad.

setIframeLoadDelay

One number parameter; sets the time in milliseconds. Modify the pre-loading time of the cart iframe by adding a delay using the TwoCoInlineCart.setup.setIframeLoadDelay method. 

setReset

Boolean

Erases all previous cart sessions from the customer's browser upon opening a new cart to avoid overlapping of the buy-link parameters. Possible values:

  • true 
  • false 
cart.setAutoAdvance

Sets the auto-advanced cart behavior. If all mandatory checkout parameters are prefilled, the shopper is advanced to the payment details page. 

addAdditionalField Sets an additional field for your account.

Retrieve cart attributes from InLine Checkout by using get methods: getTest, getLanguage, getCurrency, getSource, getCoupons, getSuccessURL, getCustomerReference, getExternalCustomerReference, getCartLockedFlag.

*When inserting the JavaScript code snippet from your Control Panel into your e-commerce website, you will get access to the library that allows you to add products, control billing and shipping details, and start the checkout process, without having to call the register() method.

Subscribe to shopping cart events

To subscribe to shopping cart events you need to call the events service 'subscribe' method with the event name as the first argument and a callback function as the second argument.

Below you can find a list of events that are supported by the shopping cart and you can subscribe to:

1. 'cart:opened' - triggers when the shopping cart is opened.

2. 'cart:closed' - triggers when the shopping cart is closed.

3. 'payment:finalized' - triggers when the payment has finalized.

4. 'fulfillment:finalized' - triggers when the fulfillment is completed.

TwoCoInLineCart.events.subscribe('cart:opened', function () {
    console.log('cart:opened triggered');
});

Sample request for catalog products

TwoCoInlineCart.setup.setMerchant('merchantCode'); // your Merchant code
TwoCoInlineCart.register();

TwoCoInlineCart.billing.setCountry('US'); // customer billing country
TwoCoInlineCart.billing.setName('John Doe'); // customer billing Name
TwoCoInlineCart.billing.setEmail('john.doe@email.com'); // customer email address
TwoCoInlineCart.billing.setCompanyName('<company name>')
TwoCoInlineCart.billing.setFiscalCode('<fiscal code>')
TwoCoInlineCart.billing.setTaxOffice('<tax office>')
TwoCoInlineCart.cart.setReset(true); // erase previous cart sessions

TwoCoInlineCart.shipping.setName('Jane Doe'); // customer Delivery name
TwoCoInlineCart.shipping.setEmail('jane.doe@email.com'); // customer Delivery email

TwoCoInlineCart.products.add({
    code: 'the-2co-product-code',
    quantity: 3
    options: [{
       name: 'color',
       value: 'red'
   }]
});

TwoCoInlineCart.products.addMany([
    {
        type: 'PRODUCT', 
        name: 'product 1', 
        price: 10, 
        tangible: true, 
        quantity: 1, 
    },
    {
        type: 'PRODUCT', 
        name: 'product 2', 
        price: 30, 
        tangible: true, 
        quantity: 1, 
    }                
]);

TwoCoInlineCart.cart.addCoupon('50%OFF'); // discount code
TwoCoInlineCart.cart.setCurrency('GBP'); // order currency
TwoCoInlineCart.cart.setLanguage('fr'); // language code
TwoCoInlineCart.cart.setOrderExternalRef('1231231'); // order external reference
TwoCoInlineCart.cart.setExternalCustomerReference('ID123extern'); // external customer reference 
TwoCoInlineCart.cart.checkout(); // start checkout process

Sample request for dynamic products

TwoCoInlineCart.setup.setMerchant('merchantCode'); // your merchant code
TwoCoInlineCart.setup.setMode('DYNAMIC'); // product type
TwoCoInlineCart.register();

TwoCoInlineCart.cart.setCurrency('USD'); // order currency

TwoCoInlineCart.products.add({
name        : 'A test dynamic product',
recurrence:{
    unit: 'WEEK',
    length: 2
},
duration: {
    unit: 'YEAR',
    length: 1
},
renewalPrice: 100.99
});
TwoCoInlineCart.cart.checkout(); //start checkout process
Rate this article:

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