A TypeScript SDK for interacting with Monobank API, providing methods for invoice management, payment processing, and QR terminal operations.
npm install monobank-helperbash
npm install monobank-helper
`
Usage
First, import and instantiate the MonobankSdk class with your API key:
`javascript
import MonobankSdk from 'monobank-helper';
const apiKey = 'your-api-key';
const monobankSdk = new MonobankSdk(apiKey);
`
$3
To create an invoice, use the following code:
`javascript
const requestBody = {
// your request body here
};
monobankSdk.createInvoice(requestBody, 'CMS Name', 'CMS Version')
.then(response => {
console.log('Invoice Created:', response);
})
.catch(error => {
console.error('Error creating invoice:', error);
});
`
$3
To get the status of an invoice, use the following code:
`javascript
const invoiceId = 'your-invoice-id';
monobankSdk.getInvoiceStatus(invoiceId)
.then(response => {
console.log('Invoice Status:', response);
})
.catch(error => {
console.error('Error fetching invoice status:', error);
});
`
$3
To cancel an invoice payment, use the following code:
`javascript
const requestBody = {
// your request body here
};
monobankSdk.cancelInvoicePayment(requestBody)
.then(response => {
console.log('Invoice Payment Cancelled:', response);
})
.catch(error => {
console.error('Error canceling invoice payment:', error);
});
`
$3
To invalidate an invoice, use the following code:
`javascript
const requestBody = {
// your request body here
};
monobankSdk.invalidateInvoice(requestBody)
.then(response => {
console.log('Invoice Invalidated:', response);
})
.catch(error => {
console.error('Error invalidating invoice:', error);
});
`
$3
To get the public key for signature verification, use the following code:
`javascript
monobankSdk.getPublicKey()
.then(response => {
console.log('Public Key:', response);
})
.catch(error => {
console.error('Error fetching public key:', error);
});
`
$3
To get information about a QR terminal, use the following code:
`javascript
const qrId = 'your-qr-id';
monobankSdk.getQrTerminalInfo(qrId)
.then(response => {
console.log('QR Terminal Info:', response);
})
.catch(error => {
console.error('Error fetching QR terminal info:', error);
});
`
$3
To delete a payment amount, use the following code:
`javascript
const qrId = 'your-qr-id';
monobankSdk.deletePaymentAmount(qrId)
.then(() => {
console.log('Payment Amount Deleted');
})
.catch(error => {
console.error('Error deleting payment amount:', error);
});
`
$3
To get a list of QR terminals, use the following code:
`javascript
monobankSdk.getQrTerminalList()
.then(response => {
console.log('QR Terminal List:', response);
})
.catch(error => {
console.error('Error fetching QR terminal list:', error);
});
`
$3
To create a payment using a card token, use the following code:
`javascript
const requestBody = {
// your request body here
};
monobankSdk.createPayment(requestBody, 'CMS Name', 'CMS Version')
.then(response => {
console.log('Payment Created:', response);
})
.catch(error => {
console.error('Error creating payment:', error);
});
`
$3
To create a payment using card details, use the following code:
`javascript
const requestBody = {
// your request body here
};
monobankSdk.createCardPayment(requestBody, 'CMS Name', 'CMS Version')
.then(response => {
console.log('Card Payment Created:', response);
})
.catch(error => {
console.error('Error creating card payment:', error);
});
``