vopay-node
v1.1.3
Published
An unofficial library that wraps VoPay REST API(s) to be used in node.js projects
Downloads
9
Maintainers
Readme
VoPay Node
[In Development]
This is an unofficial library to leverage VoPay REST API(s) for payment solutions.
Table of Contents
Installation
npm i vopay-node
or
yarn add vopay-node
Usage
You will be needed to create a VoPay instance with the details provided by VoPay team. Things you will need for the instance:
| Name | | ------------- | | AccountID | | ApiKey | | ApiSecret |
const VoPay = require('vopay-node')
let VoPayClient = new VoPay({
AccountID: "YOUR_ACCOUNT_ID",
ApiKey: "YOUR_API_KEY",
ApiSecret: "YOUR_API_SECRET"
})
Response Handling
vopay-node
uses axios as HTTP client.
// USING PROMISES
VoPayClient.iq11.generateEmbedURL({
RedirectURL: "https://redirect.com/page?Token=1234"
})
.then(response => console.log(response))
.catch((error) => {
console.log(error);
});
// USING ASYNC/AWAIT
const loadEmbedUrl = async () => {
try {
const embedUrl = await VoPayClient.iq11.generateEmbedURL({
RedirectURL: "https://redirect.com/page?Token=1234"
})
console.log(embedUrl);
} catch(error) {
console.log(error);
}
}
API Reference
All methods return a Promise.
In cases where you are needed to provide
AccountID
,Key
andSignature
. you can avoid adding that, since the library instance is already having them after you initialized it.
Partner - Official Docs
Create User Account - Official Docs
This endpoint is used to create a VoPay account. You will need to sign-up as a partner account in order to use this endpoint and start creating VoPay accounts for your users.
This Endpoint does not mark the account as active, you will need to submit the rest of the required information in the POST /account/submit-extended-info endpoint
// Check Official Docs for more fields
const { Success, ErrorMessage, AccountID, APISharedSecret, APIKey } = await VoPayClient.partner.createUserAccount({
Name: "{Name}",
ClientAccountEnabled: "{ClientAccountEnabled}",
EmailAddress: "{EmailAddress}",
})
Get a list of User Accounts - Official Docs
This endpoint is used to get a list of accounts created using a partner account. It will return the accounts data including shareholder, signing authority and balance information
// Check Official Docs for more fields
const { Success, ErrorMessage, PartnerAccount, Accounts } = await VoPayClient.partner.accountLists()
IQ11 - Official Docs
Generate Embed URL - Official Docs
// Check Official Docs for more fields
const { EmbedURL, Success, ErrorMessage } = await VoPayClient.iq11.generateEmbedURL({
RedirectURL: "https://redirect.com/page?Token=1234"
})
Token Info - Official Docs
// Check Official Docs for more fields in response
const { MaskedAccount, Success, ErrorMessage, BankName } = await VoPayClient.iq11.tokenInfo({
Token: "IQ11_TOKEN"
})
Tokenize - Official docs
// Check Official Docs for more fields in response
const { Token, Success, ErrorMessage } = await VoPayClient.iq11.tokenize()
Account - Official Docs
Get Account Balance - Official Docs
// Check Official Docs for more fields in response
const { AccountBalance, Success, ErrorMessage } = await VoPayClient.account.balance({
Currency: "{Currency}"
})
Get Account Transactions - Official Docs
// Check Official Docs for more fields in response
const { Transactions, Success, ErrorMessage, NumberOfRecords } = await VoPayClient.account.transactions({
StartDateTime: "{StartDateTime}",
EndDateTime: "{EndDateTime}",
Currency: "{Currency}",
TransactionType: "{TransactionType}",
TransactionID: "{TransactionID}",
ClientReferenceNumber: "{ClientReferenceNumber}",
ScheduledTransactionID: "{ScheduledTransactionID}",
PayLinkStatus: "{PayLinkStatus}"
})
Cancel Transaction - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionID, TransactionStatus } = await VoPayClient.account.cancelTransaction({
TransactionID: "{TransactionID}"
})
Set Webhook URL - Official Docs
The purpose of the webhook URL is to notify users of any changes in transaction status.
// Check Official Docs for more fields in response
const { Success, ErrorMessage } = await VoPayClient.account.setWebhookURL({
WebHookUrl: "{WebHookUrl}",
Disabled: "{Disabled}"
})
Get Webhook URL - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, WebHookURL } = await VoPayClient.account.getWebhookURL()
Test Webhook URL - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage } = await VoPayClient.account.testWebhookURL()
Transfer funds to another VoPay Account - Official Docs
This method allows you to transfer funds between VoPay accounts.
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionID } = await VoPayClient.account.transferAccountFundsTo({
Amount: "{Amount}",
Currency: "{Currency}",
RecipientAccountID: "{RecipientAccountID}",
ClientReferenceNumber: "{ClientReferenceNumber}",
Notes: "{Notes}",
ParentTransactionID: "{ParentTransactionID}",
IdempotencyKey: "{IdempotencyKey}"
})
Transfer funds from another VoPay Account to your VoPay Account - Official Docs
This method allows you to transfer funds from a pre-authorized VoPay account to your VoPay account.
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionID } = await VoPayClient.account.transferAccountFundsFrom({
Amount: "{Amount}",
Currency: "{Currency}",
DebitorAccountID: "{DebitorAccountID}",
ClientReferenceNumber: "{ClientReferenceNumber}",
Notes: "{Notes}",
IdempotencyKey: "{IdempotencyKey}"
})
Set Up Auto Balance Transfer - Official Docs
This method allows you to set up an auto-balance transfer from your VoPay account to your linked bank account. The frequency available to set the auto-transfer can be daily, weekly, bi-weekly or monthly.
// Check Official Docs for more fields in response
const { Success, ErrorMessage } = await VoPayClient.account.setupAutoBalanceTransfer({
ScheduleStartDate: "{ScheduleStartDate}",
AutoBalanceTransferAmount: "{AutoBalanceTransferAmount}",
TypeOfFrequency: "{TypeOfFrequency}",
EmailAddress: "{EmailAddress}",
FirstName: "{FirstName}",
LastName: "{LastName}",
CompanyName: "{CompanyName}",
Address1: "{Address1}",
City: "{City}",
Province: "{Province}",
Country: "{Country}",
PostalCode: "{PostalCode}",
AccountNumber: "{AccountNumber}",
FinancialInstitutionNumber: "{FinancialInstitutionNumber}",
BranchTransitNumber: "{BranchTransitNumber}",
FlinksAccountID: "{FlinksAccountID}",
FlinksLoginID: "{FlinksLoginID}",
Token: "{Token}",
PlaidPublicToken: "{PlaidPublicToken}",
PlaidAccessToken: "{PlaidAccessToken}",
PlaidAccountID: "{PlaidAccountID}",
PlaidProcessorToken: "{PlaidProcessorToken}",
InveriteRequestGUID: "{InveriteRequestGUID}"
})
Get Auto Balance Transfer Details - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, AutoBalanceTransferAmount, NameOfFrequency,... } = await VoPayClient.account.getAutoBalanceTransferInfo()
Cancel Auto Balance Transfer - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, Status } = await VoPayClient.account.cancelAutoBalanceTransfer()
EFT - Official Docs
Fund Your Vopay Account - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionID } = await VoPayClient.eft.fundAccount({
FirstName: "{FirstName}",
LastName: "{LastName}",
CompanyName: "{CompanyName}",
DOB: "{DOB}",
PhoneNumber: "{PhoneNumber}",
Address1: "{Address1}",
City: "{City}",
Province: "{Province}",
Country: "{Country}",
PostalCode: "{PostalCode}",
AccountNumber: "{AccountNumber}",
FinancialInstitutionNumber: "{FinancialInstitutionNumber}",
BranchTransitNumber: "{BranchTransitNumber}",
Amount: "{Amount}",
Currency: "{Currency}",
ClientReferenceNumber: "{ClientReferenceNumber}",
KYCPerformed: "{KYCPerformed}",
KYCReferenceNumber: "{KYCReferenceNumber}",
EmailAddress: "{EmailAddress}",
IPAddress: "{IPAddress}",
FlinksAccountID: "{FlinksAccountID}",
FlinksLoginID: "{FlinksLoginID}",
Token: "{Token}",
PlaidPublicToken: "{PlaidPublicToken}",
PlaidAccessToken: "{PlaidAccessToken}",
PlaidAccountID: "{PlaidAccountID}",
PlaidProcessorToken: "{PlaidProcessorToken}",
InveriteRequestGUID: "{InveriteRequestGUID}",
TransactionLabel: "{TransactionLabel}",
Notes: "{Notes}",
DelayBankingInfo: "{DelayBankingInfo}",
IdempotencyKey: "{IdempotencyKey}"
})
Get Status of a Fund Transaction - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionStatus, SubTransactions } = await VoPayClient.eft.getFundTransactionStatus({
TransactionID: "{TransactionID}"
})
Get Details of a Fund Transaction - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionStatus, TransactionDateTime, Amount, SubTransactions } = await VoPayClient.eft.getFundTransactionInfo({
TransactionID: "{TransactionID}"
})
Withdraw funds out of your VoPay account - Official Docs
This endpoint is used to take funds out of your VoPay account, and deposit them to the specified recipient’s bank account. In the below endpoint, either CompanyName OR FirstName and LastName must be provided.
If either Token, Flinks (FlinksAccountID, FlinksLoginID), Inverite (InveriteRequestGUID), or Plaid (PlaidPublicToken/PlaidAccessToken, PlaidAccountID) is provided, then the FinancialInstitutionNumber, BranchTransitNumber, and AccountNumber will not be required.
If the bank information is provided (FinancialInstitutionNumber, BranchTransitNumber, and AccountNumber), then the Address1, City, Province, Country, and PostalCode are required.
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionID } = await VoPayClient.eft.withdraw({
ClientAccountID: "{ClientAccountID}",
FirstName: "{FirstName}",
LastName: "{LastName}",
CompanyName: "{CompanyName}",
DOB: "{DOB}",
PhoneNumber: "{PhoneNumber}",
Address1: "{Address1}",
City: "{City}",
Province: "{Province}",
Country: "{Country}",
PostalCode: "{PostalCode}",
AccountNumber: "{AccountNumber}",
FinancialInstitutionNumber: "{FinancialInstitutionNumber}",
BranchTransitNumber: "{BranchTransitNumber}",
IBAN: "{IBAN}",
ABARoutingNumber: "{ABARoutingNumber}",
SortCode: "{SortCode}",
Amount: "{Amount}",
Currency: "{Currency}",
ClientReferenceNumber: "{ClientReferenceNumber}",
KYCPerformed: "{KYCPerformed}",
KYCReferenceNumber: "{KYCReferenceNumber}",
EmailAddress: "{EmailAddress}",
IPAddress: "{IPAddress}",
FlinksAccountID: "{FlinksAccountID}",
FlinksLoginID: "{FlinksLoginID}",
Token: "{Token}",
PlaidPublicToken: "{PlaidPublicToken}",
PlaidAccessToken: "{PlaidAccessToken}",
PlaidAccountID: "{PlaidAccountID}",
PlaidProcessorToken: "{PlaidProcessorToken}",
InveriteRequestGUID: "{InveriteRequestGUID}",
ParentTransactionID: "{ParentTransactionID}",
TransactionLabel: "{TransactionLabel}",
Notes: "{Notes}",
DelayBankingInfo: "{DelayBankingInfo}",
IdempotencyKey: "{IdempotencyKey}"
})
Get single withdraw transaction info - Official Docs
This endpoint is used to look up details on a single withdraw transaction. Withdraw transactions debit funds from your account and deposit them into the customer's account.
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionID, TransactionStatus, PayLinkDetails } = await VoPayClient.eft.getWithdrawTransactionInfo({
TransactionID: "{TransactionID}"
})
Get single withdraw transaction status - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, TransactionID, TransactionStatus, Timestamp } = await VoPayClient.eft.getWithdrawTransactionStatus({
TransactionID: "{TransactionID}"
})
Get Failed Transactions - Official Docs
// Check Official Docs for more fields in response
const { Success, ErrorMessage, NumberOfRecords, FailedTransactions } = await VoPayClient.eft.getFailedTransactions({
StartDateTime: "{StartDateTime}",
EndDateTime: "{EndDateTime}"
})
Development
yarn install