@link.money/link-sdk
v0.0.7
Published
Link Financial JavaScript SDK
Downloads
610
Keywords
Readme
Link Financial JavaScript SDK
Installation
npm
npm install @link.money/link-sdk
or
yarn add @link.money/link-sdk
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/link-js-sdk/latest/link-js-sdk.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/link-sdk';
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>;
};