External Ecster Pay

 Using the external version of Ecster Pay, the customer leaves your application to complete the purchase. The JavaScript API will create a URL to Ecster Pay where the customer completes the order.

The most obvious limitation of the external Ecster Pay is the disability to make changes to the cart after the customer leaves your application. You can of course make changes to the cart while your customer is still on your site.

This tutorial describes how to implement the external Ecster Pay.


  1. Prepare store checkout page – include a JavaScript file and render a button
  2. Create cart – create a cart in Ecster Pay via the REST API
  3. Save order details – prepare your application’s backend to receive information when the payment is complete

Steps to start external Ecster Pay:

  1. Execute JavScript method to get the Ecster Pay URL
  2. Set the URL on your "proceed to checkout" link or button

Execute JavaScript method

When the store checkout page has loaded, you should generate the URL to Ecster Pay using a JavaScript function that Ecster Pay provides. You pass a cart key to the function and you get a URL returned.

If you make changes to the cart thereby updating your cart in Ecster Pay, use the new cart key to execute the function again to receive a new URL.

var url = EcsterPay.getUrl({
    cartKey: '<cartKey>',
    showCart: false,
    shopTermsUrl: '<url to shop terms>'

$('#ecster-pay').attr('href', url);

Set the URL

Set the generated URL on your "proceed to checkout" link or button.

Note: You should open Ecster Pay in the same window as the checkout, i.e. don’t use target blank. When you do that, the customer could potentially change to the checkout tab making changes to the cart expecting Ecster’s payment window to reflect the new changes.

<a href="#" id="goto-checkout">Proceed to checkout</a>
$('#goto-checkout').attr('href', url);


Verify that an URL is generated to Ecster Pay external checkout. Make sure the URL is used on the Pay-button and try it out.

Request test account