window.PaymoveWidget object. It is deliberately small - configuration stays in the data-* attributes, and from code you only open, close and clean up widgets.
ready()waits for widgets that are starting right now. A widget with invalid configuration does not block the others -ready()resolves anyway, andget()returnsundefinedfor it.- There is no
update()method. You can’t change the configuration after start - remove the widget and insert the script again. - The script uses the
defer(orasync) attribute, sowindow.PaymoveWidgetmay not exist yet when your code runs. Access it only in the script’sonloador afterDOMContentLoaded.
Custom button
Any element with thedata-paymove-open="<widget-id>" attribute opens the modal of the given widget - no JavaScript needed:
- A click on a link with
data-paymove-openopens the modal instead of navigating tohref. Put a fallback page inhref- it will work if the script fails to load. - A click with
Ctrl,Cmd,ShiftorAltheld is ignored, so “open in new tab” works as usual. - Elements with the
disabledattribute oraria-disabled="true"are ignored. - The attribute also works on elements inside Shadow DOM and on elements added to the page later.
ready():
The paymove:completed event
After a successful payment the widget dispatches the paymove:completed event on document:
- The event arrives only once the payment page has confirmed the payment with the paymove API and displayed the confirmation screen.
- It arrives once per payment.
- After the payment the modal stays open so the customer can see the confirmation. They close it with the “End” button, the close icon, a click on the backdrop or the
Esckey.