Skip to main content
knowledgecenter.avangate.com

Collect payments with Inline Checkout

Collect payments with Inline Checkout 

Integrate the Inline Checkout JavaScript code in your backend application to get access to the library that allows you to add products, control billing and shipping details and start the checkout process. 

To collect payments with Inline Checkout, you need to:

  1. Send your Merchant Code
  2. Add products to cart
  3. Start the Checkout process

SENDING THE MERCHANT CODE 

When loading the cart application, send the checkout mode and your merchant code. Use the following setter methods to send this information:

  •  setMerchant (required) - for the merchant code. Your merchant code can be found in your Control Panel, in the Account Settings page.
  •  setMode (optional) - based on the product type. The default product mode is CATALOG. Use DYNAMIC only for orders placed with dynamic product information.

ADD PRODUCTS TO CART 

After sending your merchant code, use the add method to pass the product information to Inline Checkout. Use the code parameter as the product identified, and quantity to determine how many products are included in cart.

START THE CHECKOUT  PROCESS

After adding products in cart, start the Inline Checkout experience by using the checkout method. Starting the checkout method will display the payment overlay on your website.

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