pay_qr_sberbank v2.0.3
Qr Pay
installation
yarn add pay_qr_sberbank
npm i pay_qr_sberbank0
Configuration
If you have angelic patience, and you were able to gain access to combat access, you have to create your ssl cert in sberbank UI, DON'T DELETE USERS AFTER IT, after that you will fight with tech support to get a new certificate, since you cannot get a new one, because bugs ))
let config = {
qr_type: 'toString',
debug: true, //debug mode
client_id: 'your-client-id-from-sber-app',
client_secret: 'your-client-secret-from-sber-app',
access_token_url: 'https://dev.api.sberbank.ru/ru/prod/tokens/v2/oauth', //change if you're using production API
create_order_url: 'https://dev.api.sberbank.ru/ru/prod/order/v1/creation', //change if you're using production API
get_order_status_url: 'https://dev.api.sberbank.ru/ru/prod/order/v1/status', //change if you're using production API
scope: 'https://api.sberbank.ru/order.create https://api.sberbank.ru/order.status https://api.sberbank.ru/sberbankid/operation' // scope is string of urls, are using in sberbank API to user access
agentOptions: {
passphrase: 'lool ur pass',
pfx: __dirname + '/your cert name.'
}
};
AgentOptions
Passphrase
It is pass you enter on a site.
pfx
It is dir to your p12 cert or Buffer.
If you don't have cert just don't use agentOptions.
qr_type
it is a flag, for configure qr view:
- toString;
- toDataURL.
Look qrcode.
let options = {
order: {
member_id: '1',
order_number : '774635526637',
order_params_type: [
{
position_name : 'Water Still',
position_count : 10,
position_sum : 4800,
position_description : 'Water Still',
},
],
id_qr: '1000100051',
order_sum: 48000,
currency: '810',
description: 'Water Still'
},
status: {
order_id: "89",
RqUID: "39227160133683350867440322682609"
},
qrURL: "Your sberbank URL for QR"
};
Usage
Authentication
1 rule: Call methods after Auth().
const sberbank_QR = new Sberbank_QR(config);
(async () => {
await sberbank_QR.auth();
...
})();
Generate
Or create order. this method will ask sberbank to create new payment. 2 rule: Be careful and check carefully your options.
const sberbank_QR = new Sberbank_QR(config);
(async () => {
await sberbank_QR.auth();
await sberbank_QR.generate(options);
})();
Status
You can get status of order if you have order_id and RqUID.
Using default sberbank response
const sberbank_QR = new Sberbank_QR(config);
(async () => {
await sberbank_QR.auth();
await sberbank_QR.generate(options);
await sberbank_QR.get_status();
})();
Using Your own options
Use options.status for your status options.
const sberbank_QR = new Sberbank_QR(config);
(async () => {
await sberbank_QR.auth();
await sberbank_QR.generate(options);
await sberbank_QR.get_status(options);
})();
Use qr
You can generate qr without order creation in sberbank.
const sberbank_QR = new Sberbank_QR(config);
(async () => {
let qr = await sberbank_QR.qr(options);
console.log(qr);
})();
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago