upc-payment-js allows to initiate and process a payment in a separate browser tab or within an iframe directly on the website
npm install upc-payment-jsupc-payment-js allows to initiate and process a payment in a separate browser tab or within an iframe directly on the website
``bash`
$ npm install upc-payment-js$3
https://github.com/upcecconnect/upc-payment-js/blob/main/dist/es/upc-payment-js.d.ts
Once the package is installed, you can import the library using import or require approach:
`js
import { UpcPayment } from 'upc-payment-js';
const payment = new UpcPayment({
merchant: {
id: '012345',
terminalId: 'A012345',
signature: 'Signature',
},
customer: {
email: '',
firstName: '',
lastName: '',
phoneCountryCode: '380',
phoneNumber: '001234567',
},
iframeProps: {
wrapperSelector: '#some-wrapper-id',
callback: (data) => callbackHandler(data),
},
});
payment.pay({
currencyNumericCode: '980',
description: 'description',
orderId: 'orderId',
// yymmddhhmmss
purchaseTime: '241231235959',
totalAmountCents: 12345,
});
`
Using link:
`html`
Or download and use lib directly
https://github.com/upcecconnect/upc-payment-js/blob/main/dist/iife/upc-payment-js.js
`js``
if (window.UpcPayment) {
const payment = new UpcPayment({
// ...
});
payment.pay({
//...
});
}