Documentation
Table of Contents
- [createNewDocument](#createnewdocument)
- [getLinkAmazonS3Uploader](#getlinkamazons3uploader)
- [requestTaxpayerDocument](#requesttaxpayerdocument)
- [createTaxpayerDocument](#createtaxpayerdocument)
- [checkBalanceByUserId](#checkbalancebyuserid)
- [requestTaxpayerInfo](#requesttaxpayerinfo)
- [requestTransactionInfo](#requesttransactioninfo)
- [requestTransactionList](#requesttransactionlist)
- [requestBalances](#requestbalances)
- [createPaymentMethod](#createpaymentmethod)
- [createPaymentMethod](#createpaymentmethod-1)
- [createWithdrawRequest](#createwithdrawrequest)
- [requestUserPaymentMethods](#requestuserpaymentmethods)
- [requestUserWithdrawInformation](#requestuserwithdrawinformation)
- [getBalanceByOrderId](#getbalancebyorderid)
BalancesService
- See:
Balances Micro Service API
Parameters
url
string service urltoken
(string | null) user access tocken if available (optional, defaultnull
)
createNewDocument
Creates new document based on your userid ("transactions" scope is needed)Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createNewDocument();
})();
Returns object response
getLinkAmazonS3Uploader
Return link to upload your file ("transactions" scope is needed)Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.getLinkAmazonS3Uploader();
})();
Returns object response
requestTaxpayerDocument
Returns taxpayer own document by his accesstoken ("transactions" scope is required)Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTaxpayerDocument();
})();
Returns object response
createTaxpayerDocument
Create taxpayer info or update existent oneParameters
args
object object with arguments
- `args.type` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** taxpayer info type (required)
- `args.countryId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Char code of "Country or Country Residence" (required)
- `args.countryId2` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Char code of "Country citizenship or Country incorporation"
- `args.stateId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Char code of "State / Province ID"
- `args.city` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** City
- `args.zip` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** ZIP-code
- `args.address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Street & apt. or suite no.
- `args.address2` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Permanent residence address
- `args.personNumberType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Tax Number for individual (e.g. "Foreign Tax ID Number")
- `args.companyNumberType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Tax Number for Corporation (e.g. "Employer Identification Number(EIN)")
- `args.taxIdNumber` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Tax ID number (XXX-XX-XXXX)
- `args.taxClassification` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Tax classification
- `args.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Name (shown on your income tax return)
- `args.businessName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Business name
- `args.organizationName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Name of organization
- `args.disregardedEntity` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Name of disregarded entity
- `args.chapter3Status` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Chapter 3 status
- `args.signature` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Signature
- `args.residenceNumbers` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Residence numbers (optional) (not implemented yet)
Examples(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createTaxpayerDocument({});
})();
Returns object response
checkBalanceByUserId
Check balance of the specified userParameters
id
string user id
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.checkBalanceByUserId();
})();
Returns array array with balances info
requestTaxpayerInfo
Returns taxpayer own information by his accesstokenExamples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTaxpayerInfo();
})();
Returns array array with balances info
requestTransactionInfo
Returns taxpayer own information by his accesstokenParameters
id
string Transaction unique ID
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTransactionInfo('1');
})();
Returns array array with balances info
requestTransactionList
Request Transactions list of authenticated user by balance typeParameters
args
Object? object of params
- `args.balanceType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Balance type
- `args.types` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** filter by transactions types divided by comma (e.g. types: 'sale,refund')
- `args.type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Balance type filter by transactions type (e.g. type: 'sale')
Examples(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTransactionInfo('1');
})();
Returns array array with balances info
requestBalances
Request balance of authenticated user by type or defaultParameters
balanceType
string? type of balance needed (vendor|bonus)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestBalances();
})();
Returns array array with balances info
createPaymentMethod
Creates new payment method ("transactions" scope is needed)Parameters
args
object object with arguments
- `args.paymentMethod` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Payment method (paypal, wire, skrill, payoneer) (required)
- `args.email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** E-mail (required for paypal & skrill)
- `args.fullName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** First & last name (required for wire)
- `args.address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Address (required for wire)
- `args.country` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Country char code (required for wire)
- `args.swiftCode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** SWIFT-code (required for wire)
- `args.bankAccountId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Bank account number (required for wire)
- `args.bankName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Bank name (required for wire)
- `args.bankAddress` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Bank address (required for wire)
- `args.payonnerId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** (required for payoneer)
Examples(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createPaymentMethod({});
})();
Returns object response
createPaymentMethod
Updates existed payment method ("transactions" scope is needed)Parameters
args
object object with arguments
- `args.paymentMethod` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Payment method (paypal, wire, skrill, payoneer) (required)
- `args.email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** E-mail (required for paypal & skrill)
- `args.fullName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** First & last name (required for wire)
- `args.address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Address (required for wire)
- `args.country` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Country char code (required for wire)
- `args.swiftCode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** SWIFT-code (required for wire)
- `args.bankAccountId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Bank account number (required for wire)
- `args.bankName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Bank name (required for wire)
- `args.bankAddress` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Bank address (required for wire)
- `args.payonnerId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** (required for payoneer)
Examples(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createPaymentMethod({});
})();
Returns object response
createWithdrawRequest
Creates new withdraw request ("transactions" scope is needed)Parameters
args
object object with arguments
- `args.amount` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** amount to withdraw (must be greater than balance) (required)
- `args.paymentMethod` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Payment method (paypal, wire, skrill, payoneer) (required)
Examples(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createWithdrawRequest({});
})();
Returns object response
requestUserPaymentMethods
Get all user payment methods ("transactions" scope is needed)Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestUserPaymentMethods();
})();
Returns array array with balances info
requestUserWithdrawInformation
Return user own last withdraw request ("transactions" scope is needed)Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestUserPaymentMethods();
})();
Returns array array with balances info
getBalanceByOrderId
Transaction - Request balance of order for balancetypeParameters
params
object
- `params.orderId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Order id (required).
- `params.balanceType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Balance type.
Examples(async () => {
const balancesService = new BalancesService('http://service-balances.dev/api/v2/');
const request = await balancesService.getBalanceByOrderId(params);
})();
Returns Promise<any>