@mrboombastic/node-przelewy24
Version:
A simple library for connecting Przelewy24 service
61 lines (52 loc) • 2.08 kB
JavaScript
import {P24} from '../dist/index.js';
export const p24 = new P24({
merchantId: 107038,
posId: 107038,
apiKey: '170f9d9fcb55e4bc4bc2ef3e2fb2b388',
crcKey: '0130dc1301919941',
sandbox: true,
debug: true,
}
);
/*
const testing = await p24.createTransaction({
amount: 100,
currency: 'PLN',
description: 'Test',
email: 'test@example.com',
channel: Channel.CardsAppleGooglePay + Channel.Transfer + Channel.TraditionalTransfer,
country: 'PL',
sessionId: "wefwefjweifvvvff34effffwf",
language: 'PL',
urlReturn: 'https://google.com',
urlStatus: 'https://losses-some-clicks-slight.trycloudflare.com/api/p24',
urlCardPaymentNotification: 'https://losses-some-clicks-slight.trycloudflare.com/api/p24',
});*/
/*
const testing = await p24.getTransaction("419cff08-cf7c-4b4d-9932-8b441ad8b996")
console.log("testing", testing);
console.log("paid:", testing.status)
*/
/*
let testCardNotification;
JSON.parse(`{"amount":6999,"3ds":true,"method":241,"refId":"A702392E-82837263-0C0A1120-277E246E","orderId":4300610645,"sessionId":"43ccf229-8754-433e-afeb-30667fd8050f","bin":411111,"maskedCCNumber":"XXXX XXXX XXXX 1111","ccExp":"122031","hash":"cli_9cd1uk0Ft6rRZpti","cardCountry":"","risk":0,"liabilityshift":false,"cardType":"visa","sign":"666cfcbd3790b969fafb11fcc7fdb8a01657433f51e3b1a98d480731150728faa0d914f987cb08362b1308aa2338370e"}`)
//delete testCardNotification.cardCountry;
console.log(testCardNotification);
console.log(p24.verifyCardNotification(testCardNotification));
*/
const a =await p24.refund({
requestId: crypto.randomUUID(),
refundsUuid: '34ca1625-1f02-4d88-bfbe-f6b478e0ece4',
refunds: [
{
amount: 100,
sessionId: '65557e6c-9116-416f-a18f-1d0692a89cb7',
orderId: 4300657580,
description: 'Zwolnienie blokady'
}
]
})
/*
const charge = await p24.chargeCard({token: "A82310CEA2-BAA3C3-8624A4-2CF17445C8"});
console.log(charge);
*/