> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/Braian551/viax/llms.txt
> Use this file to discover all available pages before exploring further.

# Pricing System

> Understanding how Viax calculates trip fares and pricing

## Overview

Viax uses a dynamic pricing system that calculates fares based on multiple factors including distance, time, vehicle type, and demand. This page explains how pricing works and what affects your trip cost.

## Fare Calculation Formula

The total trip fare is calculated using the following components:

```dart theme={null}
// Pricing calculation
final totalFare = baseFare + distanceCost + timeCost + (surgePricing * demandMultiplier);

// Where:
// - baseFare: Fixed starting price for vehicle type
// - distanceCost: costPerKm * distanceInKm
// - timeCost: costPerMinute * durationInMinutes  
// - surgePricing: Additional charge during high demand
```

### Components Breakdown

<CardGroup cols={2}>
  <Card title="Base Fare" icon="hand-holding-dollar">
    Fixed starting price that varies by vehicle type
  </Card>

  <Card title="Distance Cost" icon="road">
    Charged per kilometer traveled
  </Card>

  <Card title="Time Cost" icon="clock">
    Charged per minute of trip duration
  </Card>

  <Card title="Surge Pricing" icon="chart-line">
    Dynamic multiplier during high demand periods
  </Card>
</CardGroup>

## Vehicle Type Pricing

Each vehicle category has different base rates:

<Tabs>
  <Tab title="Moto">
    **Motorcycle**

    * Base fare: \$3,000 COP
    * Cost per km: \$800 COP
    * Cost per minute: \$100 COP
    * Minimum fare: \$4,000 COP

    **Best for:**

    * Solo riders
    * Short distances
    * Quick trips in traffic
  </Tab>

  <Tab title="Carro">
    **Car**

    * Base fare: \$4,500 COP
    * Cost per km: \$1,200 COP
    * Cost per minute: \$150 COP
    * Minimum fare: \$6,000 COP

    **Best for:**

    * Groups (up to 4 people)
    * Comfort and safety
    * Medium to long distances
  </Tab>

  <Tab title="Moto Carga">
    **Motorcycle Cargo**

    * Base fare: \$3,500 COP
    * Cost per km: \$900 COP
    * Cost per minute: \$120 COP
    * Minimum fare: \$4,500 COP

    **Best for:**

    * Small package delivery
    * Documents
    * Items up to 20kg
  </Tab>

  <Tab title="Carro Carga">
    **Car Cargo**

    * Base fare: \$5,000 COP
    * Cost per km: \$1,500 COP
    * Cost per minute: \$200 COP
    * Minimum fare: \$7,000 COP

    **Best for:**

    * Larger items
    * Furniture
    * Packages up to 100kg
  </Tab>
</Tabs>

## Example Fare Calculations

### Example 1: Short Moto Trip

```
Trip details:
- Vehicle: Moto
- Distance: 3.5 km
- Duration: 12 minutes
- Demand: Normal (1.0x)

Calculation:
Base fare: $3,000
Distance: 3.5 km × $800 = $2,800
Time: 12 min × $100 = $1,200
Surge: $0 (normal demand)

Total: $7,000 COP
```

### Example 2: Medium Car Trip

```
Trip details:
- Vehicle: Carro
- Distance: 8.2 km
- Duration: 25 minutes
- Demand: High (1.5x surge)

Calculation:
Base fare: $4,500
Distance: 8.2 km × $1,200 = $9,840
Time: 25 min × $150 = $3,750
Subtotal: $18,090
Surge (50%): $18,090 × 0.5 = $9,045

Total: $27,135 COP
```

### Example 3: Long Carro Carga Trip

```
Trip details:
- Vehicle: Carro Carga
- Distance: 15.8 km
- Duration: 42 minutes
- Demand: Normal (1.0x)

Calculation:
Base fare: $5,000
Distance: 15.8 km × $1,500 = $23,700
Time: 42 min × $200 = $8,400
Surge: $0

Total: $37,100 COP
```

## Pricing Database Schema

The system stores pricing configuration in the database:

```sql theme={null}
-- Pricing configuration table
CREATE TABLE pricing_config (
  id INT PRIMARY KEY AUTO_INCREMENT,
  vehicle_type ENUM('moto', 'carro', 'moto_carga', 'carro_carga'),
  base_fare DECIMAL(10,2),
  cost_per_km DECIMAL(10,2),
  cost_per_minute DECIMAL(10,2),
  minimum_fare DECIMAL(10,2),
  time_period ENUM('peak', 'normal', 'night'),
  active BOOLEAN DEFAULT TRUE,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
```

## Time-Based Pricing Periods

Pricing may vary based on time of day:

<Tabs>
  <Tab title="Peak Hours">
    **Morning Peak: 6:00 AM - 9:00 AM**

    **Evening Peak: 5:00 PM - 8:00 PM**

    * Higher demand
    * Potential surge pricing
    * More drivers online
    * Longer wait times

    <Info>
      Surge multiplier typically ranges from 1.2x to 2.0x during peak hours.
    </Info>
  </Tab>

  <Tab title="Normal Hours">
    **9:00 AM - 5:00 PM**

    **8:00 PM - 11:00 PM**

    * Standard pricing
    * Good driver availability
    * Moderate demand
    * Average wait times
  </Tab>

  <Tab title="Night Hours">
    **11:00 PM - 6:00 AM**

    * Standard or slightly higher rates
    * Fewer drivers available
    * Lower demand
    * May include safety surcharge

    <Warning>
      Night trips may have limited driver availability in some areas.
    </Warning>
  </Tab>
</Tabs>

## Surge Pricing

Surge pricing activates during high demand:

### When Surge Applies

* Rush hours (morning and evening peaks)
* Bad weather conditions
* Special events or holidays
* Limited driver availability
* High trip request volume

### How Surge Works

```dart theme={null}
// Surge multiplier calculation
double calculateSurgeMultiplier() {
  final activeTrips = getActiveTripsInArea();
  final availableDrivers = getAvailableDriversInArea();
  
  final demandRatio = activeTrips / max(availableDrivers, 1);
  
  if (demandRatio < 1.0) return 1.0; // No surge
  if (demandRatio < 2.0) return 1.2; // Low surge
  if (demandRatio < 3.0) return 1.5; // Medium surge
  return 2.0; // High surge (capped)
}
```

<Note>
  You'll always see the surge multiplier before confirming your trip. The app will show "1.5x" or similar to indicate increased pricing.
</Note>

## Price Estimate vs Final Fare

### Estimate (Before Trip)

Based on:

* Straight-line distance
* Average traffic conditions
* Current demand level
* Selected vehicle type

### Final Fare (After Trip)

Based on:

* Actual route taken
* Precise distance traveled
* Actual time duration
* Any route deviations

<Warning>
  The final fare may differ from the estimate if the driver takes a different route or traffic conditions change significantly.
</Warning>

## Minimum Fare

Each vehicle type has a minimum fare to ensure fair compensation for drivers:

| Vehicle Type | Minimum Fare |
| ------------ | ------------ |
| Moto         | \$4,000 COP  |
| Carro        | \$6,000 COP  |
| Moto Carga   | \$4,500 COP  |
| Carro Carga  | \$7,000 COP  |

Even if the calculated fare is lower, you'll be charged the minimum.

## Additional Charges

<Accordion title="Tolls and Parking">
  * Tolls are added to the final fare
  * Parking fees may apply for cargo deliveries
  * Driver will notify you of additional charges
  * Receipts provided for all extra costs
</Accordion>

<Accordion title="Waiting Time">
  * First 3 minutes free
  * After 3 minutes: \$50 COP per minute
  * Applied if driver waits at pickup or destination
  * Maximum 10 minutes waiting charge
</Accordion>

<Accordion title="Cancellation Fees">
  * Free cancellation: Within 2 minutes of booking
  * After 2 minutes: $2,000 - $3,000 COP depending on vehicle type
  * After driver starts moving toward you: 50% of estimated fare
  * No charge if driver cancels
</Accordion>

## Commission Structure

Viax retains a commission from each trip:

```dart theme={null}
// Commission calculation
final platformCommission = totalFare * 0.20; // 20%
final driverEarnings = totalFare - platformCommission;

// Example:
// Total fare: $10,000
// Platform: $2,000 (20%)
// Driver: $8,000 (80%)
```

<Info>
  Commission rates may vary for special promotions or partner companies.
</Info>

## Promotions and Discounts

### Available Discounts

* First ride discount for new users
* Referral bonuses
* Promotional codes
* Loyalty rewards
* Corporate accounts

### Applying Promo Codes

```dart theme={null}
// Apply promo code to trip
final discount = await applyPromoCode(
  code: 'FIRST RIDE',
  tripEstimate: estimatedFare,
);

final finalPrice = estimatedFare - discount.amount;
```

## Viewing Price Breakdown

Before confirming your trip, tap "Price Details" to see:

```json theme={null}
{
  "vehicle_type": "carro",
  "breakdown": {
    "base_fare": 4500,
    "distance": {
      "km": 5.2,
      "cost_per_km": 1200,
      "total": 6240
    },
    "time": {
      "minutes": 15,
      "cost_per_minute": 150,
      "total": 2250
    },
    "surge": {
      "multiplier": 1.0,
      "additional": 0
    },
    "discount": 0,
    "estimated_total": 12990
  }
}
```

## Payment and Receipts

After trip completion:

1. Final fare is calculated
2. Payment is processed
3. Digital receipt is generated
4. Receipt sent via email
5. Available in trip history

See [Payment Methods](/users/payment-methods) for more details.

## Tips for Lower Fares

<CardGroup cols={2}>
  <Card title="Avoid Peak Hours" icon="clock">
    Travel during normal hours to avoid surge pricing
  </Card>

  <Card title="Choose Moto" icon="motorcycle">
    Motorcycles are more affordable for solo trips
  </Card>

  <Card title="Shorter Routes" icon="route">
    Combine errands to minimize total distance
  </Card>

  <Card title="Use Promos" icon="tag">
    Apply promotional codes and discounts
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Payment Methods" icon="credit-card" href="/users/payment-methods">
    Set up and manage your payment options
  </Card>

  <Card title="Trip History" icon="receipt" href="/users/ride-history">
    View past trips and fare details
  </Card>
</CardGroup>

## Related API Endpoints

* [Calculate Trip Pricing](/api/trips/pricing)
* [Get Pricing Configuration](/api/admin/pricing-configuration)
