Offline Refund elements
Learn how to use the offline refund element.
With certain payment flows such as Konbini, Online Banking, or Wire Transfer, it may be necessary to collect details from your customer to facilitate a refund.
To create an offline refund 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.With this element, you must provide a
refundToken
, which is provided in the refund response from our APIs.Example
var offlineOptions = {
classes: {
base: "DRElement",
complete: "offline-refund-complete",
invalid: "offline-refund-invalid"
},
style: {
base: {
color: '#495057',
height: '35px',
fontSize: '1rem',
fontFamily: 'apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif',
fontWeight: 'lighter',
':hover': {
color: '#ccc',
},
'::placeholder': {
color: '#495057'
}
},
focus: {
':hover': {
color: '#495057',
},
},
empty: {
':hover': {
color: '#495057',
},
},
complete: {
':hover': {
color: '#495057',
},
}
},
refundToken: 'fb19fceb-a5e7-454d-af1a-017b7bd73d5b'
};
let offlineRefund = digitalriverpayments.createElement('offlinerefund', offlineOptions);
Call this function to place the created offline refund element on your page.
Example
<div id="offline-refund"></div>
offlineRefund.mount('offline-refund')
Call this function to remove the offline refund element from your page. The element may be re-added to your page by calling
mount()
.Example
offlineRefund.unmount();
Call this function to remove the offline refund element from your page as well as remove its functionality. You cannot re-add an element that has been destroyed to your page via
mount()
.Example
offlineRefund.destroy();
Use this function to listen to events that can be used to build and enhance your purchase flow.
The Ready event triggers when the element loads and is available to take user input.
Example
offlineRefund.on('ready', function(event) {
//offline refund element is ready and can accept user input
});
Response object
{
elementType: "offlinerefund"
}
A change event triggers when the offline refund element's state has changed. If using this element, you will only receive this event when the customer has filled out the form, and the data has been accepted. At this point, you may remove the element from your screen by calling
unmount()
or destroy()
.Example
offlineRefund.on('change', function(event) {
console.log('offline refund change', event);
});
Key | Value Description |
---|---|
complete | Whether the element is in a complete state. |
elementType | The type of element. |
Response object
{
complete: true,
empty: false,
elementType: "offlinerefund",
error: null
}
Last modified 4mo ago