Easy checkout integration guide

Easy checkout is a payment page that embeds directly into your shop. The payment is handled through the Payment API and the checkout page is generated by javascript.


The Embedded DIBS Easy checkout is a paymentservice which is embedded directly on the checkout page.
The following integration guide is meant to document a basic integration of the checkout using html, javascript, and php.

A integration towards DIBS Easy differs from other DIBS integrations by having the paymentId(transactionID) created before the checkout is initialized.

The integration guide consists of the following 3 steps:

  1. Creating a PaymentId
  2. The Checkout
  3. Handle Payments After Checkout

Creating a paymentId

Once a customer wishes to complete a purchase by proceeding to the Easy checkout, a payment has to be prepared by creating a paymentId.

A paymentId is created by making a server-to-server call to the Payment API with a datastring containing information about the order, customer, and merchant.

If the request is successful, the Payment API will respond with a paymentId token.

The Datastring

The datastring is an array of parameters, which are intended to make up a single order.

The following parameters have to be included in the datastring: Items, amount, currency (ISO 4217), reference (orderID), checkout (customer information), merchantReference.

For specified information regarding the different parameters in the datastring, see: Datastring Parameters

Create Payment API-request

The example below creates a simple cURL request based on the following parameters:
INIT URL: https://test.api.dibspayment.eu/v1/payments/
Authorization key: A secret key found in the DIBS Easy administration
Datastring: A collection of data, which is used to define the order.

The request to create a paymentId must be done through server-to-server communication, any attempt at calling the API from a client (web-browser) will fail.


The URL in the Datastring must be the same URL as the URL you use to load the checkout from. If checkout is loaded from "https://www.mydomain.com/checkout" then the same URL must be sent to Easy Checkout when loading the checkout.

cUrl example


if($_GET['action'] == 'createPay') {                             
	$datastring = getDatastring($orderID);

	$ch = curl_init('https://test.api.dibspayment.eu/v1/payments');                                                                      
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
	curl_setopt($ch, CURLOPT_POSTFIELDS, $datastring);                                                                  
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
		'Content-Type: application/json',
		'Accept: application/json',	
		'Authorization: 00000000000000000000000009000000')                                                                   
	$result = curl_exec($ch);
{ "paymentId": "string" }


Datastring example

"order": {
	"items": [{
	"reference": "13",
	"name": "testproduct 1",
	"quantity": 2,
	"unit": "pcs",
	"unitPrice": 48648,
	"taxRate": 2500,
	"taxAmount": 24324,
	"grossTotalAmount": 121620,
	"netTotalAmount": 97296
	"reference": "21",
	"name": "testproduct 2",
	"quantity": 2,
	"unit": "kg",
	"unitPrice": 111840,
	"taxRate": 2500,
	"taxAmount": 55920,
	"grossTotalAmount": 279600,
	"netTotalAmount": 223680
"amount": 401220,
"currency": "nok",
"reference": "Demo Order"
"checkout": {
"url": "https://www.mydomain.com/checkout",
"termsUrl": "https://www.mydomain.com/toc"

Restricting Shipping

To specify the available shipping countries, the merchant can extend the operation for creating payment with the ShippingCountries parameter. If not used, all countries will be avialable for the customer during the checkout.


ShippingCountries" : [{"countryCode":"NOR"},{"countryCode":"SWE"}] 

The countries should be specified using ISO 3166-1 alpha-3 codes

If a country is not in the list, the merchant will be notified with the following error message.

    "errors": {
        "checkout.ShippingCountries": [
            "[SSS] as shipping country not supported "
If a consumer’s shipping address country is not in the list of supported shipping countries an error will appear as seen in the image below:

Restrict Shipping consumer example


A full list of accepted countries and related ISO 3166-1 Codes can be found here

Initialize the checkout

Javascript source:

To initiate the checkout you first have to add the following javascript as a source to the checkout page:




Add target element for checkout:

You will need a DIV element in which the checkout iframe will be loaded, in the example we use:


The javascript will create an iFrame containing the Easy checkout, and it will add the iframe to the position of the domElementId with a source url formatted based on the input parameters.

HTML Example


Trigger checkout javascript:

In the example above, we use a button to initialize the checkout:


This button triggers an ajax call to the createpayment php function, which generates a paymentId based on the datastring of collected information.
On successful execution, it assigns the new paymentID variable and initiates the checkout process.

$("#CreatePayment").on('click', function() {
                url: 'api/createpayment.php',
                data: {
                    action: 'createPay',
                dataType: 'json',
                success: function(data) {
                    paymentID = JSON.stringify(data);
                    var obj = jQuery.parseJSON(paymentID);
                    paymentID = obj.paymentId;


The checkout .js uses the variable checkoutOptions to initialize the iframe.
This variable consist of the following parameters:

Parameter Description

Merchant Identifier, found in Easy-Portal


Reference to the paymentId token created in previous steps.


ID of DOM-element where iframe will be loaded.


Language used in checkout. Possible values:
en-GB (english)
sv-SE (swedish)
nb-NO (Norwegian Bokmål)
da-DK (Danish)
not specified (default): en-GB

* : Mandatory parameters

var checkoutOptions = {
               checkoutKey: “live-checkout-key-00000000000000000000000009000000”, //[Required] Test or Live GUID with dashes
               paymentId : "8b464458f2524bc39fe5d31deb8bedc1", //[required] GUID without dashes
               containerId : "dibs-complete-checkout", //[optional] defaultValue: dibs-checkout-content
               language: "en-GB",            //[optional] defaultValue: en-GB
var checkout = new Dibs.Checkout(checkoutOptions);

//this is the event that the merchant should listen to redirect to the “payment-is-ok” page

checkout.on('payment-completed', function(response) {
                              paymentId: string (GUID without dashes)
               window.location = '/PaymentSuccessful';


3D-Secure Checkout Flow

If a customer has a 3Dsecure enrolled card, they will be redirected to verification during the checkout-process. When the customer has completed the verification process, they are automatically returned back to the checkoutUrl with an added paymentId parameter.

At this point the checkout has to be re-initialized using the same paymentId, if the verification was successfull it will trigger the payment-completed function of the checkout.js. If the verification failed, it will alow the consumer to retry the purchase.


Restricted parameter: paymentId

Due to the nature of a 3D secure checkout process, the query string used to initiate the checkout the first time, must not contain a paymentId parameter as reference, as this will be used by the checkout in a later stage of the process.


is forbidden and will cause an error when the checkout is initiated.


Pay-initialized event

This is an event that triggers whenever the consumer clicks on the "pay" button and is sent to the 3D secure step. Together with for instance a timer on the merchant side, this can be used to easily track if a consumer cancels the payment during the 3D secure step.

A spinner will be displayed to consumer while checkout is waiting for a response from the Merchant

  • Response is required within timeout
  • Respond with ‘payment-order-finalized’ and a boolean
  • True: Continue to processing
  • False: Something went wrong, don’t proceeed
  • ⇛ Payment failed.
    NB:If payment fail, the consumer will be able to try again.
     checkout.on('pay-initialized', function(response) {
    	Complete the desired operations such as update payment
    	checkout.send('payment-order-finalized', true/false);


Handle Payments after Checkout

The GET Payment function

After the checkout has been completed, the created payment can either be handled in the administration portal, or directly through our API functions.

Specified Information regarding the different API functions can be found here:http://tech.dibspayment.com/easy/server-to-server-api

Regardless of how you choose to handle payments, we always recommend to use the GET Payment API to retrieve the latest information regarding the payment.

This is done by sending a GET request to the PaymentAPI containing the paymentId you wish to retrieve information on.



if($_GET['action']=='getPayment') {
    $ch=curl_init('https://test.api.dibspayment.eu/v1/payments/'. $payId . '');
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Accept: application/json', 'Authorization: /* Secret Key */'));

This request will respond with a json array containing all relevant information regarding the payment

Reciept Illustration

Payment Confirmation

Once a purchase is completed, the customer must receive a confirmation of the order and a receipt in the form of an on-screen-display and e-mail.

Order confirmation immediately on-screen-display after purchase.
- Transaction status (completed/accepted/declined)

Order confirmation e-mail must contain the following information and should be sent immediately to the customer after a successful order.

  • Payment ID
  • Expected date of delivery (i.e. "will be delivered within 5 days")
  • Your contact details including company name, address, e-mail address and/or telephone number
  • A complete description of the services/products purchased
  • The order number (your webshop’s internal order reference number)
  • The last four digits of the card number when purchase is done by card
  • Order date
  • Prices must include the currency
  • The total amount being charged (incl. charges, value added tax, shipping etc.)
  • The payment status (completed/declined)
  • The amount indicated must not exceed the amount quoted in the order form


The order confirmation/reciept is required in our site inspection and must be fulfilled before the solution is accepted.
For more information in regards to the site inspection process, please visit: http://www.dibspayment.com/easy/siteinspection

Do you have a question or need help?
Follow us
DIBS Payment Services
Stockholm +46 (0)8-527 525 00
Göteborg +46 031-600 800
København +45 7020 3077
Oslo +47 21 55 44 00
Close menu