# Payer Authentication Demo

A complete, professional web demonstration of the Cybersource Payer Authentication flow featuring Setup, Enroll, and Validate APIs with step-up authentication support.

## Features

- ✅ **Modern UI**: Visa brand colors with tabbed request/response payload viewers
- ✅ **Complete Flow**: Setup → Enroll → Validate with automatic progression
- ✅ **Device Data Collection**: Animated status indicators with Cardinal Commerce integration
- ✅ **Step-up Authentication**: Modal-based 3DS challenge handling with automatic validation
- ✅ **Card Configuration**: Multi-card support with dynamic switching
- ✅ **Security**: Origin filtering and proper iframe handling

## Project Structure

```
payer-auth-demo/
├── public/
│   ├── index.php                    # Main web application
│   ├── api/                         # API endpoints
│   │   ├── payer_auth_setup.php     # Setup API
│   │   ├── payer_auth_enroll.php    # Enroll API  
│   │   ├── payer_auth_validate.php  # Validate API
│   │   ├── get_card_config.php      # Card config getter
│   │   └── set_card_config.php      # Card config setter
│   └── assets/
│       ├── script.js                # Frontend JavaScript
│       └── style.css                # Styles
├── src/                             # PHP business logic
│   ├── SetupCompletionWithCardNumber.php
│   ├── PayerAuthEnroll.php
│   ├── PayerAuthValidate.php
│   └── SimpleConfig.php
├── Resources/
│   └── testrest.p12                 # Certificate file
├── vendor/                          # Composer dependencies
└── composer.json                    # Dependencies
```

## Setup Instructions

1. **Install Dependencies**:
   ```bash
   composer install
   ```

2. **Configure Web Server**:
   Point your web server to the `public/` directory or use PHP's built-in server:
   ```bash
   cd public && php -S localhost:8000
   ```

3. **Access Application**:
   Open `http://localhost:8000` in your browser

## Usage

1. **Setup**: Configure payer authentication session
2. **Enroll**: Enroll the card for authentication
3. **Validate**: Validate authentication with step-up challenges
4. **Card Config**: Switch between different test cards

The application automatically handles device data collection, step-up authentication modals, and flow progression.

## Requirements

- PHP 7.4+
- Composer
- CyberSource REST API credentials (configured in `SimpleConfig.php`)

## Status

✅ **FULLY FUNCTIONAL** - All APIs working with complete step-up authentication flow