Skip to main content
knowledgecenter.2checkout.com

Inline Checkout

Overview

Inline Checkout acts as an iframe that opens on your website, enabling you to receive payments without redirecting your customers to a third party checkout.

Integrate Inline Checkout and:

  • Offer your customers the possibility of purchasing using mobile devices with a responsive cart design, which renders well on a variety of devices and screen sizes.
  • Improve your localization strategy, with a cart translated into 29 languages, and +130 transactional currencies for displaying the price.
  • Minimize the customer effort during the purchase by passing the collected billing/shipping information to Inline Checkout.

Inline Checkout integrates ideally with shopping cart applications that collect customer billing and shipping information, allowing you to pass that information over to the cart, and minimize customer's efforts during the payment process.

inline checkout.jpg

Availability

Inline Checkout is available for accounts that have ConvertPlus enabled on their account. Contact 2Checkout for activation.

Dynamic product information

Inline Checkout enables you to receive payments without having products defined in your 2Checkout Control Panel. Send the product information dynamically to Inline Checkout, and receive payments without the need of a product catalog in 2Checkout.

How to integrate Inline Checkout

To integrate Inline Checkout with your shopping cart, follow the steps below.

1. Generate and insert the JavaScript code in your eCommerce website by following these steps:

  • Go to Setup Generate links area
  • Click the Inline Checkout tab
  • Copy the JavaScript code snippet generated by our platform (see the code sample below) and paste it in your eCommerce website (you can paste it either inside the <head> tag or inside the page body right before the closing </body> tag of your HTML page)
<script>
    (function (document, src, libName, config) {
        var script             = document.createElement('script');
        script.src             = src;
        script.async           = true;
        var firstScriptElement = document.getElementsByTagName('script')[0];
        script.onload          = function () {
            for (var namespace in config) {
                if (config.hasOwnProperty(namespace)) {
                    window[libName].setup.setConfig(namespace, config[namespace]);
                }
            }
            window[libName].register();
        };

        firstScriptElement.parentNode.insertBefore(script, firstScriptElement);
    })(document, 'https://secure.avangate.com/checkout/client/twoCoInlineCart.js', 'TwoCoInlineCart',{"app":{"merchant":"XXXXXXX"},"cart":{"host":"https:\/\/secure.2checkout.com"}});
</script>

Your merchant code (you can find it in your merchant Control Panel, Dashboard → Integrations → Webhooks and API → API section) is automatically added by the system when you generate the JavaScript code library shown above, in the XXXXXXX string.

After you integrate the Inline Checkout JavaScript code in your HTML page, you get access to the library that allows you to add products, control billing and shipping details and start the checkout process (see the JavaScript API reference here).

2. Add a buy button on your website.

  • Navigate to the merchant Control Panel → Setup → Generate links
  • Click on the Inline Checkout tab
  • Select a product from the drop-down list in the 'Select one or more products' section 
  • Provide the desired quantity in the “Quantity settings” section 
  • Click on the Generate code button at the bottom of the page 
  • Copy the link and paste it into your HTML page

3. Start the Checkout process. Starting the checkout process will display the payment overlay and the inline cart on your website.

Collect payments with Inline Checkout

Sample request

The below request represents a basic use of Inline Checkout, that allows your users to finalize purchases directly from your website via a secure payment form.

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

TwoCoInlineCart.products.add({
    code: 'the-2co-product-code',
    quantity: 3
}); // add products to cart

TwoCoInlineCart.cart.checkout(); // start checkout process
  • Was this article helpful?