Search…
Konbini elements
Learn how to use Konbini elements.
With DigitalRiver.js, you can create a Konbini element that will automatically retrieve and build a select dropdown that can be styled and placed on your page like other DigitalRiver.js elements.

Creating a Konbini element

To create a Konbini element, you should use the createElement function exposed through the DigitalRiver object. This object follows the same pattern and allows for the same custom classes and styles as other elements.
Example
1
var konbiniOptions = {
2
classes: {
3
base: "DRElement",
4
complete: "konbini-complete",
5
empty: "konbini-empty",
6
focus: "konbini-focus"
7
},
8
style: {
9
base: {
10
color: '#495057',
11
height: '35px',
12
fontSize: '1rem',
13
fontFamily: 'apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif',
14
// fontWeight: 'lighter',
15
':hover': {
16
color: '#ccc',
17
},
18
'::placeholder': {
19
color: '#495057'
20
}
21
},
22
focus: {
23
':hover': {
24
color: '#495057',
25
},
26
},
27
empty: {
28
':hover': {
29
color: '#495057',
30
},
31
},
32
complete: {
33
':hover': {
34
color: '#495057',
35
},
36
}
37
}
38
};
39
40
41
let konbini = digitalriverpayments.createElement('konbini', konbiniOptions);
Copied!

Konbini element functions

konbini.mount();

Call this function to place the created Konbini element on your page.
Example
1
<div id="konbini"></div>
2
3
konbini.mount('konbini');
Copied!

konbini.unmount();

Call this function to remove the Konbini element from your page. The element may be re-added to your page by calling mount().
Example
1
konbini.unmount();
Copied!

konbini.destroy();

Call this function to remove the Konbini element from your page as well as remove its functionality. You cannot re-add the destroyed element to your page via mount().
Example
1
konbini.destroy();
Copied!

konbini.update();

Call this function to update the Konbini element's data.
Example
1
let konbiniOptions = {
2
classes: {
3
base: "DRElement",
4
complete: "konbini-complete",
5
empty: "konbini-empty",
6
focus: "konbini-focus"
7
},
8
style: {
9
base: {
10
color: '#495057',
11
height: '35px',
12
fontSize: '1rem',
13
fontFamily: 'apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif',
14
// fontWeight: 'lighter',
15
':hover': {
16
color: '#ccc',
17
},
18
'::placeholder': {
19
color: '#495057'
20
}
21
},
22
focus: {
23
':hover': {
24
color: '#495057',
25
},
26
},
27
empty: {
28
':hover': {
29
color: '#495057',
30
},
31
},
32
complete: {
33
':hover': {
34
color: '#495057',
35
},
36
}
37
}
38
};
39
40
41
konbini.update(konbiniOptions);
Copied!

Konbini element events - konbini.on('event', handler);

Use this functionality to monitor events that can be used to build and enhance your purchase flow.
Event
Triggered When
ready
The created element is loaded and ready to accept an update request.
focus
The element has gained focus.
blur
The element has lost focus.
change
The element's state has changed.

Ready

The Ready event triggers when the Konbini Element has loaded and is available to take an update() call.
Example
1
konbini.on('ready', function(event) {
2
//konbini element is ready and can accept an update call
3
});
Copied!
In addition to the type of element returned in the ready function, the online banking element returns hasAvailableBanks. This Boolean reflects whether the currency and country combination specified has banks available for payment. If this is false, there are no banks available for payment.
Key
Value
elementType
onlinebanking
hasAvailableStores
A true or false value signaling whether there are stores available for payment.
Response object
1
{
2
elementType: "konbini",
3
hasAvailableStores: true
4
}
Copied!

Focus

A Focus event triggers when the element gains focus.
Example
1
konbini.on('focus', function(event) {
2
//receive the event
3
}
Copied!
Response object
1
{
2
elementType: "konbini"
3
}
Copied!

Blur

A Blur event triggers when the Konbini element no longer has focus.
Example
1
konbini.on('blur', function(event) {
2
//receive the event
3
}
Copied!
Response object
1
{
2
elementType: "konbini"
3
}
Copied!

Change

A Change event triggers when the Konbin element's state has changed. When using this element, you will only receive this event when the customer selects a store.
Example
1
konbini.on('change', function(event) {
2
console.log('konbini change', event);
3
});
Copied!
Key
Value Description
complete
Whether the element is in a complete state.
empty
Whether the element is empty.
elementType
The element type.
error
An error object (if applicable).
value
The value of the selected option.
Response object
1
{
2
complete: true,
3
empty: false,
4
elementType: "konbini",
5
error: null,
6
value: "86"
7
}
Copied!
In this flow, you can now use the createSource method to create a source using the Konbini element.
Last modified 1yr ago