@paymentsgate/easy-api-nodejs
v1.0.0
Published
PaymentsGate Easy API client
Readme
Payments Gate Easy NodeJS Client
This is a complete NodeJS module for communication with paymentsgate service.
Features
- Wallet, banks, deal, pay-in, payout, and FX methods
- TypeScript-only source in
src/*with compiled output inlib/* - Get wallet
- Get banks list
- Payin orders
- Payot orders
- Quotes (pre-payout quote calculate)
Usage
npm i @paymentsgate/easy-api-nodejsconst {
EasyApiClient,
Currencies,
DealLanguages,
DealSubtypes,
createDealPayInRequest,
createFxCalculationRequest,
} = require('@paymentsgate/easy-api-nodejs');
const client = new EasyApiClient({
endpoint: 'https://api.example.com',
credentialsPath: './examples/credentials.json',
});
const banks = await client.getBanks({
tag: DealSubtypes.SBP,
});
const payin = await client.createPayIn(
createDealPayInRequest({
amount: 100,
currency: Currencies.KZT,
invoiceId: `INV-${Date.now()}`,
clientId: `CLIENT-${Date.now()}`,
type: DealSubtypes.P2P,
lang: DealLanguages.RU,
}),
);
const quote = await client.calculateFxPost(
createFxCalculationRequest({
currencyFrom: Currencies.USDT,
currencyTo: Currencies.KZT,
amount: 100,
subtype: DealSubtypes.P2P,
}),
);Methods
getWallet()getBanks({ search, tag })getDeal(dealId)createPayIn(payload)createPayOut(payload)calculateFxGet(params)calculateFxPost(payload)
Errors
All request failures extend ApiError.
Available specialized errors include:
MissingApiKeyErrorCredentialsFileErrorInvalidEndpointErrorTransportErrorRequestErrorUnauthorizedErrorForbiddenErrorDuplicateDealErrorInvalidCurrencyFromErrorInvalidCurrencyToErrorExchangeDirectionNotAvailableError
Enums and DTO helpers
Runtime exports include:
CurrenciesDealSubtypesDealStatusesDealDirectionsDealLanguagesRecipientTypesBankTypesBankPaymentSystemsTtlUnitsWidgetVersionsDealPayOutBaseCalculationTypesDealPayOutFeesStrategiescreateDealPayInRequest(...)createDealPayOutRecipient(...)createDealPayOutRequest(...)createFxCalculationRequest(...)
Examples
Ready-to-run examples are available in examples/config.js, examples/credentials.example.json, examples/create_payin.js, and examples/get_quote.js.
Run npm run build before launching the local examples, because they use the compiled lib/cjs output.
Available currencies
USDT EUR USD TRY CNY JPY GEL AZN INR AED KZT UZS TJS EGP PKR IDR BDT GBP RUB
THB KGS PHP ZAR ARS GHS KES NGN AMD BYN TRX ETH XOF CAD AFN ALL AUD BAM BGN
BHD BIF BND BOB BRL BWP BZD CDF CHF CLP COP CRC CVE CZK DJF DKK DOP DZD EEK
ERN ETB GNF GTQ HKD HNL HRK HUF ILS IQD IRR ISK JMD JOD KHR KMF KRW KWD LBP
LKR LTL LVL LYD MAD MDL MGA MKD MMK MNT MOP MUR MXN MYR MZN NAD NIO NOK NPR
NZD OMR PAB PEN PLN PYG QAR RON RSD RWF SAR SDG SEK SGD SOS SYP TND TOP TTD
TWD TZS UAH UGX UYU VEF VND YER ZMKQAR RON RSD RWF SAR SDG SEK SGD SOS SYP TND TOP TTD TWD TZS UAH UGX UYU VEF VND YER ZMK ``
Available payment methods
p2p
c2c
m10
mpay
sbp
sbpqr
iban
upi
imps
spei
pix
rps
ibps
bizum
rkgs
kgsphone
krungthainext
sber
kztphone
bkash
nagad
alipay
accountegp
accountphp
sberqr
maya
gcash
banktransferphp
banktransferars
phonepe
freecharge
instapay
instapayqr
vodafonecash
orangecash
razn
rtjs
skzt
scny
vtbcny
sgel
seur
stry
sthb
sberpay
sberpay_s
tpay
opay
moniepoint
palmpay
wave
orangemoney
orangemoneyjod
moovmoney
rtjscard
ruzs
amobile
payid
baridi
multiwidget
banktransfermad
cih
cashplus
elqr
odengi
banktransferdop
sinpemovil
tryqr
bsb
banktransfermnt
stcpay
upiqr
ifsc
tjsbank
sortgbp
unionpay
ecomazn
ecomrub
banktransferthb
banktransferzar
dcecomusd
dcecomeur
benefitpay
cliq
papara
blik
promptpayqr
applepay
ideal
napas
vndqr
inrqr
egpqr
oneclick
thaiqr
mobilecom
banktransferuyu
banktransferngn
mpesa
airtel
equitel
fib
