graph TD
    A[Start: User Browses Courses on the home page] --> B{Find Desired Course?};

    B -- Yes --> C[Click 'Enroll' or 'Add to Cart'];
    C --> D[View Cart / Review Items];
    D --> E[Checkout];

    E --> F{User Logged In?};

    F -- No --> G[Login or Create New Account];
    G --> H[View Final Order Summary];
    F -- Yes --> H;

    H --> I[Select Payment Method];
    I --> J[Input Payment Information];
    J --> K[Initiate Payment];

    K --> L{Payment Successful?};

    L -- Yes --> M[Receive Confirmation & Receipt];
    M --> N[Redirect to Student Dashboard];
    N --> O[End: User Starts Course];

    L -- No --> P[Display Payment Error Message];
    P --> Q{Try Different Method?};

    Q -- Yes --> I;
    Q -- No --> R[End: Transaction Cancelled];
