Upgrading from 0.0.x
0.1.0 is the first release since 2021. It modernises the package and fixes several bugs, and it changes a few things you may rely on.
| Change | What to do |
|---|---|
| Requires Node.js 22.12+ and ships as ESM only. | Upgrade Node. import works as before; CommonJS require("@ameria/vpos-sdk") works on 22.12+. |
client.username and client.password are gone. |
Read credentials from your own config, not from the client. client.clientId still works. |
HTTP errors and non-JSON answers throw AmeriaHttpError. They used to resolve with an HTML string. |
Wrap calls in try/catch — see Errors. |
| Requests time out after 30 s. | Pass timeoutMs if you need longer. |
currency is sent as the ISO numeric code ("051" for AMD). |
Nothing — "AMD", "USD", "EUR" and "RUB" are still accepted and converted. |
lang: "hy" is sent as am, the bank’s code for Armenian. |
Nothing; you can also pass "am". |
Some getPaymentDetails field types were corrected: OrderID and OrderStatus are strings, RefundedAmount and ExchangeRate are numbers. |
Adjust comparisons if you relied on the old types. |
Client is now AmeriaClient. |
Rename the import. Client still works but is deprecated. |
Option names are camelCase: orderId, backUrl, cardHolderId (were orderID, backURL, cardHolderID). |
Rename them in initPayment and makeBindingPayment calls. |
Type names lost their I/T prefixes: IInitPaymentParams → InitPaymentParams, TCurrency → Currency, TPaymentEnum → PaymentTypeCode. |
Rename type imports. Request body types are no longer exported. |
| Amounts must be positive finite numbers. | Invalid amounts now throw RangeError before any request. |
- The payment page URL had
&lang=in it, so the language never reached the bank. getPendingTransactionssent the start date as the end date.getBindings("None")always threw.getPaymentIdwas typed as returning payment details.
verifyPayment, which checks a
payment’s status, amount, currency and order in one call; a fetch option on the client;
Payment types MirCard, ApplePay, EPGCardApplePay and Amex; timeout and
paymentServiceType on initPayment; 3-D Secure fields on makeBindingPayment;
BankInfo on payment details; ssnCheck.