1.0.38 • Published 12 months ago

monobank-helper v1.0.38

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

Monobank Helper

Introduction

This is a TypeScript SDK designed to interact with the Monobank API. It provides various methods for invoice management, payment processing, and QR terminal operations.

Installation

To install the package, you can use npm:

npm install monobank-helper

Usage

First, import and instantiate the MonobankSdk class with your API key:

import MonobankSdk from 'monobank-helper';

const apiKey = 'your-api-key';
const monobankSdk = new MonobankSdk(apiKey);

Create an Invoice

To create an invoice, use the following code:

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);
    });

Get Invoice Status

To get the status of an invoice, use the following code:

const invoiceId = 'your-invoice-id';

monobankSdk.getInvoiceStatus(invoiceId)
  .then(response => {
    console.log('Invoice Status:', response);
  })
  .catch(error => {
    console.error('Error fetching invoice status:', error);
  });

Cancel Invoice Payment

To cancel an invoice payment, use the following code:

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);
  });

Invalidate an Invoice

To invalidate an invoice, use the following code:

const requestBody = {
  // your request body here
};

monobankSdk.invalidateInvoice(requestBody)
  .then(response => {
    console.log('Invoice Invalidated:', response);
  })
  .catch(error => {
    console.error('Error invalidating invoice:', error);
  });

Get Public Key

To get the public key for signature verification, use the following code:

monobankSdk.getPublicKey()
  .then(response => {
    console.log('Public Key:', response);
  })
  .catch(error => {
    console.error('Error fetching public key:', error);
  });

Get QR Terminal Info

To get information about a QR terminal, use the following code:

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);
  });

Delete Payment Amount

To delete a payment amount, use the following code:

const qrId = 'your-qr-id';

monobankSdk.deletePaymentAmount(qrId)
  .then(() => {
    console.log('Payment Amount Deleted');
  })
  .catch(error => {
    console.error('Error deleting payment amount:', error);
  });

Get QR Terminal List

To get a list of QR terminals, use the following code:

monobankSdk.getQrTerminalList()
  .then(response => {
    console.log('QR Terminal List:', response);
  })
  .catch(error => {
    console.error('Error fetching QR terminal list:', error);
  });

Create Payment Using Card Token

To create a payment using a card token, use the following code:

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);
  });

Create Payment Using Card Details

To create a payment using card details, use the following code:

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);
  });
1.0.38

12 months ago

1.0.37

12 months ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago