Skip to main content

Overview

LendingRisk provides comprehensive credit assessment including alternative credit scoring, income verification, and affordability analysis — designed for emerging markets where traditional credit bureaus have limited coverage.

Quick Start

const assessment = await txcloud.lending.assess({
  applicant: {
    id: 'usr_abc123',
    first_name: 'Mohammed',
    last_name: 'El Amrani',
    date_of_birth: '1990-05-15',
    phone: '+212612345678',
    national_id: 'AE123456'
  },
  
  employment: {
    status: 'employed',
    employer_name: 'Acme Corp',
    monthly_income: 25000,
    income_currency: 'MAD'
  },
  
  loan_request: {
    amount: 100000,
    currency: 'MAD',
    term_months: 36,
    purpose: 'personal'
  },
  
  data_sources: ['bank_statements', 'bureau']
});

console.log('Decision:', assessment.decision.recommendation);
console.log('Credit Score:', assessment.credit_score.score);
console.log('Affordable:', assessment.affordability.affordable);

Assessment Response

{
  "id": "lra_a1b2c3d4e5f6",
  "status": "completed",
  
  "decision": {
    "recommendation": "approve",
    "confidence": 0.87,
    "max_approved_amount": 100000,
    "suggested_term_months": 36
  },
  
  "credit_score": {
    "score": 720,
    "grade": "B+",
    "percentile": 75,
    "factors": {
      "positive": ["Stable employment", "Regular income", "Low debt"],
      "negative": ["Limited credit history"]
    }
  },
  
  "income_analysis": {
    "stated_income": 25000,
    "verified_income": 24500,
    "income_match": true,
    "income_stability": "stable"
  },
  
  "affordability": {
    "monthly_income": 24500,
    "monthly_expenses": 12000,
    "existing_debt_payments": 2500,
    "proposed_payment": 3200,
    "remaining_after_loan": 6800,
    "affordable": true,
    "dti_after": 0.23
  },
  
  "pricing": {
    "risk_tier": "A",
    "suggested_rate": 12.5,
    "rate_range": { "min": 11.0, "max": 14.0 }
  }
}

Pre-Qualification

Quick check before full assessment:
const preQual = await txcloud.lending.prequalify({
  applicant_id: userId,
  monthly_income: 25000,
  existing_monthly_debts: 2500,
  loan_amount: 100000,
  loan_term_months: 36
});

if (preQual.likely_qualified) {
  // Proceed to full application
  showFullApplication();
} else {
  // Show alternative options
  showAlternatives(preQual.estimated_max_amount);
}

Income Verification

Verify stated income from bank statements:
// Upload bank statements
const upload = await txcloud.lending.statements.upload({
  applicant_id: userId,
  documents: [{
    type: 'bank_statement',
    bank_name: 'Attijariwafa Bank',
    file: statementBase64,
    period_start: '2024-07-01',
    period_end: '2024-12-31'
  }]
});

// Get analysis results
const insights = await txcloud.lending.statements.getInsights(upload.id);

console.log('Average Monthly Income:', insights.income.average_monthly);
console.log('Income Stability:', insights.income.stability);
console.log('Expense Categories:', insights.expenses.by_category);

Statement Insights

{
  "income": {
    "total": 147000,
    "average_monthly": 24500,
    "sources": [
      { "category": "salary", "amount": 147000, "percentage": 100 }
    ],
    "trend": "stable"
  },
  
  "expenses": {
    "total": 72000,
    "average_monthly": 12000,
    "by_category": [
      { "category": "rent", "amount": 30000, "percentage": 42 },
      { "category": "utilities", "amount": 6000, "percentage": 8 },
      { "category": "groceries", "amount": 12000, "percentage": 17 }
    ]
  },
  
  "debt_payments": {
    "total": 15000,
    "monthly_average": 2500,
    "identified_loans": [
      { "lender": "Credit Bank", "type": "car_loan", "monthly_payment": 2500 }
    ]
  },
  
  "financial_health_score": 78,
  "red_flags": [],
  "positive_indicators": ["Regular salary", "Healthy savings", "No overdrafts"]
}

Affordability Check

Assess if a loan is affordable:
const affordability = await txcloud.lending.affordability.check({
  applicant_id: userId,
  monthly_income: 24500,
  monthly_expenses: 12000,
  existing_debt_payments: 2500,
  proposed_loan: {
    amount: 100000,
    term_months: 36,
    rate: 12.5
  }
});

console.log('Affordable:', affordability.affordable);
console.log('Monthly Payment:', affordability.monthly_payment);
console.log('DTI After Loan:', affordability.ratios.dti_proposed);

// Stress test
console.log('Still affordable at +2% rate:', 
  affordability.stress_test.rate_increase_2pct.still_affordable);

Ongoing Monitoring

Monitor borrowers for risk changes:
// Subscribe to monitoring
await txcloud.lending.monitor.subscribe({
  borrower_id: userId,
  loan_id: loanId,
  alert_triggers: [
    'score_decrease_50',
    'missed_payment',
    'new_debt',
    'income_change'
  ],
  webhook_url: 'https://yourapp.com/webhooks/lending'
});

// You'll receive webhooks for alerts
// Event: lending.monitor.alert

Credit Score Grades

GradeScore RangeRisk Level
A+800-850Excellent
A750-799Very Good
B+700-749Good
B650-699Fair
C+600-649Below Average
C550-599Poor
D300-549Very Poor

Data Sources

LendingRisk can use multiple data sources:
SourceData Provided
bank_statementsIncome, expenses, cash flow
bureauCredit history (where available)
telecomAirtime usage, recharge patterns
mobile_moneyTransaction history
employerEmployment verification
More data sources = more accurate assessment. Use bank statements when possible.

Best Practices

Use prequalify endpoint to filter applicants before full assessment.
Bank statements provide the most accurate income verification.
Always check if loan remains affordable under stress scenarios.
Set up monitoring for early warning of borrower risk changes.

Next Steps