Parseh Discount, Credit and Loyalty Switch

A revolutionary platform for multi-level marketing and real-time payments, built on a transaction-driven architecture


A technical masterpiece by Karzaan Software Group, in partnership with the Behpardakht PSP and Pasargad Bank

The Parseh loyalty system is a complete ecosystem for network marketing and smart payments. By combining 4 hierarchical marketing levels, real-time commission payouts and automatic discounts at the moment of payment, it has transformed Iran’s customer loyalty industry.


Overall system architecture

Overall architecture of the loyalty switch system


Revolutionary features

1. A 4-level marketing structure

Level

Role

Commission

Unique feature

General agent

Provincial management

0.8%

Access to real-time analytics dashboards

Sub-agent

City-level management

0.5%

A panel for supervising their marketers

Sales manager

Team coordination

0.7%

A tiered incentive system

Marketer

Acquiring customers/stores

1%

A dedicated React Native app

How commissions are calculated:

For each agent, the share split between them and the levels below was set by contract and could differ, and this floating share made the system extremely flexible for all its stakeholders.

2. Smart card reader

  • Built-in technologies:
    • Quad-core 1.8 GHz processor
    • A dedicated Linux-based operating system
    • Hardware encryption with a built-in HSM
  • Software features:
    • Real-time connection to the Node.js service
    • Support for bank cards from all institutions
    • OTA (over-the-air) updates

3. Automatic discount mechanism

A 200 ms process:
1. The customer swipes their card
2. The request is sent to the Node.js service
3. The discount rate is looked up from the Parseh service
4. The discount is applied before the request goes to the PSP
5. Behpardakht gives final approval of the transaction

How commissions are calculated in the loyalty switch


Technical architecture

1. Technical layers

Area

Technology

Scalability

Mobile front end

React Native + Redux

50,000 concurrent users

Transaction API

Node.js + Express + Socket.IO

5,000 transactions/second

Admin panel

Yii2 + AdminLTE

1,000 concurrent users

Database

MongoDB Atlas (sharded cluster)

10 TB of transaction data

Infrastructure

Kubernetes + Docker

Auto-scaling

2. Transaction processing pattern

Transaction processing pattern in the loyalty switch

3. System security

  • Three-layer authentication:
    1. Card readers authenticated with dedicated certificates
    2. OAuth 2.0 for the mobile app
    3. JWT + 2FA for the admin panel
  • End-to-end encryption:
    • TLS 1.3 for all connections
    • AES-256 encryption for sensitive data
  • Database security:
    • Encryption at rest in MongoDB
    • Field-level encryption for financial information

Key innovations

1. Real-time commission distribution

  • Payouts in < 500 ms:
    • Integration with the Pasargad Bank API
    • Automatic retries for failed transactions
    • Full audit logging of all payments

2. Real-time analytics engine

  • Monitored metrics:
    • Discount usage by region
    • Marketer performance by conversion rate
    • A heat map of successful/failed transactions
  • Real-time alerts:
    • Fraud pattern detection
    • Alerts for sudden drops in transactions

3. Tiered incentive system

  • A progression mechanism

Impressive operating figures

Metric

Value

Number of stores

12,000+

Active users

250,000+

Average transactions per day

450,000

Fastest commission payout

410 ms

Average transaction processing time

220 ms

Peak concurrent transactions

5,420 transactions/second


Technical challenges and innovative solutions

Challenge

Karzaan’s solution

Processing thousands of concurrent transactions – sudden load at peak hours

Event-driven architecture + Kafka

Integrating with the Behpardakht PSP – response delays

The circuit breaker pattern

Fair commission distribution – complex multi-level calculations

An optimized tree traversal algorithm

Syncing data across multiple banks – financial discrepancies

Daily account reconciliation


Summary: why Parseh is a technical masterpiece

1. The first loyalty system with real-time commission payouts in the Middle East
2. A unique combination of 4 marketing levels with dynamic incentive mechanisms
3. 5,000+ transactions per second with a Node.js-based microservices architecture
4. Automatic discounts with no user action at the moment of payment
5. A complete ecosystem: from store acquisition to commission payout in 410 ms