For the complete documentation index, see llms.txt. This page is also available as Markdown.

Widget

How to communicate with widget?

You can interact with our widget using java script api in real-time, without the need to develop complex backend integration.

TransactionLink's JS API is available in a global variable named

JavaScript
window.transactionlink

How to implement widget communication

To ensure the correct functioning of the widget:

  1. Define <transactionlink-widget /> element in the DOM.

  2. Define window.transactionlink_ready method. It is called when the widget and widget API are ready to use.

    window.transactionlink_ready = () => {
        transactionlink.setOptions({ token })
        transactionlink.open()
    }
  3. Link https://widget.transactionlink.io/transactionlink-widget.umd.js to the file:

    • It should be located at the end of the file

    • Or added dynamically after completing points 1 and 2.

      // Create a script element
      const script = document.createElement('script');
      
      // Set the source attribute to the URL of the script
      script.src = 'https://widget.transactionlink.io/transactionlink-widget.umd.js';
      
      // Append the script element to the document's head
      document.head.appendChild(script);

Simple code example:

Advanced code example:

Content Security Policy

To enhance security, include the following Content Security Policy (CSP) directive headers in the index.html file, within the tag:

WebView Support

Our widget is not fully supported in WebView environments, such as in-app browsers or embedded mobile views.

Due to technical limitations specific to WebViews, the widget may not function correctly. Examples include:

  • issues with document input handling,

  • unintended widget refresh after the app enters idle/sleep mode,

  • inconsistent camera behavior in third-party integrations on Android and iOS,

  • inability to open certain integrations in a new browser tab.

For the best experience, please ensure the widget is opened in a standard system browser (Safari, Chrome, Firefox, Edge).

Last updated