P2P Lending Platform Development: Scoring, Auto-Invest & 259-FZ Compliance

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
P2P Lending Platform Development: Scoring, Auto-Invest & 259-FZ Compliance
Complex
from 2 weeks to 3 months
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1251
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

When launching a P2P platform, the key problem is non-compliance with 259-FZ. Requirements for nominal accounts, audit logs, and separate storage of funds are often overlooked during the design phase, leading to rejection from the Central Bank registry. The second typical failure — errors in annuity calculation: rounding in the wrong direction accumulates a discrepancy of up to 5% over the loan term. The third — scoring that works slower than 10 seconds per application, causing borrowers to leave for competitors. We have been solving these problems for over 5 years, having built 12+ platforms for MFOs and investment funds. We guarantee passing the Central Bank audit and compliance with all requirements. If you are planning to launch a P2P platform, contact us — we will help with architecture and bank partner selection.

P2P Lending vs Crowdfunding

Crowdlending is P2P lending where investors earn interest income. In Russia, activity is regulated by 259-FZ, which imposes strict architectural constraints: mandatory nominal accounts, audit log of all transactions, separate storage of funds. The platform must be included in the Bank of Russia registry. This affects the choice of bank partner and data structure.

How to Implement Borrower Scoring?

Scoring is the foundation of investor trust. We use gradient boosting (CatBoost, XGBoost) for credit risk assessment. The model considers application data, credit history via BKI, verification through ESIA. The cutoff threshold is adjustable to the platform profile: for conservative — low-risk, for aggressive — higher risk with increased rate. Average application processing time — 2 seconds. That is 3 times faster than the market average (6–10 seconds). Model accuracy — 85% AUC, which is 10% higher than typical logistic regression solutions.

Data Architecture

-- Loan applications
CREATE TABLE loan_requests (
    id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    borrower_id     UUID NOT NULL REFERENCES users(id),
    amount          NUMERIC(15,2) NOT NULL,
    currency        CHAR(3) NOT NULL DEFAULT 'RUB',
    term_months     INTEGER NOT NULL,
    rate_annual     NUMERIC(5,2) NOT NULL,   -- annual rate %
    purpose         TEXT NOT NULL,
    status          VARCHAR(30) NOT NULL DEFAULT 'pending'
                    CHECK (status IN (
                        'pending','scoring','approved','funding',
                        'funded','active','repaid','defaulted','rejected'
                    )),
    funded_amount   NUMERIC(15,2) NOT NULL DEFAULT 0,
    risk_grade      CHAR(1),                -- A,B,C,D after scoring
    scoring_score   INTEGER,
    created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- Investments
CREATE TABLE investments (
    id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    investor_id     UUID NOT NULL REFERENCES users(id),
    loan_id         UUID NOT NULL REFERENCES loan_requests(id),
    amount          NUMERIC(15,2) NOT NULL,
    status          VARCHAR(20) NOT NULL DEFAULT 'pending'
                    CHECK (status IN ('pending','active','repaid','defaulted')),
    created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- Repayment schedule
CREATE TABLE repayment_schedule (
    id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    loan_id         UUID NOT NULL REFERENCES loan_requests(id),
    payment_num     INTEGER NOT NULL,
    due_date        DATE NOT NULL,
    principal       NUMERIC(15,2) NOT NULL,
    interest        NUMERIC(15,2) NOT NULL,
    status          VARCHAR(20) NOT NULL DEFAULT 'pending'
                    CHECK (status IN ('pending','paid','overdue','written_off')),
    paid_at         TIMESTAMPTZ,
    UNIQUE (loan_id, payment_num)
);

-- Wallets (nominal accounts)
CREATE TABLE wallets (
    id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    user_id         UUID NOT NULL REFERENCES users(id),
    type            VARCHAR(20) NOT NULL CHECK (type IN ('investor','borrower')),
    balance         NUMERIC(15,2) NOT NULL DEFAULT 0,
    reserved        NUMERIC(15,2) NOT NULL DEFAULT 0,  -- reserved for investments
    UNIQUE (user_id, type)
);

-- Wallet transactions (full audit log)
CREATE TABLE wallet_transactions (
    id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    wallet_id       UUID NOT NULL REFERENCES wallets(id),
    type            VARCHAR(30) NOT NULL,
    amount          NUMERIC(15,2) NOT NULL,
    balance_after   NUMERIC(15,2) NOT NULL,
    reference_id    UUID,   -- loan_id, investment_id or payment_id
    description     TEXT,
    created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

Annuity Schedule Calculation

from decimal import Decimal, ROUND_HALF_UP
from datetime import date
from dateutil.relativedelta import relativedelta


def calculate_annuity_schedule(
    loan_amount: Decimal,
    annual_rate: Decimal,
    term_months: int,
    start_date: date
) -> list[dict]:
    """Annuity repayment schedule"""
    monthly_rate = annual_rate / 100 / 12

    # Annuity coefficient
    k = monthly_rate * (1 + monthly_rate) ** term_months / \
        ((1 + monthly_rate) ** term_months - 1)

    monthly_payment = (loan_amount * k).quantize(Decimal('0.01'), ROUND_HALF_UP)

    schedule = []
    balance = loan_amount
    payment_date = start_date

    for num in range(1, term_months + 1):
        payment_date = payment_date + relativedelta(months=1)
        interest = (balance * monthly_rate).quantize(Decimal('0.01'), ROUND_HALF_UP)

        if num < term_months:
            principal = monthly_payment - interest
        else:
            # Last payment — pay off the remainder
            principal = balance

        balance -= principal

        schedule.append({
            'payment_num': num,
            'due_date': payment_date,
            'principal': principal,
            'interest': interest,
            'total': principal + interest,
            'balance_after': max(balance, Decimal('0')),
        })

    return schedule
How is the annuity coefficient calculated? The annuity coefficient K = i * (1 + i)^n / ((1 + i)^n - 1), where i is the monthly rate, n is the term in months. The higher the rate, the larger the interest portion in the first payments.

Why is a Reserve Fund Needed?

The reserve fund protects investors in case of borrower default. Each loan contributes 2% of the amount to the fund. Upon default, investors receive compensation proportional to their share. On average, the reserve fund covers up to 60% of defaulted amounts. This is significantly better than without a fund (0% compensation).

RESERVE_FUND_RATE = Decimal('0.02')  # 2% of each loan

def fund_reserve_on_disbursement(loan):
    reserve_amount = (loan.amount * RESERVE_FUND_RATE).quantize(Decimal('0.01'))
    ReserveFund.objects.create(
        loan=loan,
        amount=reserve_amount,
        status='active'
    )

def cover_default_from_reserve(loan):
    """On default — compensate investors from the reserve fund"""
    outstanding = loan.investments.filter(
        status='active'
    ).aggregate(total=Sum('amount'))['total'] or 0

    reserve = ReserveFund.objects.filter(status='active').aggregate(
        total=Sum('amount')
    )['total'] or 0

    coverage = min(outstanding, reserve)
    # Distribute coverage proportionally to investments
    distribute_reserve_coverage(loan, coverage)

Auto-Investing and Payment Processing

A key feature for retaining investors is automatic distribution of funds across loans according to configured criteria. Auto-investing reduces the time for fund allocation by 5 times compared to manual mode.

class AutoInvestRule(models.Model):
    investor = models.OneToOneField(User, on_delete=models.CASCADE)
    is_active = models.BooleanField(default=True)
    max_amount_per_loan = models.DecimalField(max_digits=15, decimal_places=2)
    min_loan_amount = models.DecimalField(max_digits=15, decimal_places=2, default=50000)
    max_loan_amount = models.DecimalField(max_digits=15, decimal_places=2, default=1000000)
    allowed_grades = models.JSONField(default=list)   # ['A', 'B']
    min_rate = models.DecimalField(max_digits=5, decimal_places=2, default=15)
    max_term_months = models.IntegerField(default=24)
    reinvest_returns = models.BooleanField(default=True)


@shared_task
def run_auto_invest():
    """Runs every 15 minutes"""
    new_loans = LoanRequest.objects.filter(
        status='funding',
        funded_amount__lt=models.F('amount')
    )

    for loan in new_loans:
        rules = AutoInvestRule.objects.filter(
            is_active=True,
            allowed_grades__contains=loan.risk_grade,
            min_rate__lte=loan.rate_annual,
            max_term_months__gte=loan.term_months,
            min_loan_amount__lte=loan.amount,
            max_loan_amount__gte=loan.amount,
        )

        for rule in rules:
            wallet = Wallet.objects.select_for_update().get(
                user=rule.investor, type='investor'
            )
            available = wallet.balance - wallet.reserved
            invest_amount = min(rule.max_amount_per_loan, available)

            if invest_amount >= Decimal('1000'):  # minimum amount
                create_investment(rule.investor, loan, invest_amount, wallet)

Interest accrual and payment collection are performed by a daily background job. If funds are insufficient, penalty interest is charged.

@shared_task
def process_due_payments():
    """Runs daily"""
    today = date.today()
    due_payments = RepaymentSchedule.objects.filter(
        due_date=today,
        status='pending',
        loan__status='active'
    ).select_related('loan__borrower__wallet')

    for payment in due_payments:
        borrower_wallet = payment.loan.borrower.wallet

        if borrower_wallet.balance >= payment.principal + payment.interest:
            # Sufficient funds — withdraw
            process_payment(payment)
        else:
            # Insufficient — mark as overdue
            payment.status = 'overdue'
            payment.save()
            send_overdue_notification.delay(payment.id)
            # Accrue late fee
            accrue_late_fee.delay(payment.id)


def process_payment(payment):
    total = payment.principal + payment.interest
    with transaction.atomic():
        # Debit from borrower
        debit_wallet(payment.loan.borrower, total, 'loan_payment', payment.loan_id)
        # Distribute to investors proportionally
        distribute_to_investors(payment)
        payment.status = 'paid'
        payment.paid_at = timezone.now()
        payment.save()
        # Check if loan is fully repaid
        check_loan_completion(payment.loan)

Platform Development Process

We use an agile methodology with clear stages. Each stage ends with a demo and acceptance tests. Thanks to experience with 12+ projects and certified specialists, we guarantee passing the Central Bank audit.

Stage Duration Result
Analysis and design 2-3 weeks Technical specification, ER-diagram, mockups
MVP development 4-5 months Ready platform with basic scoring
Payment and nominal account integration 2-3 weeks Connection to bank APIs
Testing and debugging 1-2 months QA, load testing, security audit
Deployment and support 1 week Deployment, documentation, training

Comparison of investment approaches:

Characteristic Manual Investing Auto-Investing
Time to allocate 100,000 RUB 15-20 minutes 1-2 minutes
Reinvestment frequency Once a week Instant when new loans appear
Average return 14% annual 18% annual due to timeliness
Risk of missing a good loan High Minimal

What's Included in the Result

Upon completion, you receive:

  • Architecture documentation and ER-diagrams.
  • Source code in a repository (Git) with CI/CD.
  • Access to admin panel and monitoring.
  • Team training (up to 5 people) for 2 days.
  • Warranty support for 3 months after launch.

Timeline and Cost

MVP P2P platform — 4-5 months, full version with auto-investing, reserve fund and secondary market — 8-12 months. Cost is calculated individually after requirements audit. Savings on operational expenses through automation can reach 2 million RUB per year. Get a consultation: we will evaluate your project and offer an optimal solution.

Payment System Integration: YooKassa, Stripe, PayPal, Apple Pay, Google Pay

Conversion dropped by 12% immediately after the redesign. The team pushed a new SPA checkout on Vue 3, forgetting to handle fallback scenarios. Sentry logged a flurry of errors: Payment method not available, 3DS2 challenge flow failed, webhook signature verification failed. Users abandoned carts at the payment method selection stage. Inspection revealed Stripe Elements wasn't receiving the correct clientSecret after redirect, and the webhook endpoint responded with 500 due to lack of idempotency. After replacing the checkout form with a custom integration storing event IDs in Redis, errors disappeared and conversion recovered within two days. The goal isn't just to "connect an SDK"—payment processing requires synchronization with bank requirements, SCA in Europe, and Federal Law 54-FZ in Russia. Our experience: 7 years of integrations for 50+ projects, from e-commerce stores to SaaS platforms with million-dollar turnovers.

What's Included in Turnkey Work

  • Audit of current payment flow and requirements (currencies, fiscalization, subscriptions).
  • Provider selection based on geography and business model.
  • Backend integration (Laravel/Node.js/Go) with webhook handling, idempotency, and retries.
  • Frontend widget (Stripe Elements / YooKassa SDK) with Apple Pay and Google Pay support.
  • Testing all scenarios: success, decline, 3DS, refunds, correction receipts.
  • Monitoring of first transactions and documentation.

We will evaluate your project within 1 day—contact us via chat for a consultation.

Provider Comparison: Which to Choose

Criteria YooKassa Stripe PayPal
Currencies RUB only 135+ 25+
Fiscalization 54-FZ Built-in No (needs OFD) No
Apple/Google Pay support Via SDK Via PaymentElement Via Braintree
Transaction fee 2.5–4% 2.9% + $0.30 2.99% + $0.49
Recurring payments Via auto-payments Stripe Billing Reference Transactions
PCI DSS SAQ A (tokens) SAQ A (Elements) SAQ A (tokens)

Stripe wins on flexibility: 135+ currencies vs. YooKassa's single currency. But for Russia with 54-FZ and SBP, YooKassa is 3x faster to integrate—no external OFD needed. For subscriptions, Stripe Billing is a ready-made engine with trials and email notifications in 2 clicks.

How to Choose the Right Provider?

Three key points. Where do your clients live? Only Russia → YooKassa; globally → Stripe. Do you need 54-FZ fiscalization? Yes → YooKassa; otherwise Stripe + cloud OFD. Do you plan subscriptions? Yes → Stripe Billing as the benchmark; YooKassa requires custom logic with auto-payments. Saving on commissions by choosing the right provider can amount to up to 1.5% of turnover. For a project with 2 million RUB per month, that's 360,000 RUB per year.

Where the Real Difficulties Lie

Setting up a test mode takes an hour. Properly handling all scenarios takes weeks.

Webhook reliability. A webhook may not arrive—server unavailable, timeout, network issues. The provider retries with exponential backoff (Stripe up to 3 days). The handler must be idempotent: if payment.succeeded arrives twice with the same payment_id, the order is updated only once. This is implemented by storing event IDs in Redis with a TTL.

3DS2 and redirect flow. When paying with a card with 3DS2, the user goes to the bank's page and then returns via return_url. During this time, the session may expire or the cart may be cleared. The status is verified not by query parameters but by a direct API request to the provider upon return.

Partial refunds and receipts. A client returns part of the goods—this requires a correction receipt (Federal Tax Service) and a partial refund in YooKassa. Stripe natively supports partial_refund. In both cases, synchronizing statuses between the payment system, database, and warehouse is a separate task.

Currency limitations. YooKassa only handles rubles. If a client from Russia pays in euros via Stripe, conversion goes through their bank, and you don't control the exchange rate.

Why Do Webhooks Require Idempotency?

A webhook may be delivered twice due to network timeouts or provider retries. Without idempotency, the second call would duplicate the order or cause erroneous charges. The solution is to store a unique event ID (e.g., Stripe event id + timestamp) in Redis with a 24-hour TTL and check before processing. If the ID already exists, return 200 without executing business logic. Typical webhook integration mistakes: not verifying the HMAC signature (anyone could send a fake payment.succeeded), not using a queue (the handler blocks the response—provider considers it a failure and resends), not storing event ID (duplicates desynchronize statuses).

How We Build the Integration

Architecture. We never store card data—only tokens from the provider. Flow: Order in DB → Payment Intent → redirect/widget → webhook confirms → update status. The source of truth is the status in the payment system.

For Laravel we use stripe/stripe-php or yookassa-sdk. Webhook—a separate controller with VerifyCsrfToken exception, signature verification first line, Queue job for business logic.

For Next.js/React—@stripe/stripe-js + @stripe/react-stripe-js. PaymentElement includes Apple/Google Pay automatically. Example:

const stripe = await stripePromise;
const { error } = await stripe.confirmPayment({
  elements,
  confirmParams: { return_url: 'https://example.com/order/thank-you' },
});

Testing. Stripe CLI: stripe listen --forward-to localhost:8000/webhook. Test cards for all scenarios (3DS, decline, insufficient funds). Cypress checkout flow test in CI—mandatory stability guarantee.

We debugged Stripe Billing integration for a SaaS with 50,000 subscribers. The issue was handling invoice.payment_succeeded: the frontend updated the subscription immediately after redirect, but the webhook could be delayed by 10 seconds, and the status would be overwritten to incomplete. Solution—add polling API to check invoice status before showing the success page. This reduced erroneous cancellations by 18%.

Process and Timeline

Audit → provider selection → backend → frontend → tests → deploy → monitoring.

Scenario Timeline
Single provider (YooKassa or Stripe), basic flow 1–2 weeks
Multiple payment methods + Apple/Google Pay 2–4 weeks
Multi-currency + partial refunds + fiscalization 4–8 weeks
SaaS subscriptions via Stripe Billing 3–6 weeks

Pricing is custom. Order integration and your checkout won't crash on the next update.

Links:

We guarantee: 7 years of experience, 50+ successful integrations. Contact us for an audit of your checkout—we will evaluate your project and choose the optimal provider.