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: