veend-sdk
Version:
a nodejs package for veend products
1,560 lines (1,455 loc) • 60.9 kB
Markdown
### Veendhq SDK
# **Prime SDK Integration**
## 1. **Provide Loan**
> Initialize the SDK with your credentials:
> Create a payload object and call the `lendLoan` method to process the loan:
### Parameters for `lendLoan`
| **Parameter** | **Type** | **Required** | **Default** | **Description** |
| -------------- | ---------- | ------------ | ----------- | ---------------------------------------------- |
| `accessToken` | `string` | Yes | — | The unique identifier for authentication. |
| `tenures` | `number[]` | Yes | — | Array of loan tenures available for selection. |
| `minimumLimit` | `number` | No | `1000000` | The minimum loan amount allowed. Optional. |
```javascript
const LendLoanPayload = {
accessToken: "accessToken", // Replace with your actual access token
tenures: [1, 2, 3], // Define the loan tenures
minimumLimit: number, // Optional: Replace with the desired minimum loan limit
};
sdk.prime
.lendLoan(LendLoanPayload)
.then((res) => {
// Handle successful loan lending
console.log("Loan successfully lent:", res); // Example: log the response
// Perform any additional operations, like updating UI or notifying the user
})
.catch((err) => {
// Handle errors during loan lending
console.error("Error lending loan:", err.message); // Example: log the error message
// Provide feedback to the user about the error
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: {
config: {
allowClientBvnUpdate: false,
remitaAPIKey: '#',
remitaAPIToken: '#',
remitaMerchantId: '#',
env: 'development',
dti: 0.75,
lendlotLoanProduct: '53',
lendlotTenantId: 'LenderRay-1712561449850',
coralPayMerchantId: '#',
retryCount: 200,
paystackSecretKey: '#',
coralPayKey: '#',
checkBVN: 'no',
checkCreditRegister: 'no',
V2NSMSURL: 'http://www.v2nmobile.com/api/httpsms.php',
V2NUsername: '#',
V2NPassword: '#',
giroEmail: 'wayolender@yopmail.com',
giroAccountID: '66139a832150d12e78c08ced',
remitaProductGiro: '60d38908a64ed700280362e8',
verifyRemitaRepayment: 'yes',
authToken: 'kj+mXMQx6P2SH70sXPMFiN28mgmUdI5VoScWssFL2Ls=',
checkRemita: 'yes',
client: 'lenderray-1712561449850',
logo: '',
website: '',
termiiSenderId: '#',
termiiAPIKey: '#',
termiiChannel: '#',
ussdOffline: true,
ussdDial: 524,
ussdCode: true,
enableLoanDisk: false,
defaultLoanDiskProduct: '',
defaultLoanDiskProductDuration: 0,
loandiskBranch: '',
loandiskAuthCode: '',
loandiskPublicKey: '',
useLoanDiskMiddleware: true,
loanDiskMiddlewareUrl: 'https://loandisk-dev.veendhq.com',
loandiskDefinition: [Object],
hasRemita: 'no',
hasSMS: 'no',
ussdDailyLimit: 5,
ussdMonthlyLimit: 100,
topUp: 'yes',
disableAutoDisbursement: 'no',
disableSMS: 'no',
allowMultipleProducts: false,
remitaFGNOnly: false,
enableAlternativeRemitaSettlementAccount: false,
activateRepaymentReminder: false,
loanRepaymentReminder: false,
showEmployeeStatements: false,
giroPrimeDisbursementAccountId: '66139d2c2150d12e78c0a961',
giroPrimeRepaymentInternalDepositProduct: '66139d2c2150d12e78c0a969',
lendlotBaseUrl: 'https://cba.veendhq.com:8443/fineract-provider',
lendlotPassword: 'Pa$$w0rd$$123/',
lendlotUsername: 'veendhq'
},
settings: {
decisionRules: [Object],
allowAutoRecoveryAgent: false,
allowUpdateMetrics: false,
sendLoanRepaymentReminders: false,
allowFetchOverdueTenureLoans: false,
sendTopUpReminderNotifications: false,
sendFollowUpNotifications: false,
allowAutoDebit: false,
switchPrimeRapaymentToBusinessAccount: false,
isBusinessFeatureEnabled: true,
webhook: 'https://webhook.site/8cd449b0-b4fd-49dd-bac8-0ecbf4fd89c2'
},
_id: '66139d2b837083d2de9adaed',
info: { registration: [Object], giro: [Object] },
name: 'Lender Ray',
allowed: true,
dbName: 'Tenant_LenderRay-1712561449850',
lastBalance: 10276138.76,
enableCoLending: true,
hasSignedSLA: true,
lendingLicenseStatus: 'submitted',
isKYCDone: true,
enableOnLending: true,
onLendingLoanTenures: [ 1, 2, 3 ],
lastPrimeDisbursementAccountBalance: 24210944.67,
tags: [],
createdAt: '2024-04-08T07:30:51.198Z',
token: 'OGVlNjg1YjdiNDZkODkwNDI1NDUyMDU3ZDhmZDBlZWMzODQwNGIyOTdiYTMyNGU5YmVjODdlNTY5YzVhYjU2OS8vLy8vLzE3MTI1NjE0NTEzNjQ=',
model: 'Accesstokens',
__v: 0,
lendingLicenseUrl: 'https://cba.veendhq.com:8443/fineract-provider',
lastOnlendingLoan: '2024-12-03T17:38:57.183Z',
lastInterestRate: 2.5,
lastMaxAmount: 1000000,
lastMinAmount: 5000,
lastMaxTenure: 12,
lastTotalInterest: 30,
enableLending2Lender: false,
minimumLimit: 1000000
}
}
```
</details>
## 2. **Loan Statistics**
To integrate the **Veend** SDK for loan Statisctics, follow same procedure:
> Initialize the SDK with your credentials:
> Call the ``getLoanStatistics` method to process the loan statistics:
```javascript
sdk.prime
.getLoanStatistics()
.then((res) => {
// Handle successful retrieval of loan statistics
console.log("Loan statistics retrieved:", res); // Example: log retrieved statistics
// Perform further operations based on the retrieved statistics, like displaying them in UI or processing the data
})
.catch((err) => {
// Handle any errors (e.g., provide user feedback)
console.error("Error retrieving loan statistics:", err.message); // Example: log error message
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: {
counts: {
loanPendingDisbursement: 26,
totalLoanCount: 230,
todaysLoan: 0,
totalPending: 0,
paidLoans: 183,
activeLoans: 47,
processingLoans: 19
}
},
cached: true
}
```
</details>
## 3. **Get All Loans**
To integrate the **Veend** SDK for getting loans, follow same procedure:
> Initialize the SDK with your credentials:
> Call the `getLoans` method to process All loans:
### Optional Parameters for `getLoans`
| **Parameter** | **Type** | **Required** | **Default** | **Description** |
| ------------- | --------- | ------------ | ----------- | ---------------------------------------------------------------------- |
| `desc` | `boolean` | No | `true` | Indicates if the loans should be sorted in descending order. Optional. |
| `sort` | `string` | No | `-_id` | The field by which the loans should be sorted. Optional. |
| `limit` | `number` | No | `999` | Specifies the maximum number of loans to retrieve. Optional. |
```javascript
sdk.prime
.getLoans({ limit: 3 })
.then((res) => {
// Handle successful retrieval of loans
console.log("Loans retrieved:", res); // Example: log retrieved loans
// Perform further operations based on the retrieved loans, like displaying them in UI or processing the data
})
.catch((err) => {
// Handle any errors (e.g., provide user feedback)
console.error("Error retrieving loans:", err.message); // Example: log error message
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: [
{
onlenderAccessTokens: [],
reconciliationMechanism: 'default',
requiresRepaymentLogCheck: false,
followUpSentAt: null,
_id: '6615625c2ee1fb926d2b4719',
fee: 0,
settled: false,
loanId: '1037',
user: '6615625a2ee1fb926d2b4702',
amount: 50000,
totalExpectedRepayment: 50500,
repaymentAmount: 50500,
totalRepayment: 50500,
totalOutstanding: 0,
repaymentDate: '2024-05-09T15:44:28.377Z',
status: 'closed',
process: 'disbursed',
disburseDate: '2024-04-09T15:44:28.378Z',
eligibility: '6615623b79f238e93648ef0d',
disbursementStatus: 'completed',
disbursementChannel: 'onlending',
requery: true,
isTopup: false,
requeryCount: 0,
channel: 'prime',
tenure: 1,
interestRate: 1,
interestAmount: 500,
disbursementAmount: 50000,
recreateMandate: false,
mandateRecreated: false,
referrer: 'veend_prime',
instalmentFee: 0,
isManuallyPushed: false,
onlenderLoanIds: [],
isLoanCyclic: false,
totalNumberOfCycles: 1,
currentCycleCount: 1,
isViaReferral: false,
isReferralActive: false,
disbursementReferralFee: 0,
repaymentReferralFee: 0,
recoveryStatus: 'pending',
tags: [],
remitaRepayments: [],
onLendingloanRepayments: [Array],
recoveryAgentComments: [],
createdAt: '2024-04-09T15:44:28.378Z',
model: 'Loans',
tenantDb: 'Global',
__v: 0,
disbursementLog: [Object],
onLendingloanRepaymentSchedule: [Array],
purchaseId: 25,
lastInstallmentDate: '2024-05-31T07:26:01.615Z',
cyclicLoanHistory: []
},
{
onlenderAccessTokens: [],
reconciliationMechanism: 'default',
requiresRepaymentLogCheck: false,
followUpSentAt: null,
_id: '66597b7abff800d5d04d2e06',
fee: 0,
settled: false,
loanId: '1176',
user: '66597b77bff800d5d04d2b0d',
amount: 50000,
totalExpectedRepayment: 51000,
repaymentAmount: 25500,
totalRepayment: 51000,
totalOutstanding: 0,
repaymentDate: '2024-07-31T07:25:46.418Z',
status: 'closed',
process: 'disbursed',
disburseDate: '2024-05-31T07:25:46.418Z',
eligibility: '66391619e74e58d084dc805b',
disbursementStatus: 'completed',
disbursementChannel: 'onlending',
requery: true,
isTopup: false,
requeryCount: 0,
channel: 'prime',
tenure: 2,
interestRate: 1,
interestAmount: 1000,
disbursementAmount: 50000,
recreateMandate: false,
mandateRecreated: false,
referrer: 'veend_prime',
instalmentFee: 0,
isManuallyPushed: false,
onlenderLoanIds: [],
isLoanCyclic: false,
totalNumberOfCycles: 1,
currentCycleCount: 1,
isViaReferral: false,
isReferralActive: false,
disbursementReferralFee: 0,
repaymentReferralFee: 0,
recoveryStatus: 'pending',
tags: [],
remitaRepayments: [],
onLendingloanRepayments: [Array],
recoveryAgentComments: [],
createdAt: '2024-05-31T07:25:46.419Z',
model: 'Loans',
tenantDb: 'Global',
__v: 0,
disbursementLog: [Object],
onLendingloanRepaymentSchedule: [Array],
purchaseId: 316,
lastInstallmentDate: '2024-07-31T00:00:14.869Z',
cyclicLoanHistory: []
},
{
onlenderAccessTokens: [],
requiresRepaymentLogCheck: false,
followUpSentAt: null,
_id: '66597b7fbff800d5d04d369d',
fee: 0,
settled: false,
loanId: '1177',
user: '66597b77bff800d5d04d2b0d',
amount: 25000,
totalExpectedRepayment: 25750,
repaymentAmount: 8583.33,
totalRepayment: 25750,
totalOutstanding: -1.8189894035458565e-12,
repaymentDate: '2024-08-31T07:25:51.918Z',
status: 'closed',
process: 'disbursed',
disburseDate: '2024-05-31T07:25:51.918Z',
eligibility: '663a53639e43d29ade699901',
disbursementStatus: 'completed',
disbursementChannel: 'onlending',
requery: true,
isTopup: false,
requeryCount: 0,
channel: 'prime',
tenure: 3,
interestRate: 1,
interestAmount: 750,
disbursementAmount: 25000,
recreateMandate: false,
mandateRecreated: false,
referrer: 'veend_prime',
instalmentFee: 0,
isManuallyPushed: false,
onlenderLoanIds: [],
isLoanCyclic: false,
totalNumberOfCycles: 1,
currentCycleCount: 1,
isViaReferral: false,
isReferralActive: false,
disbursementReferralFee: 0,
repaymentReferralFee: 0,
recoveryStatus: 'pending',
tags: [],
remitaRepayments: [],
onLendingloanRepayments: [Array],
recoveryAgentComments: [],
createdAt: '2024-05-31T07:25:51.919Z',
model: 'Loans',
tenantDb: 'Global',
__v: 0,
disbursementLog: [Object],
onLendingloanRepaymentSchedule: [Array],
purchaseId: 317,
lastInstallmentDate: '2024-08-31T00:00:19.551Z',
reconciliationMechanism: 'default',
cyclicLoanHistory: []
}
],
limit: 3,
total: 250,
lastId: '66597b7fbff800d5d04d369d',
totalResult: 250,
isLastPage: false
}
```
</details>
## 4. **Loan Detail**
To integrate the **Veend** SDK for getting loan detail, follow same procedure:
> Initialize the SDK with your credentials:
> Pass in the loan object Id then Call the `getLoanDetail` method to process the loan detail:
```javascript
sdk.prime
.getLoanDetail("id")
.then((res) => {
// Handle successful retrieval of loan details
console.log("Loan details retrieved:", res); // Example: log loan details
// Perform further operations based on the retrieved loan details, like displaying them in UI or saving data
})
.catch((err) => {
// Handle any errors (e.g., provide user feedback)
console.error("Error retrieving loan details:", err.message); // Example: log error message
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: {
_id: '674f4233f845b0d2cd3c6316',
fee: 0,
settled: false,
loanId: '2040',
user: '66597b83bff800d5d04d3c24',
amount: 100000,
totalExpectedRepayment: 103000,
repaymentAmount: 34333.33,
totalRepayment: 34333.33,
totalOutstanding: 68666.67,
repaymentDate: '2025-03-03T17:38:59.954Z',
status: 'active',
process: 'disbursed',
disburseDate: '2024-12-03T17:38:59.955Z',
eligibility: '6735eac74694b343a2e421b8',
disbursementStatus: 'completed',
disbursementChannel: 'onlending',
requery: true,
isTopup: false,
requeryCount: 0,
channel: 'prime',
tenure: 3,
interestRate: 1,
interestAmount: 3000,
disbursementAmount: 100000,
recreateMandate: false,
mandateRecreated: false,
referrer: 'veend_prime',
instalmentFee: 0,
isManuallyPushed: false,
onlenderLoanIds: [],
onlenderAccessTokens: [],
isLoanCyclic: false,
totalNumberOfCycles: 1,
currentCycleCount: 1,
isViaReferral: false,
isReferralActive: false,
disbursementReferralFee: 0,
repaymentReferralFee: 0,
recoveryStatus: 'pending',
edenLoanId: '1978',
reconciliationMechanism: 'direct',
requiresRepaymentLogCheck: false,
followUpSentAt: null,
tags: [],
remitaRepayments: [],
onLendingloanRepayments: [ [Object] ],
recoveryAgentComments: [],
cyclicLoanHistory: [],
createdAt: '2024-12-03T17:38:59.955Z',
model: 'Loans',
tenantDb: 'Global',
__v: 1,
disbursementLog: {
purchaseReference: 'lenderray-1712561449850_1978_prime_2040_54651333604_PRODS',
cost: 100000,
merchantFee: 0,
customerFee: 0,
cashback: 0,
referralCommission: 0,
totalCost: 100000,
description: 'NGN100000 - NGN Internal - Deposit - dummyco v2 - lenderray-1712561449850_1978_prime_2040_54651333604_PRODS',
currency: 'NGN',
status: 'completed',
paid: true,
delivered: false,
settled: true,
canRefund: false,
product: '660d4997126245cb05ab6cc3',
productsDetails: [Object],
ipAddress: '::ffff:192.168.32.201',
account: '66139d2c2150d12e78c0a961',
deliveryLog: [Object],
settlementLog: [Object],
refundLog: null,
validationDetails: null,
batch: null,
payment: 12207,
retryCount: 0,
owner: '66139d2c2150d12e78c0a961',
createdBy: '66139d2c2150d12e78c0a961',
client: null,
developer: null,
tags: null,
_id: 4379,
createdAt: '2024-12-03T17:39:00.000Z',
updatedAt: '2024-12-03T17:39:00.000Z'
},
onLendingloanRepaymentSchedule: [ [Object], [Object], [Object] ],
paymentId: 12207,
purchaseId: 4379,
lastInstallmentDate: '2024-12-05T14:04:01.170Z'
}
}
```
</details>
## 5. **Loan Repayment Schedule**
To integrate the **Veend** SDK for getting loan repayment schedule, follow same procedure:
> Initialize the SDK with your credentials:
> Pass in the loanId then Call the `getLoanRepaymentSchedule` method to process the loan repayment schedule:
```javascript
sdk.prime
.getLoanRepaymentSchedule("loanId")
.then((res) => {
// Handle successful retrieval of loan repayment schedule
console.log("Loan repayment schedule retrieved:", res); // Example: log repayment schedule data
// Perform further operations based on the repayment schedule, like updating UI or state
})
.catch((err) => {
// Handle any errors (e.g., provide user feedback)
console.error("Error retrieving loan repayment schedule:", err.message); // Example: log error message
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: {
principalAmount: 95000,
repayment: 0,
balance: 95950,
status: 'active',
disbursementStatus: 'completed',
schedule: [ [Object], [Object] ],
user: {
firstName: 'request',
lastName: 'credit',
phoneNumber: '0919133360',
email: '2294@veendhq.com',
identity: {},
nextOfKin: {},
employer: {},
loanProduct: '1'
}
}
}
```
</details>
## 6. **Customers**
To integrate the **Veend** SDK for getting customers, follow same procedure:
> Initialize the SDK with your credentials:
> Call the `getCustomers` method to process All customers:
### Optional Parameters for `getCustomers`
| **Parameter** | **Type** | **Required** | **Default** | **Description** |
| ------------- | --------- | ------------ | --------------------- | ------------------------------------------------------------------- |
| `limit` | `number` | No | `10` | The number of customers to retrieve per page. |
| `page` | `number` | No | `1` (if not provided) | The page number to retrieve. Useful for paginated data. |
| `desc` | `boolean` | No | `true` | Boolean indicating whether to sort the results in descending order. |
| `sort` | `string` | No | `-_id` | The field by which to sort the results (e.g., `-_id`, `date`). |
```javascript
sdk.prime
.getCustomers({ limit: 100 })
.then((res) => {
// Handle successful retrieval of customer data
console.log("Customers retrieved successfully:", res); // Example: log customer data
// Perform further operations based on the retrieved customer data, like updating UI or state
})
.catch((err) => {
// Handle any errors (e.g., provide user feedback)
console.error("Error retrieving customers:", err.message); // Example: log error message
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: {
usersData: [
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object]
],
totalPages: 1,
currentPage: 1
},
cached: true
}
```
</details>
## 7. **Switch Repayment Account**
To integrate the **Veend** SDK for switching repayment account functionality, follow same procedure:
> Initialize the SDK with your credentials:
> Call the `SwitchPrimeRapaymentToBusinessAccount` method to switch repayment account:
### Parameters for `SwitchPrimeRapaymentToBusinessAccount`
| **Parameter** | **Type** | **Required** | **Default** | **Description** |
| ------------- | --------- | ------------ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `enabled` | `boolean` | Yes | `false` | A boolean indicating whether the repayment account should be switched to a business account. `true` to enable, `false` to disable. |
```javascript
sdk.prime
.SwitchPrimeRapaymentToBusinessAccount(false)
.then((res) => {
// Handle successful toggling of the repayment feature
console.log("Feature toggled successfully:", res); // Example: log success message
// Perform further operations based on the result, like updating UI or state
})
.catch((err) => {
// Handle any errors (e.g., provide user feedback)
console.error("Error toggling feature:", err.message); // Example: log error message
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
Feature toggled successfully: {
status: 'success',
data: {
repaymentMethod: { bankTransfer: {}, ussd: {}, cards: {}, directDebit: {} },
decisionRules: { employer: [] },
thirdParty: {},
allowAutoRecoveryAgent: false,
allowUpdateMetrics: false,
sendLoanRepaymentReminders: false,
allowFetchOverdueTenureLoans: false,
sendTopUpReminderNotifications: false,
sendFollowUpNotifications: false,
allowAutoDebit: false,
switchPrimeRapaymentToBusinessAccount: false,
isBusinessFeatureEnabled: true,
webhook: 'https://webhook.site/8cd449b0-b4fd-49dd-bac8-0ecbf4fd89c2'
}
}
```
</details>
## 8. **Lending Account History**
To integrate the **Veend** SDK for fetching lending account history, follow same procedure:
> Initialize the SDK with your credentials:
> Call the `getLendingAccountHistory` method to get the lending account history:
### Optional Parameters for `getLendingAccountHistory`
| **Parameter** | **Type** | **Required** | **Default** | **Description** |
| ------------- | --------- | ------------ | ----------- | ------------------------------------------------------------------- |
| `account` | `string` | No | `undefined` | The account identifier for fetching the lending account history. |
| `desc` | `boolean` | No | `true` | Boolean indicating whether to sort the results in descending order. |
| `sort` | `string` | No | `-_id` | The field by which to sort the results (e.g., `-_id`, `date`). |
| `limit` | `number` | No | `999` | The number of entries to retrieve. |
```javascript
sdk.prime
.getLendingAccountHistory({})
.then((res) => {
// Process the lending account history data here
console.log(res); // Example: log the lending account history response
})
.catch((err) => {
// Handle any errors (e.g., display an error message to the user)
console.log(err); // Example: log the error for debugging
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: [
{
status: 'completed',
paymentReference: '6--Settlement++',
description: 'fundss_Settlement 6, NGN Internal - Deposit - Vee com',
amount: 10000,
previousBalance: null,
newBalance: null,
previousUserBalance: 0,
newUserBalance: 10000,
account: '660e977966c3f6c4f2687567',
purchase: 6,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9133-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 9,
createdAt: '2024-04-04T12:15:10.000Z',
updatedAt: '2024-04-04T12:15:10.000Z'
},
{
status: 'completed',
paymentReference: '7-',
description: 'Fund Transfer_NGN3000 - NGN Internal - Deposit - dummyco v2 - NGN_INTERNAL_DEPOSIT_1712234605088',
amount: -3000,
previousBalance: null,
newBalance: null,
previousUserBalance: 10000,
newUserBalance: 7000,
account: '660e977966c3f6c4f2687567',
purchase: 7,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9134-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 10,
createdAt: '2024-04-04T12:43:25.000Z',
updatedAt: '2024-04-04T12:43:25.000Z'
},
{
status: 'completed',
paymentReference: '13--Settlement++',
description: 'fundss_Settlement 13, NGN Internal - Deposit - Vee com',
amount: 27000,
previousBalance: null,
newBalance: null,
previousUserBalance: 7000,
newUserBalance: 34000,
account: '660e977966c3f6c4f2687567',
purchase: 13,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9148-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 22,
createdAt: '2024-04-05T15:30:18.000Z',
updatedAt: '2024-04-05T15:30:18.000Z'
},
{
status: 'completed',
paymentReference: '14-',
description: 'Payment request for loan 1017 repayment_NGN26500 - Payment request - 719003aa5af62a551a4288436ae0763a',
amount: -26500,
previousBalance: null,
newBalance: null,
previousUserBalance: 34000,
newUserBalance: 7500,
account: '660e977966c3f6c4f2687567',
purchase: 14,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9149-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 23,
createdAt: '2024-04-05T15:30:19.000Z',
updatedAt: '2024-04-05T15:30:19.000Z'
},
{
status: 'completed',
paymentReference: '36-',
description: 'Plink_NGN2000 - NGN Internal - Deposit - dummyco v2 - NGN_INTERNAL_DEPOSIT_1713297293351',
amount: -2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 7500,
newUserBalance: 5500,
account: '660e977966c3f6c4f2687567',
purchase: 36,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9205-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 58,
createdAt: '2024-04-16T19:54:54.000Z',
updatedAt: '2024-04-16T19:54:54.000Z'
},
{
status: 'completed',
paymentReference: '37-',
description: 'ogh_NGN1000 - NGN Internal - Deposit - Markier Sea Doffyier - NGN_INTERNAL_DEPOSIT_1713519059769',
amount: -1000,
previousBalance: null,
newBalance: null,
previousUserBalance: 5500,
newUserBalance: 4500,
account: '660e977966c3f6c4f2687567',
purchase: 37,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9213-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 60,
createdAt: '2024-04-19T09:31:00.000Z',
updatedAt: '2024-04-19T09:31:00.000Z'
},
{
status: 'completed',
paymentReference: '39-',
description: 'pay for me test_NGN2500 - NGN Internal - Deposit - John Stones - NGN_INTERNAL_DEPOSIT_1713813234195',
amount: -2500,
previousBalance: null,
newBalance: null,
previousUserBalance: 4500,
newUserBalance: 2000,
account: '660e977966c3f6c4f2687567',
purchase: 39,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9219-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 63,
createdAt: '2024-04-22T19:13:54.000Z',
updatedAt: '2024-04-22T19:13:54.000Z'
},
{
status: 'completed',
paymentReference: '43--Settlement++',
description: 'test from provides user_Settlement 43, NGN Internal - Deposit - Vee com',
amount: 2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 2000,
newUserBalance: 4000,
account: '660e977966c3f6c4f2687567',
purchase: 43,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9230-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 74,
createdAt: '2024-04-22T22:25:27.000Z',
updatedAt: '2024-04-22T22:25:27.000Z'
},
{
status: 'completed',
paymentReference: '49-',
description: 'Jaiye loooo_NGN2000 - NGN Internal - Deposit - Polac Academy - NGN_INTERNAL_DEPOSIT_1713869524178',
amount: -2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 4000,
newUserBalance: 2000,
account: '660e977966c3f6c4f2687567',
purchase: 49,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9245-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 88,
createdAt: '2024-04-23T10:52:04.000Z',
updatedAt: '2024-04-23T10:52:04.000Z'
},
{
status: 'completed',
paymentReference: '52--Settlement++',
description: 'country hard, manage and chop life_Settlement 52, NGN Internal - Deposit - Vee com',
amount: 2100,
previousBalance: null,
newBalance: null,
previousUserBalance: 2000,
newUserBalance: 4100,
account: '660e977966c3f6c4f2687567',
purchase: 52,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9254-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 97,
createdAt: '2024-04-23T11:00:22.000Z',
updatedAt: '2024-04-23T11:00:22.000Z'
}
],
limit: 10,
total: 12892,
lastId: 97,
totalResult: 841,
isLastPage: false
}
```
</details>
## 9. **Loan Repayment History**
To integrate the **Veend** SDK for fetching lending repayment history, follow same procedure:
> Initialize the SDK with your credentials:
> Call the `getLoanRepaymentHistory` method to get the loan repayment history:
### Optional Parameters for `getLoanRepaymentHistory`
| **Parameter** | **Type** | **Required** | **Default** | **Description** |
| ------------- | --------- | ------------ | ----------- | ------------------------------------------------------------------- |
| `accountId` | `string` | Yes | — | The account identifier for fetching the loan repayment history. |
| `account` | `string` | No | — | Alias for `accountId`, also used to identify the account. |
| `desc` | `boolean` | No | `true` | Boolean indicating whether to sort the results in descending order. |
| `sort` | `string` | No | `-_id` | The field by which to sort the results (e.g., `-_id`, `amount`). |
| `limit` | `number` | No | `999` | The number of entries to retrieve. |
| `repayment` | `boolean` | No | `true` | Indicates whether to filter results for repayment history. |
| `onlender` | `string` | No | — | The lender identifier for filtering loan repayment history. |
```javascript
sdk.prime
.getLoanRepaymentHistory({})
.then((res) => {
// Process the loan repayment history data here
console.log(res); // Example: log the loan repayment history response
})
.catch((err) => {
// Handle any errors that occur (e.g., show an error message to the user)
console.log(err); // Example: log the error for debugging
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: [
{
status: 'completed',
paymentReference: '6--Settlement++',
description: 'fundss_Settlement 6, NGN Internal - Deposit - Vee com',
amount: 10000,
previousBalance: null,
newBalance: null,
previousUserBalance: 0,
newUserBalance: 10000,
account: '660e977966c3f6c4f2687567',
purchase: 6,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9133-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 9,
createdAt: '2024-04-04T12:15:10.000Z',
updatedAt: '2024-04-04T12:15:10.000Z'
},
{
status: 'completed',
paymentReference: '7-',
description: 'Fund Transfer_NGN3000 - NGN Internal - Deposit - dummyco v2 - NGN_INTERNAL_DEPOSIT_1712234605088',
amount: -3000,
previousBalance: null,
newBalance: null,
previousUserBalance: 10000,
newUserBalance: 7000,
account: '660e977966c3f6c4f2687567',
purchase: 7,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9134-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 10,
createdAt: '2024-04-04T12:43:25.000Z',
updatedAt: '2024-04-04T12:43:25.000Z'
},
{
status: 'completed',
paymentReference: '13--Settlement++',
description: 'fundss_Settlement 13, NGN Internal - Deposit - Vee com',
amount: 27000,
previousBalance: null,
newBalance: null,
previousUserBalance: 7000,
newUserBalance: 34000,
account: '660e977966c3f6c4f2687567',
purchase: 13,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9148-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 22,
createdAt: '2024-04-05T15:30:18.000Z',
updatedAt: '2024-04-05T15:30:18.000Z'
},
{
status: 'completed',
paymentReference: '14-',
description: 'Payment request for loan 1017 repayment_NGN26500 - Payment request - 719003aa5af62a551a4288436ae0763a',
amount: -26500,
previousBalance: null,
newBalance: null,
previousUserBalance: 34000,
newUserBalance: 7500,
account: '660e977966c3f6c4f2687567',
purchase: 14,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9149-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 23,
createdAt: '2024-04-05T15:30:19.000Z',
updatedAt: '2024-04-05T15:30:19.000Z'
},
{
status: 'completed',
paymentReference: '36-',
description: 'Plink_NGN2000 - NGN Internal - Deposit - dummyco v2 - NGN_INTERNAL_DEPOSIT_1713297293351',
amount: -2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 7500,
newUserBalance: 5500,
account: '660e977966c3f6c4f2687567',
purchase: 36,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9205-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 58,
createdAt: '2024-04-16T19:54:54.000Z',
updatedAt: '2024-04-16T19:54:54.000Z'
},
{
status: 'completed',
paymentReference: '37-',
description: 'ogh_NGN1000 - NGN Internal - Deposit - Markier Sea Doffyier - NGN_INTERNAL_DEPOSIT_1713519059769',
amount: -1000,
previousBalance: null,
newBalance: null,
previousUserBalance: 5500,
newUserBalance: 4500,
account: '660e977966c3f6c4f2687567',
purchase: 37,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9213-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 60,
createdAt: '2024-04-19T09:31:00.000Z',
updatedAt: '2024-04-19T09:31:00.000Z'
},
{
status: 'completed',
paymentReference: '39-',
description: 'pay for me test_NGN2500 - NGN Internal - Deposit - John Stones - NGN_INTERNAL_DEPOSIT_1713813234195',
amount: -2500,
previousBalance: null,
newBalance: null,
previousUserBalance: 4500,
newUserBalance: 2000,
account: '660e977966c3f6c4f2687567',
purchase: 39,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9219-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 63,
createdAt: '2024-04-22T19:13:54.000Z',
updatedAt: '2024-04-22T19:13:54.000Z'
},
{
status: 'completed',
paymentReference: '43--Settlement++',
description: 'test from provides user_Settlement 43, NGN Internal - Deposit - Vee com',
amount: 2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 2000,
newUserBalance: 4000,
account: '660e977966c3f6c4f2687567',
purchase: 43,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9230-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 74,
createdAt: '2024-04-22T22:25:27.000Z',
updatedAt: '2024-04-22T22:25:27.000Z'
},
{
status: 'completed',
paymentReference: '49-',
description: 'Jaiye loooo_NGN2000 - NGN Internal - Deposit - Polac Academy - NGN_INTERNAL_DEPOSIT_1713869524178',
amount: -2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 4000,
newUserBalance: 2000,
account: '660e977966c3f6c4f2687567',
purchase: 49,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9245-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 88,
createdAt: '2024-04-23T10:52:04.000Z',
updatedAt: '2024-04-23T10:52:04.000Z'
},
{
status: 'completed',
paymentReference: '52--Settlement++',
description: 'country hard, manage and chop life_Settlement 52, NGN Internal - Deposit - Vee com',
amount: 2100,
previousBalance: null,
newBalance: null,
previousUserBalance: 2000,
newUserBalance: 4100,
account: '660e977966c3f6c4f2687567',
purchase: 52,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9254-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 97,
createdAt: '2024-04-23T11:00:22.000Z',
updatedAt: '2024-04-23T11:00:22.000Z'
}
],
limit: 10,
total: 12892,
lastId: 97,
totalResult: 841,
isLastPage: false
}
```
</details>
## 10. **Lending Account Statement**
To integrate the **Veend** SDK for fetching lending account statement, follow same procedure:
> Initialize the SDK with your credentials:
> Call the `getLendingAccountStatement` method to get the lending account statement:
```javascript
sdk.prime
.getLendingAccountStatement({})
.then((res) => {
// Process the response data here
// console.log(res);
})
.catch((err) => {
// Handle any errors that occur (e.g., show an error message to the user)
console.log(err);
});
```
### **Response Handling**
> Upon successful execution, you will receive a response that can be logged or used for further processing. Here's an example response format:
<details>
<summary>🟢 Successful Response</summary>
```javascript
{
status: 'success',
data: [
{
status: 'completed',
paymentReference: '6--Settlement++',
description: 'fundss_Settlement 6, NGN Internal - Deposit - Vee com',
amount: 10000,
previousBalance: null,
newBalance: null,
previousUserBalance: 0,
newUserBalance: 10000,
account: '660e977966c3f6c4f2687567',
purchase: 6,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9133-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 9,
createdAt: '2024-04-04T12:15:10.000Z',
updatedAt: '2024-04-04T12:15:10.000Z'
},
{
status: 'completed',
paymentReference: '7-',
description: 'Fund Transfer_NGN3000 - NGN Internal - Deposit - dummyco v2 - NGN_INTERNAL_DEPOSIT_1712234605088',
amount: -3000,
previousBalance: null,
newBalance: null,
previousUserBalance: 10000,
newUserBalance: 7000,
account: '660e977966c3f6c4f2687567',
purchase: 7,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9134-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 10,
createdAt: '2024-04-04T12:43:25.000Z',
updatedAt: '2024-04-04T12:43:25.000Z'
},
{
status: 'completed',
paymentReference: '13--Settlement++',
description: 'fundss_Settlement 13, NGN Internal - Deposit - Vee com',
amount: 27000,
previousBalance: null,
newBalance: null,
previousUserBalance: 7000,
newUserBalance: 34000,
account: '660e977966c3f6c4f2687567',
purchase: 13,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9148-deposit',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 22,
createdAt: '2024-04-05T15:30:18.000Z',
updatedAt: '2024-04-05T15:30:18.000Z'
},
{
status: 'completed',
paymentReference: '14-',
description: 'Payment request for loan 1017 repayment_NGN26500 - Payment request - 719003aa5af62a551a4288436ae0763a',
amount: -26500,
previousBalance: null,
newBalance: null,
previousUserBalance: 34000,
newUserBalance: 7500,
account: '660e977966c3f6c4f2687567',
purchase: 14,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9149-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 23,
createdAt: '2024-04-05T15:30:19.000Z',
updatedAt: '2024-04-05T15:30:19.000Z'
},
{
status: 'completed',
paymentReference: '36-',
description: 'Plink_NGN2000 - NGN Internal - Deposit - dummyco v2 - NGN_INTERNAL_DEPOSIT_1713297293351',
amount: -2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 7500,
newUserBalance: 5500,
account: '660e977966c3f6c4f2687567',
purchase: 36,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9205-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 58,
createdAt: '2024-04-16T19:54:54.000Z',
updatedAt: '2024-04-16T19:54:54.000Z'
},
{
status: 'completed',
paymentReference: '37-',
description: 'ogh_NGN1000 - NGN Internal - Deposit - Markier Sea Doffyier - NGN_INTERNAL_DEPOSIT_1713519059769',
amount: -1000,
previousBalance: null,
newBalance: null,
previousUserBalance: 5500,
newUserBalance: 4500,
account: '660e977966c3f6c4f2687567',
purchase: 37,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9213-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 60,
createdAt: '2024-04-19T09:31:00.000Z',
updatedAt: '2024-04-19T09:31:00.000Z'
},
{
status: 'completed',
paymentReference: '39-',
description: 'pay for me test_NGN2500 - NGN Internal - Deposit - John Stones - NGN_INTERNAL_DEPOSIT_1713813234195',
amount: -2500,
previousBalance: null,
newBalance: null,
previousUserBalance: 4500,
newUserBalance: 2000,
account: '660e977966c3f6c4f2687567',
purchase: 39,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9219-withdraw',
currency: 'NGN',
isPassive: 0,
passiveAccount: null,
owner: '660e977966c3f6c4f2687567',
createdBy: '660e977966c3f6c4f2687567',
client: null,
developer: null,
tags: null,
_id: 63,
createdAt: '2024-04-22T19:13:54.000Z',
updatedAt: '2024-04-22T19:13:54.000Z'
},
{
status: 'completed',
paymentReference: '43--Settlement++',
description: 'test from provides user_Settlement 43, NGN Internal - Deposit - Vee com',
amount: 2000,
previousBalance: null,
newBalance: null,
previousUserBalance: 2000,
newUserBalance: 4000,
account: '660e977966c3f6c4f2687567',
purchase: 43,
paymentProcessor: 'VeendHQ',
paymentProcessorReference: '9