Ecster Pay API

Live and test environment

Ecsters REST resources for the live and test environment reside under different host addresses:

Live: https://secure.ecster.se/rest/public/v1/carts
Test: https://labs.ecster.se/rest/public/v1/carts

JavaScript library

To be able to run Ecster Pay and use the JavaScript libary with callback functions you have to include Ecster's script. Below you will find the script for the test environment and live.

<script src="https://labs.ecster.se/pay/integration/ecster-pay-labs.js"></script>
<script src="https://secure.ecster.se/pay/integration/ecster-pay.js"></script>

Start methods

For Ecster Pay to be able to render you have to call Ecster's start method .start(function)cartKeywith value key from createCart or updateCart and your shopTermsUrl with the URL to your terms and condition.

See below for all start methods you can use.

Start functions

Ecster have five start functions for you to configure how Ecster Pay will show up in your created Div or in a own window.

Start function (.start(<function>) Description
cartKey (string, 1) The cartKey value received from the createCart or updateCart call
shopTermsUrl (string, 1) Url to the terms and condition page, link is displayed before the purchase button in Ecster Pay
showCart (boolean, 0-1) Whether to show the cart rows before consumer chooses payment method. Default value false
showPaymentResult (boolean, 1)

Decides wether the success page is displayed in Ecster Pay frame or not. Default is false which means that the result will not be presented in Ecster Pay frame.

true - Ecster Pay will show a success page within the Ecster Pay iframe
false - shop is responsible for removing the iframe and show a success page when onPaymentSuccess is received.

 getUrl  This function generates a URL to open Ecster Pay in a new window
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 user could potentially change to the checkout tab making changes to the cart expecting Ecster’s payment window to reflect the new changes.

Callback function

Ecster Pay presents different callbacks for you to listen to for making the best purchase experince for the user.

Below you can read which information the different callbacks provide. 

Callback function Description
onCheckoutStartInit

An event that’s triggered before the checkout starts

NOTE: While starting Ecster Pay, you need to prevent the user from making any changes to the cart. Read more under how you lock your page here

 onCheckoutStartSuccess

An event that’s triggered when Ecster Pay successfully started

NOTE: When Ecster Pay is started, you need to unlock your page. Read more under how you lock your page and when to unlock here

onCheckoutStartFailure 

 An event that’s triggered when the checkout failed to start

NOTE: If Ecster Pay starts fail, you need to unlock your page and depending the failure call createCart again. Read more under how you lock your page and when to unlock here

initUpdateCart

Ecster Pay must be notified when the cart is going to be updated.

onCheckoutUpdateInit 

An event that executes before the update of Ecster Pay starts

NOTE: While updating Ecster Pay, you need prevent the customer from making any changes to the cart. Read more under how you lock your page here

onCheckoutUpdateSuccess 

An event that's triggered when the update of Ecster Pay has been successfully executed

NOTE: When Ecster Pay is updated, you need to unlock your page. Read more under how you lock your page and when to unlock here

onCheckoutUpdateFailure 

An event that’s triggered when the update of Ecster Pay has failed to execute

NOTE: If Ecster Pay update fail, you need to unlock your page and depending the failure call updateCart again. Read more under how you lock your page and when to unlock here

onPaymentSuccess 

An event when a payment has been successfully executed. When triggered, you should update the order in your system accordingly.
If the start function showPaymentResult is set to false (= default configuration) Ecster Pay will not show a success page. It's important that you redirect the consumer to your shops success page once the onPaymentSuccess event has been triggered.

Your backend system will receive a push notification (OEN) with order status information (asynchronous within a reasonable  amount of time, e.g. a few seconds up to 5 minutes). Your backend must be able to handle your order being updated twice, both from the triggered event and from the OEN, regardless which action happens first.

NOTE: It may occur that the onPaymentSuccess event is not triggered even though the order was successfully executed in Ecster Pay, e.g. if the consumer closes the browser.  In this case you should update the order in your system upon receiving OEN.

NOTE2: After an order has been placed and the onPaymentSuccess has been triggered the cart key is expired and cannot be reused again. Make sure to empty your cart to prepare for a new checkout session.

onPaymentDenied 

An event that’s triggered when the payment was denied by the payment service.

NOTE: It may occur that the onPaymentDenied event is not triggered even though the order was successfully executed in Ecster Pay, e.g. if the consumer closes the browser.  In this case you should update the order in your system upon receiving push notification OEN to your notificationUrl that was sent in createCart or updateCart

onPaymentFailure 

An event that’s triggered when the payment has failed.

NOTE: It may occur that the onPaymentDenied event is not triggered even though the order was successfully executed in Ecster Pay, e.g. if the consumer closes the browser.  In this case you should update the order in your system upon receiving push notification OEN to your notificationUrl that was sent in createCart or updateCart

onCustomerAuthenticated 

An event that's triggered when the cunsomer has completed a successful BankID authentication.

NOTE: This is where you can communicate with this particular consumer by e.g. presenting the consumer with certain discounts or bonuses.

You can not use this information for marketing purposes due to you have to have consumers consent 
onChangedDeliveryAdress  An event that’s triggered when the delivery address is changed 

Create cart API

Create a cart for Ecster Pay to show the user.

Create cart

By using this call you create a cart.

Request Parameters  Description
locale (object) [1]    Settings for language and formatting. Not to be used to determine customer physical location.
  language (string) [1]   In ISO 639-1 format, “sv”, “en”, “no", “da”, “fi”.  Fall back for no and da  = sv(1) en(2). Fall back for all other languages = en.
  country (string) [1]   In ISO 3166-1 alpha-2 format, e.g. “SE”, “GB”, “NO”, “DK”, “FI”.
parameters (object) [1]     
  shopTermsUrl (string) [0-1]   Url to shop terms stating terms and conditions.
  returnUrl (string) [0-1]   Return URL to your website after successful order e.g. https://www.ecster.se
  defaultDeliveryCountry (String) [0-1]   Sets the default delivery country in Ecster Pay when consumer chooses to use another delivery adress.  ISO 3166-1 alpha-2 format, e.g. “SE”, “GB”, “NO”, “DK”, “FI”.
  purchaseType (object) [0-1]   Will filter payment methods and identification methods depending if purchase is made from a consumer or a business.
    type (string) [1]  “B2C”=business to consumer or “B2B”=business to business.
    show (boolean) [0-1]  A button will show in Ecster Pay Iframe for customer to choose between if they want to make the purchase as consumer or business. (To be released)
deliveryMethods [0-*]    If sent, Ecster displays the deliverymethod on the confirmation page.
  id (string) [1]   Your id for specific delivery method.
  name (string) [1]   The name for the specific delivery method.
  description (string) [0-1]   Information about the specific delivery method.
  price (amount) [1]   Price for delivery method.
  selected (boolean) [0-1]   If this delivery method is selected.
cart [1]    Object describing a cart. The cart object has the following fields:
  amount (amount) [1]   Total amount on this cart. Amount must match the sum of the amounts and discounts in cart rows.
  currency (currency) [1]   Currency on cart.
  message (string) [0-1]   Message to consumer shown on invoice. Max length 512 characters.
  rows [1-*]   Object describing a row in a cart. The row object has the following fields:
    name (string) [1]  Name of row. 
    quantity (double)   
    unitAmount (amount) [1]  Unit amount is including vat amount.
    vatRate (string) [0-1]  Vat rate, sent as integer including two decimals, i.e. 25% is represented as 2500.
    partNumber (string) [0-1]  Part number on row.
    description (string) [0-1]   
    unit (string) [0-1]   
    discountAmount (amount) [0-1]  Discount on the order line, submitted as an integer and can not be greater than the total order amount.
    serials (string) [0-*]   
    fee (boolean) [0-1]  true if the row is a fee. Default = false.
    provided (boolean) [1] read only  true if row has been added by Ecster. Will be set to true when invoice fee has been added automatically, else false.
orderReference (string) [1]    Merchant’s order reference, max 16 characters. Note: Swish payments only accept letters and numbers (no non-alphanumeric characters).
consumer [0-1]    Object describing an identified consumer. The consumer object has the following fields:
  nationalId (nationalid, 0-1)   Id on consumer.
  name (name) [0-1]    
    firstName (string) [0-1]   
    lastName (string) [0-1]   
    title (string) [0-1]   
  address (address) [0-1]   Object describing an address. The address object has the following fields:
    line1 (string) [0-1]  Street name and number. Applicable for all addresses except German("DE") and Austria("AT").
    streetName (string) [0-1]  Applicable for addresses in German("DE") and Austria("AT").
    streetNumber (string) [0-1]  Applicable for addresses in German("DE") and Austria("AT").
    line2 (string) [0-1]  C/O address, Company address field. Applicable for all addresses.
    city (string) [0-1]   
    zip (string) [0-1]   
    province (string) [0-1]  Used when applicable for e.g. Region, State, Province. Mandatory for United States ("US").
    country (string) [0-1]  ISO 3166-1 alpha-2 format.
  contactInfo (contactInfo) [0-1]   Contact information to consumer.
    email (string) [0-1]   
    cellular (object) [0-1]  Cellular phone number with country code.
    country (string) [0-1]  Country code for cellular. Specify country code with “+”, e.g. “+46” or “0046” for Sweden.
    number (string) [0-1] Cellular phone number. Specify number including area code but without country code.
    phone (object) [0-1]  Phone number with country code.
      country (string) [0-1] Country code for phone. Specify country code with “+”, e.g. “+46” or “0046” for Sweden.
      number (string) [0-1] Phone number. Specify number including area code but without country code.
notificationUrl (string) [0-1]    URL for status change notifications. See details here
platform (object) [0-1]    E-Commerce Platform information.
  reference (string) [1]   Reference provided by Ecster.
  info (string) [0-1]   Platform name and version.
tags (string) [0-*]
Provide tags for statistics purposes.
countryCode (String) [0-1]    Sets country for the consumer. ISO 3166-1 alpha-2 format, e.g. “SE”, “GB”, “NO”, “DK”, “FI”.

JSON example

Post /rest/public/v1/carts

Request

Headers

x-api-key: JKN675aVeMR9Mleh786FGf2ff7T1okmH6 (example)
x-merchant-key: 10569832 (example)
Content-Type: application/json

Body

{
  "locale": {
    "language": "sv",
    "country": "SE"
  },
  "countryCode": "SE",
  "parameters" : {
	  "shopTermsUrl": "https://ecster.com/terms/storeTerms.html",
	  "returnUrl" : "https://ecster.com/return/to/page.html",
	  "defaultDeliveryCountry": "SE",
	  "purchaseType": {
	  	"type": "B2C",
	  	"show": false
	  }
  },
  "deliveryMethods": [
    {
      "id": "dev_id_123",
      "name": "Flight",
      "description": "Domestic",
      "price": 12000,
      "selected": false
    },
    {
      "id": "dev_id_124",
      "name": "Boat",
      "description": "International",
      "price": 10000,
      "selected": true
    }
  ],
  "cart": {
    "amount": 92500,
    "currency": "SEK",
    "message": "Your cart",
    "rows": [
      {
        "partNumber": "264275-0044_345",
        "name": "Adidas Stan Smith",
        "description": "White size 9",
        "quantity": 1.0,
        "unitAmount": 75000,
        "unit": "st",
        "vatRate": 2500,
        "discountAmount": 0,
        "serials": [
          "951358"
        ]
      },
      {
        "partNumber": "264275-0044_346",
        "name": "Ecco",
        "description": "Shoe shine kit",
        "quantity": 1.0,
        "unitAmount": 10000,
        "unit": "st",
        "vatRate": 1200,
        "discountAmount": 0
      },
      {
        "partNumber": "264275-0044_347",
        "name": "Shoes: An Illustrated History",
        "description": "Christmas issue",
        "quantity": 3.0,
        "unitAmount": 2500,
        "unit": "par",
        "vatRate": 600,
        "discountAmount": 0
      }
    ]
  },
  "orderReference": "OrderRef_123123",
  "consumer": {
    "name": {
      "firstName": "Brian",
      "lastName": "Falk",
      "title": "Mr"
    },
    "address": {
      "streetName": "Birkagatan 12",
      "streetNumber": "12",
      "zip": "247 41",
      "city": "Södra Sandby",
      "country": "Sweden"
    },
    "contactInfo": {
      "email": "mail@ecster.se",
      "cellular": {
        "number": "700000000",
        "country": "+46"
      }
    }
  },
  "notificationUrl":  "www.ecster.com/notify/page.html",
  "platform": {
    "reference": "2cc5c43d-fb92-472f-828a-1a5ad703d512",
    "info": "Platform and version"
  },
   "tags": ["testTagType1:testTagMsg1","testTagType2:testTagMsg2"]
}

Response 201 Created

Body

{
    "checkoutCart": {
        "key": "24763D7320C09CB9D1E0A96B907EBA27",
        "locale": {
            "language": "sv",
            "country": "SE"
        },
        "deliveryMethods": [
            {
                "id": "dev_id_123",
                "name": "Flight",
                "description": "Domestic",
                "price": 12000,
                "selected": false
            },
            {
                "id": "dev_id_124",
                "name": "Boat",
                "description": "International",
                "price": 10000,
                "selected": true
            }
        ],
        "cart": {
            "amount": 92500,
            "currency": "SEK",
            "rows": [
                {
                    "name": "Adidas Stan Smith",
                    "quantity": 1,
                    "unitAmount": 75000,
                    "vatRate": 2500,
                    "partNumber": "264275-0044_345",
                    "description": "White size 9",
                    "unit": "st",
                    "discountAmount": 0,
                    "serials": [
                        "951358"
                    ]
                },
                {
                    "name": "Ecco",
                    "quantity": 1,
                    "unitAmount": 10000,
                    "vatRate": 1200,
                    "partNumber": "264275-0044_346",
                    "description": "Shoe shine kit",
                    "unit": "st",
                    "discountAmount": 0
                },
                {
                    "name": "Shoes: An Illustrated History",
                    "quantity": 3,
                    "unitAmount": 2500,
                    "vatRate": 600,
                    "partNumber": "264275-0044_347",
                    "description": "Christmas issue",
                    "unit": "par",
                    "discountAmount": 0
                }
            ],
            "message": "Your cart"
        },
        "consumer": {
            "name": {
                "firstName": "Brian",
                "lastName": "Falk",
                "title": "Mr"
            },
            "address": {
                "streetName": "Birkagatan 12",
                "streetNumber": "12",
                "city": "Södra Sandby",
                "zip": "247 41",
                "country": "Sweden"
            },
            "contactInfo": {
                "email": "mail@ecster.se",
                "cellular": {
                    "country": "+46",
                    "number": "700000000"
                }
            }
        },
        "notificationUrl": "www.ecster.com/notify/page.html",
        "platform": {
            "reference": "2cc5c43d-fb92-472f-828a-1a5ad703d512",
            "info": "Platform and version"
        },
        "tags": [
            "APIv1",
            "testTagType1:testTagMsg1",
            "testTagType2:testTagMsg2"
        ],
        "parameters": {
            "returnUrl": "https://ecster.com/return/to/page.html",
            "shopTermsUrl": "https://ecster.com/terms/storeTerms.html",
            "defaultDeliveryCountry": "SE",
            "purchaseType": {
                "type": "b2c",
                "show": false
            }
        },
        "countryCode": "SE"
    }
}

Data types

= Mandatory
= Optional

Response

In the response you will recieve the

Response parameters Description
key cartKey
The entire request body See section Create Cart API

Update cart API

Update a cart with changes for Ecster Pay to show the user.

Update cart

By using this call you update an existing cart.

Query paramters Description
key The current cartKey
Request Parameters  Description
locale (object) [1]    Settings for language and formatting. Not to be used to determine customer physical location.
  language (string) [1]   In ISO 639-1 format, “sv”, “en”, “no", “da”, “fi”.  Fall back for “no“ and “da“  = “sv“(1) “en“(2). Fall back for all other languages = “en“.
  country (string) [1]   In ISO 3166-1 alpha-2 format, e.g. “SE”, “GB”, “NO”, “DK”, “FI”.
parameters (object) [1]     
  shopTermsUrl (string) [0-1]   Url to shop terms stating terms and conditions.
  returnUrl (string) [0-1]   Return URL to your website after successful order e.g. https://www.ecster.se
  defaultDeliveryCountry (String) [0-1]   Sets the default delivery country in Ecster Pay when consumer chooses to use another delivery adress.  ISO 3166-1 alpha-2 format, e.g. “SE”, “GB”, “NO”, “DK”, “FI”.
  purchaseType (object) [0-1]   Will filter payment methods and identification methods depending if purchase is made from a consumer or a business.
    type (string) [1]  “B2C”=business to consumer or “B2B”=business to business.
    show (boolean) [0-1]  A button will show in Ecster Pay Iframe for customer to choose between if they want to make the purchase as consumer or business. (To be released)
deliveryMethods [0-*]    If sent, Ecster show deliverymethod on confirmation page.
  id (string) [1]   Your id for specific delivery method.
  name (string) [1]   The name for the specific delivery method.
  description (string) [0-1]   Information about the specific delivery method.
  price (amount) [1]   Price for delivery method.
  selected (boolean) [0-1]   If this delivery method is selected.
cart [1]    Object describing a cart. The cart object has the following fields:
  amount (amount) [1]   Total amount on this cart. Amount must match the sum of the amounts and discounts in cart rows.
  currency (currency) [1]   Currency on cart.
  message (string) [0-1]   Message to consumer shown on invoice. Max length 512 characters.
  rows [1-*]   Object describing a row in a cart. The row object has the following fields:
    name (string) [1]  Name of row. 
    quantity (double)   
    unitAmount (amount) [1]  Unit amount is including vat amount.
    vatRate (string) [0-1]  Vat rate, sent as integer including two decimals, i.e. 25% is represented as 2500.
    partNumber (string) [0-1]  Part number on row.
    description (string) [0-1]   
    unit (string) [0-1]   
    discountAmount (amount) [0-1]  Discount on the order line, submitted as an integer and can not be greater than the total order amount.
    serials (string) [0-*]   
    fee (boolean) [0-1]  true if the row is a fee. Default = false.
    provided (boolean) [1] read only  true if row has been added by Ecster. Will be set to true when invoice fee has been added automatically, else false.
orderReference (string) [1]    Merchant’s order reference, max 16 characters.
consumer [0-1]    Object describing an identified consumer. The consumer object has the following fields:
  nationalId (nationalid, 0-1)   Id on consumer.
  name (name) [0-1]    
    firstName (string) [0-1]   
    lastName (string) [0-1]   
    title (string) [0-1]   
  address (address) [0-1]   Object describing an address. The address object has the following fields:
    line1 (string) [0-1]  Street name and number. Applicable for all addresses except German("DE") and Austria("AT").
    streetName (string) [0-1]  Applicable for addresses in German("DE") and Austria("AT").
    streetNumber (string) [0-1]  Applicable for addresses in German("DE") and Austria("AT").
    line2 (string) [0-1]  C/O address, Company address field. Applicable for all addresses.
    city (string) [0-1]   
    zip (string) [0-1]   
    province (string) [0-1]  Used when applicable for e.g. Region, State, Province. Mandatory for United States ("US").
    country (string) [0-1]  ISO 3166-1 alpha-2 format.
  contactInfo (contactInfo) [0-1]   Contact information to consumer.
    email (string) [0-1]   
    cellular (object) [0-1]  Cellular phone number with country code.
     country (string) [0-1]  Country code for cellular. Specify country code with “+”, e.g. “+46” or “0046” for Sweden.
     number (string) [0-1] Cellular phone number. Specify number including area code but without country code.
    phone (object) [0-1]  Phone number with country code.
      country (string) [0-1] Country code for phone. Specify country code with “+”, e.g. “+46” or “0046” for Sweden.
      number (string) [0-1] Phone number. Specify number including area code but without country code.
notificationUrl (string) [0-1]    URL for status change notifications. See details here
platform (object) [0-1]    E-Commerce Platform information.
  reference (string) [1]   Reference provided by Ecster.
  info (string) [0-1]   Platform name and version.
tags (string) [0-*]
Provide tags for statistics purposes.
countryCode (String) [0-1]    Sets country for the consumer. ISO 3166-1 alpha-2 format, e.g. “SE”, “GB”, “NO”, “DK”, “FI”.

JSON example

Put /rest/public/v1/carts/<key>

Request

Headers

x-api-key: JKN675aVeMR9Mleh786FGf2ff7T1okmH6
x-merchant-key: 10569832
Content-Type: application/json

Body

{
  "locale": {
    "language": "sv",
    "country": "SE"
  },
  "countryCode": "SE",
  "parameters" : {
	  "shopTermsUrl": "https://ecster.com/terms/storeTerms.html",
	  "returnUrl" : "https://ecster.com/return/to/page.html",
	  "defaultDeliveryCountry": "SE",
	  "purchaseType": {
	  	"type": "B2C",
	  	"show": false
	  }
  },
  "deliveryMethods": [
    {
      "id": "dev_id_123",
      "name": "Flight",
      "description": "Domestic",
      "price": 12000,
      "selected": false
    },
    {
      "id": "dev_id_124",
      "name": "Boat",
      "description": "International",
      "price": 10000,
      "selected": true
    }
  ],
  "cart": {
    "amount": 92500,
    "currency": "SEK",
    "message": "Your cart",
    "rows": [
      {
        "partNumber": "264275-0044_345",
        "name": "Adidas Stan Smith",
        "description": "White size 9",
        "quantity": 1.0,
        "unitAmount": 75000,
        "unit": "st",
        "vatRate": 2500,
        "discountAmount": 0,
        "serials": [
          "951358"
        ]
      },
      {
        "partNumber": "264275-0044_346",
        "name": "Ecco",
        "description": "Shoe shine kit",
        "quantity": 1.0,
        "unitAmount": 10000,
        "unit": "st",
        "vatRate": 1200,
        "discountAmount": 0
      },
      {
        "partNumber": "264275-0044_347",
        "name": "Shoes: An Illustrated History",
        "description": "Christmas issue",
        "quantity": 3.0,
        "unitAmount": 2500,
        "unit": "par",
        "vatRate": 600,
        "discountAmount": 0
      }
    ]
  },
  "orderReference": "OrderRef_123123",
  "consumer": {
    "name": {
      "firstName": "Brian",
      "lastName": "Falk",
      "title": "Mr"
    },
    "address": {
      "streetName": "Birkagatan 12",
      "streetNumber": "12",
      "zip": "247 41",
      "city": "Södra Sandby",
      "country": "Sweden"
    },
    "contactInfo": {
      "email": "mail@ecster.se",
      "cellular": {
        "number": "700000000",
        "country": "+46"
      }
    }
  },
  "notificationUrl":  "www.ecster.com/notify/page.html",
  "platform": {
    "reference": "2cc5c43d-fb92-472f-828a-1a5ad703d512",
    "info": "Platform and version"
  },
   "tags": ["testTagType1:testTagMsg1","testTagType2:testTagMsg2"]
}

Response 201 Created

Body

{
    "checkoutCart": {
        "key": "294B0BD158BEB2A71CB25258EC0E2360",
        "locale": {
            "language": "sv",
            "country": "SE"
        },
        "deliveryMethods": [
            {
                "id": "dev_id_123",
                "name": "Flight",
                "description": "Domestic",
                "price": 12000,
                "selected": false
            },
            {
                "id": "dev_id_124",
                "name": "Boat",
                "description": "International",
                "price": 10000,
                "selected": true
            }
        ],
        "cart": {
            "amount": 92500,
            "currency": "SEK",
            "rows": [
                {
                    "name": "Adidas Stan Smith",
                    "quantity": 1,
                    "unitAmount": 75000,
                    "vatRate": 2500,
                    "partNumber": "264275-0044_345",
                    "description": "White size 9",
                    "unit": "st",
                    "discountAmount": 0,
                    "serials": [
                        "951358"
                    ]
                },
                {
                    "name": "Ecco",
                    "quantity": 1,
                    "unitAmount": 10000,
                    "vatRate": 1200,
                    "partNumber": "264275-0044_346",
                    "description": "Shoe shine kit",
                    "unit": "st",
                    "discountAmount": 0
                },
                {
                    "name": "Shoes: An Illustrated History",
                    "quantity": 3,
                    "unitAmount": 2500,
                    "vatRate": 600,
                    "partNumber": "264275-0044_347",
                    "description": "Christmas issue",
                    "unit": "par",
                    "discountAmount": 0
                }
            ],
            "message": "Your cart"
        },
        "consumer": {
            "name": {
                "firstName": "Brian",
                "lastName": "Falk",
                "title": "Mr"
            },
            "address": {
                "streetName": "Birkagatan 12",
                "streetNumber": "12",
                "city": "Södra Sandby",
                "zip": "247 41",
                "country": "Sweden"
            },
            "contactInfo": {
                "email": "mail@ecster.se",
                "cellular": {
                    "country": "+46",
                    "number": "700000000"
                }
            }
        },
        "notificationUrl": "www.ecster.com/notify/page.html",
        "platform": {
            "reference": "2cc5c43d-fb92-472f-828a-1a5ad703d512",
            "info": "Platform and version"
        },
        "tags": [
            "APIv1",
            "testTagType1:testTagMsg1",
            "testTagType2:testTagMsg2"
        ],
        "parameters": {
            "returnUrl": "https://ecster.com/return/to/page.html",
            "shopTermsUrl": "https://ecster.com/terms/storeTerms.html",
            "defaultDeliveryCountry": "SE",
            "purchaseType": {
                "type": "b2c",
                "show": false
            }
        },
        "countryCode": "SE"
    }
}

Data types

= Mandatory
= Optional

Response

In the response you will recieve the cart key and the body.

Response parameters Description
key cartKey
The entire request body See section Update Cart API

Change order reference API

This call changes the orderReference or sets it if it does not exist.

Change Order reference

By using this call you change or set the paramter orderReference.

Request parameters Description
orderReference The external order reference 

JSON example

Put /rest/public/v1/orders/<internalReference>/orderReference

Request

Headers

x-api-key: JKN675aVeMR9Mleh786FGf2ff7T1okmH6
x-merchant-key: 10569832
Content-Type: application/json

Body

{
 "orderReference":"123klkk333"
}

Response 201 Created

Body

{
    "id": "GCMEnwjzAHbEHb7Kb1eU",
    "merchantId": "177358941",
    "status": "READY",
    "properties": {
        "method": "PARTPAYMENT",
        "submethod": "PARTPAYMENT_SE_1",
        "startFee": 0,
        "adminFee": 1500,
        "perMonth": 31500,
        "payments": 1,
        "creditCost": 1500,
        "raise": false,
        "new": true,
        "accountNumber": "98520959****8396",
        "currentCreditLimit": 200000,
        "openReservation": false,
        "directDebit": false
    },
    "created": "2019-02-06T12:51:57+01:00",
    "amount": 30000,
    "currency": "SEK",
    "debitedAmount": 0,
    "creditedAmount": 0,
    "orderReference": "orderReferenceDefValue",
    "consumer": {
        "nationalId": "SE430421-4630",
        "name": {
            "firstName": "Patrick",
            "lastName": "Carlsson"
        },
        "address": {
            "line1": "S:t Korsgatan 7",
            "city": "Lund",
            "zip": "226 40",
            "country": "SE"
        },
        "contactInfo": {
            "email": "mail@ecster.se",
            "cellular": {
                "number": "0707333444"
            },
            "phone": {
                "number": "046-3573529"
            }
        }
    },
    "transactions": [
        {
            "id": "uVpFBx6iRtuEhQgg7rXS",
            "type": "ORIGINAL",
            "created": "2019-02-06T12:51:57+01:00",
            "amount": 30000,
            "rows": [
                {
                    "name": "name def value",
                    "quantity": 1,
                    "unitAmount": 28000,
                    "vatRate": 2500,
                    "partNumber": "00012",
                    "description": "Model",
                    "unit": "st",
                    "discountAmount": 0,
                    "serials": [],
                    "fee": false
                },
                {
                    "name": "name def value",
                    "quantity": 1,
                    "unitAmount": 2000,
                    "vatRate": 1200,
                    "partNumber": "00013",
                    "description": "TestDescription",
                    "unit": "st",
                    "discountAmount": 0,
                    "serials": [],
                    "fee": false
                }
            ],
            "message": "TestMessageDefValue",
            "merchantId": "177358941"
        }
    ],
    "tags": [
        "testTagType1:testTagMsg1",
        "testTagType2:testTagMsg2"
    ],
    "localizedInfo": [
        {
            "id": "decisionMessage",
            "text": "",
            "value": "Ecster har beviljat din ansökan om delbetalningen."
        }
    ],
    "debitConsentPdfUrl": "https://labs.ecster.se/rest/public/v1/content/consumer/documents/se/sv/debitconsent/pdf/GCMEnwjzAHbEHb7Kb1eU",
    "debitConsentInfo": {
        "text": "I och med denna underskrift godkänner jag att nedanstående butik debiterar mitt kontonummer hos Ecster AB.Datum: 2019-02-07\r\nUnderskrift: ...................................\r\nID-typ: \r\n\r\n",
        "localizedInfo": []
    }
}

Data types

= Mandatory
= Optional

Response

In the response you will recieve the following:

Response parameters Description
order See custom object section here 

Request test account