1.0.6 • Published 12 months ago

@link.money/linkmoney-web v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

LinkMoney Web SDK

Installation

npm

npm install @link.money/linkmoney-web

or

yarn add @link.money/linkmoney-web

Use

HTML and Vanilla JS

<html>
  <body>
    <button id="link-btn">Pay using LinkPay</button>
    <script type="module">
      import Link from 'https://static.link.money/linkmoney-web/v1/latest/linkmoney-web.min.js';

      document.addEventListener(
        'DOMContentLoaded',
        () => {
          document
            .getElementById('link-btn')
            .addEventListener('click', async function () {
              const config = {
                sessionKey: '{SESSION_KEY}',
                redirect: '{REDIRECT_URL}',
                environment: 'production' | 'sandbox',
              };

              const link = Link.LinkInstance(config);
              link.action();
            });
        },
        false
      );
    </script>
  </body>
</html>

React

import Link from '@link.money/linkmoney-web';

export const LinkPayButton = () => {
  const handleClick = () => {
    const linkConfig = {
      sessionKey: '{SESSION_KEY}',
      redirect: '{REDIRECT_URL}',
      environment: 'production' | 'sandbox',
    };
    const link = Link.LinkInstance(linkConfig);
    link.action();
  };

  return <button onClick={handleClick}>Pay by Bank</button>;
};

Further Reading

1.0.6

12 months ago

1.0.4

12 months ago

1.0.3

1 year ago