@link.money/linkmoney-web
v1.1.1
Published
LinkMoney Web SDK
Downloads
9
Keywords
Readme
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>;
};