Unofficial library for working with the LAVA payment system. The official documentation for working with the API is available here.
You can install using package managers such as npm:
npm install zloishavrin/lava-business-payment-library
Connecting into the project:
const { LavaPayment } = require('lava-payment');
All methods available in the LAVA BUSINESS API are implemented.
It is necessary to pass to the constructor project ID, API-key and domain name (if not specified, the default value of 'ru').
const lavaApi = new LavaPayment(SHOP_ID, API_KEY, DOMAIN_NAME);
The payoff amount, unique payment identifier in the merchant system, project identifier (if it was specified in the constructor, it is not necessary to specify it in the method) must be specified.
lavaApi.createPayoff({
shopId: SHOP_ID,
amount: AMOUNT,
orderId: new Date().getTime()
})
It is also mandatory to specify a unique project identifier in Lava (if it was specified in the constructor, it is not necessary to specify it in the method). It is also mandatory to specify a unique payment identifier in the merchant system (orderId) or a payoff number (payoffId).
lavaApi.payoffInfo({
shopId: SHOP_ID,
orderId: new Date().getTime(),
payoffId: PAYOFF_ID
})
It is mandatory to specify a unique project identifier in Lava (if it was specified in the constructor, it is not necessary to specify it in the method).
lavaApi.getTariffsPayoff(SHOP_ID)
The amount to be invoiced, the project identifier (if it was specified in the constructor, it is not necessary to specify it in the method), the unique payment identifier in the merchant system (you can use Date()) are obligatory.
lavaApi.createInvoice({
shopId: SHOP_ID,
sum: SUM,
orderId: new Date().getTime()
})
It is mandatory to specify a unique project identifier in Lava (if it was specified in the constructor, it is not necessary to specify it in the method). The unique payment identifier in the merchant system (orderId) or invoice identifier (invoiceId) must also be specified.
lavaApi.statusInvoice({
shopId: SHOP_ID,
invoiceId: INVOICE_ID,
orderId: ORDER_ID
})
It is mandatory to specify a unique project identifier in Lava (if it was specified in the constructor, it is not necessary to specify it in the method).
lavaApi.getAvailableTariffs(SHOP_ID)
It is mandatory to specify a unique project identifier in Lava (if it was specified in the constructor, it is not necessary to specify it in the method).
lavaApi.getBalance(SHOP_ID)
Package | Assignment |
---|---|
axios | For requests to the LAVA API |
crypto | The package is needed to implement the signature creation method |