Klarna Docs - Custom checkboxes

Custom checkboxes

This feature will allow you to add a custom checkbox to the checkout. For example to create a newsletter opt-in as part of the customer’s checkout process. You can freely define the text, whether or not the checkbox should be pre-ticked, and whether or not the checkbox should be mandatory to tick for the customer.

How it’s done

To enable the custom checkbox you add a checkbox object in the options part of the call to create the order. The text will be displayed to the consumer aside the checkbox. Links and formatting can be added using Markdown, for example : [link text](url). You can read the status of the checkbox as part of the merchant_requested object on the order when making a Retrieve order call or listen to The “checkbox_change” event. You can find out more about the checkbox object in the API Reference. Below is an example of how to use it.

JSON
{
  //...
  "options": {
    "additional_checkbox": {
      "text": "Lorem ipsum dollar sit amet. [Link](http://klarna.com)",
      "checked": true,
      "required": false
    }
  }
}

When reading the order from the API, there will be a field called additional_checkbox within the merchant_requested object. This field would be set to true if the checkbox was checked.

JSON
{
  "merchant_requested": {
    "additional_checkbox": true
  }
}