@kwentapay/web-client
v0.1.0
Published
Include Kwenta payments directly in your web app
Downloads
2
Readme
@kwentapay/web-client
A TypeScript / JavaScript library to integrate the Kwenta GUI directly into your web application.
Installation
| Package manager | Command |
| --------------- | ------------------------------------ |
| NPM | npm install @kwentapay/web-client
|
| Yarn | yarn add @kwentapay/web-client
|
| PNPM | pnpm install @kwentapay/web-client
|
Example
In your HTML file, add an element with an ID to mount the Kwenta iframe into:
<div id="kwenta-iframe" />
Then, with JavaScript, initialize the Kwenta client and load a transaction URL:
import Kwenta from "@kwentapay/web-client";
const kwenta = new Kwenta.WebClient({
parentId: "kwenta-iframe",
onPayerPrepaid: () => alert("Current payer has prepaid successfully"),
onPayersInvited: () => alert("Current payer has invited the other payers"),
});
kwenta.load("https://api.kwenta.st/o/4e83556f-a105-496e-8457-cea37d5bc173");
Whenever you need to unload the Kwenta iframe, you can call the dispose
method:
kwenta.dispose();
See also
License
This project is licensed under the MIT License.