Skip to main content

JavaScript/TypeScript SDK

Complete reference for the SecureLend TypeScript/JavaScript SDK.

Installation


Initialization

Basic Setup

Custom Configuration

Most users should use the default configuration. Custom server URLs are for advanced use cases only.

TypeScript Support

The SDK includes complete TypeScript definitions:

API Reference

Loan Comparison Methods

compareBusinessLoans()

Compare business loan offers.

comparePersonalLoans()

Compare personal loan offers.

compareCarLoans()

Compare auto loan rates.

compareStudentLoans()

Compare student loan options.

comparePersonalMortgages()

Compare mortgage rates for home purchases.

Calculator Methods

calculateLoanPayment()

Calculate monthly payment for any loan.

calculateMortgagePayment()

Calculate PITI (Principal, Interest, Taxes, Insurance) mortgage payment.

compareLeaseVsPurchase()

Compare total costs of leasing vs buying a vehicle.

Banking & Credit Card Methods

comparePersonalBanking()

Compare checking and savings accounts.

compareBusinessBanking()

Compare business banking products.

compareSavingsAccounts()

Compare high-yield savings accounts.

comparePersonalCreditCards()

Compare personal credit card offers.

compareBusinessCreditCards()

Compare business credit card options.

Application Management Methods

Application methods handle sensitive user data. Always obtain explicit user consent before calling these methods.

getOffer()

Submit application to one selected lender.

trackOfferStatus()

Check status of submitted applications.

Error Handling

The SDK throws typed errors for different failure scenarios:

Error Types


Platform-Specific Usage

Node.js

Works natively in Node.js 16+:

Next.js

API Routes

Server Components

React (Client-Side)

Edge Runtime (Vercel, Cloudflare Workers)

The SDK works in edge runtimes:

Rate Limits

Comparison Tools: 100 requests per minute per IP
Application Tools: 10 requests per minute per email
The SDK automatically handles rate limiting with exponential backoff.

Best Practices

1. Reuse Client Instances

2. Handle Errors Gracefully

3. Use TypeScript Types

4. Validate Input Early


Next Steps

Code Examples

Practical examples and patterns

Tool Reference

All 20 tools documented

GitHub Repository

View source and contribute

Support

Get help from our team