KeaBank WebSdk React
Install the NPM package.
``bash`
npm i @keabank/websdk
Import the WidgetSDK module.
`js`
import { WidgetSDK } from '@keabank/websdk';
Initialize the integration
`js`
const sdk = new WidgetSDK({
integrationId: 'your_integration_id',
merchantId: 'your_merchant_id',
});
Open a modal with payment instructions
`js
// Payment parameters
const paymentConfig = {
amount: 100,
orderId: 'order_123456',
paymentPurpose: 'Purchase of digital goods',
currency: 'USDT_TRC20',
defaultTheme: 'LIGHT', // LIGHT or DARK default theme is LIGHT
};
// Initialize the payment
const paymentStatus = sdk.init(paymentConfig);
// retrieve transaction status
paymentStatus.then(status => {
// status can be 'paid', 'cancel', or an Error instance
if (status === 'paid') {
console.log('Payment success');
return;
}
if (status === 'cancel') {
console.log('Payment cancelled by shopper');
return;
}
if (status instanceof Error) {
console.error('Payment failed', status);
}
});
`
Close the modal dialog
`js``
sdk.destroy();