A comprehensive card verification and payment processing solution built with GP-API Drop-In UI and the GlobalPayments PHP SDK, featuring real-time transaction monitoring, secure payment processing, and professional dashboard interfaces.
- Features
- Quick Start
- Project Structure
- Installation
- Configuration
- Usage
- API Documentation
- Testing
- Security
- Deployment
- Contributing
- Card Verification: Zero-charge validation with AVS/CVV checks
- Payment Processing: Secure payment transactions via GP-API Drop-In UI
- Transaction Dashboard: Real-time monitoring with filtering and export capabilities
- Multi-format Support: CSV export, detailed transaction views, and comprehensive reporting
- Modern Architecture: Clean separation of concerns with PSR-4 autoloading
- Comprehensive Testing: PHPUnit test suite with 100% pass rate (17 tests, 128 assertions)
- Security First: Input validation, secure tokenization, and error handling
- Production Ready: Proper logging, monitoring, and deployment configuration
- PHP 8.0 or higher
- Composer
- Global Payments GP-API sandbox account and app credentials
-
Clone the repository:
git clone <repository-url> cd card-authentication
-
Install dependencies:
composer install
-
Configure environment:
cp .env.example .env # Edit .env with your GP-API app credentials -
Start development server:
php -S localhost:8000 router.php
-
Access the application:
http://localhost:8000
For Windows users who need to set up the complete development environment:
-
Install PHP 8.0+:
- Download from php.net/downloads
- Choose "Thread Safe" version for Windows
- Extract to
C:\php(or your preferred location) - Add
C:\phpto your Windows PATH environment variable
-
Install Composer:
- Download from getcomposer.org
- Run the Windows installer (Composer-Setup.exe)
- This will automatically add Composer to your PATH
-
Verify Installation:
php --version composer --version
-
Clone and setup:
git clone <repository-url> cd card-authentication composer install
-
Configure environment:
Copy-Item .env.example .env # Edit .env file with your GP-API credentials using notepad or your preferred editor notepad .env
-
Start development server:
php -S localhost:8000 router.php
-
Test the setup:
- Navigate to http://localhost:8000
- Run tests:
composer test - Check logs:
Get-Content logs\*.log -Tail 10
card-authentication/
├── docs/ # Documentation
│ ├── API.md # API documentation
│ ├── DEPLOYMENT.md # Deployment guide
│ └── ARCHITECTURE.md # System architecture
├── public/ # Web root (frontend files)
│ ├── index.html # Main navigation hub
│ ├── card-verification.html # Card verification interface
│ ├── payment.html # Payment processing interface
│ ├── dashboard.html # Transaction monitoring dashboard
│ ├── assets/ # Static assets
│ └── css/ # Stylesheets
│ ├── index.css
│ └── dashboard.css
├── src/ # PHP source code
│ ├── TransactionReporter.php # Transaction management and reporting
│ ├── ErrorHandler.php # Error handling utilities
│ └── Logger.php # Logging utilities
├── api/ # API endpoints
│ ├── config.php # SDK configuration
│ ├── verify-card.php # Card verification endpoint
│ ├── process-payment.php # Payment processing endpoint
│ ├── get-access-token.php # Access token endpoint
│ └── transactions-api.php # Transaction data API
├── tests/ # PHPUnit tests
│ ├── TransactionReporterTest.php
│ └── TransactionReporterIntegrationTest.php
├── .env.example # Environment configuration template
├── composer.json # PHP dependencies and scripts
├── phpunit.xml # Test configuration
├── router.php # Development server router
├── docker-compose.yml # Docker configuration
├── Dockerfile # Docker build configuration
└── README.md # This file
- PHP: 8.0 or higher with extensions:
curljsonmbstringopenssl
- Composer: Latest version
- Web Server: Apache, Nginx, or PHP built-in server
-
Environment Setup:
# Create environment file cp .env.example .env # Configure your GP-API credentials in .env: GP_API_APP_ID=your_app_id_here GP_API_APP_KEY=your_app_key_here GP_API_ENVIRONMENT=sandbox
-
Install Dependencies:
composer install --optimize-autoloader
-
Verify Installation:
# Run tests to ensure everything is working composer test
| Variable | Description | Required | Default |
|---|---|---|---|
GP_API_APP_ID |
GP-API application ID | Yes | - |
GP_API_APP_KEY |
GP-API application key | Yes | - |
GP_API_ENVIRONMENT |
GP-API environment (sandbox/production) | Yes | sandbox |
ENABLE_REQUEST_LOGGING |
Enable detailed API request logging | No | false |
Logs are stored in the logs/ directory with the following structure:
transaction-errors.log- Transaction processing errorssystem-YYYY-MM-DD.log- General system logspayment-YYYY-MM-DD.log- Payment processing logstransactions-YYYY-MM-DD.json- Transaction data storage
- Navigate to
http://localhost:8000/public/card-verification.html - Enter test card details (provided on the page)
- Submit for zero-charge verification
- View results including AVS/CVV validation
- Navigate to
http://localhost:8000/public/payment.html - Enter payment amount and card details
- Process secure payment through GlobalPayments
- Monitor results in real-time
- Navigate to
http://localhost:8000/public/dashboard.html - View all transactions with filtering options
- Export data to CSV format
- Access detailed transaction information
Use these GlobalPayments test cards for development:
| Card Number | Type | CVV | Exp | Expected Result |
|---|---|---|---|---|
| 4000000000000002 | Visa | 123 | 12/25 | Approved |
| 5400000000000005 | MasterCard | 123 | 12/25 | Approved |
| 370000000000002 | Amex | 1234 | 12/25 | Approved |
| 4000000000000010 | Visa | 123 | 12/25 | Declined |
POST /api/verify-card.php
Content-Type: application/json
{
"number": "4000000000000002",
"exp_month": "12",
"exp_year": "25",
"cvv": "123",
"zip": "12345"
}
POST /api/process-payment.php
Content-Type: application/json
{
"amount": "10.99",
"currency": "USD",
"number": "4000000000000002",
"exp_month": "12",
"exp_year": "25",
"cvv": "123"
}
GET /api/transactions-api.php?limit=50&start_date=2025-01-01&end_date=2025-01-31
For complete API documentation, see docs/API.md.
# Run all tests
composer test
# Run with coverage
composer test:coverage
# Run specific test file
./vendor/bin/phpunit tests/TransactionReporterTest.php
# Run with verbose output
./vendor/bin/phpunit --verbose --testdoxCurrent test coverage:
- 17 test cases with 128 assertions
- 100% pass rate
- Coverage includes unit tests, integration tests, and edge cases
- Input Validation: All user inputs are validated and sanitized
- Secure Tokenization: No sensitive card data is stored locally
- API Security: Proper headers and authentication
- Error Handling: No sensitive information exposed in errors
- Transaction Filtering: Only genuine API transactions displayed
- Keep your
.envfile secure and never commit it to version control - Regularly rotate API keys
- Monitor logs for suspicious activity
- Use HTTPS in production environments
- Keep dependencies updated
-
Environment Setup:
# Use production API credentials SECRET_API_KEY=prod_secret_key SERVICE_URL=https://api2.heartlandportico.com ENABLE_REQUEST_LOGGING=false -
Optimize for Production:
composer install --no-dev --optimize-autoloader
-
Web Server Configuration:
- Set document root to project directory
- Configure HTTPS with valid SSL certificate
- Set appropriate file permissions
- Configure log rotation
For detailed deployment instructions, see docs/DEPLOYMENT.md.
# Build and run with Docker
docker-compose up -d
# Or using Docker directly
docker build -t heartland-payment .
docker run -p 8000:8000 heartland-payment-
Clone and Setup:
git clone <repository-url> cd card-authentication composer install
-
Create Feature Branch:
git checkout -b feature/your-feature-name
-
Development:
- Write code following PSR-12 standards
- Add tests for new functionality
- Update documentation as needed
-
Testing:
composer test composer lint -
Submit Pull Request:
- Ensure all tests pass
- Include comprehensive description
- Reference any related issues
- Follow PSR-12 coding standards
- Use meaningful variable and function names
- Include PHPDoc comments for all public methods
- Write tests for all new functionality
- Keep security as a top priority
Common issues and solutions:
-
API Connection Issues:
- Verify credentials in
.envfile - Check network connectivity
- Ensure API endpoints are accessible
- Verify credentials in
-
Test Failures:
- Run
composer dump-autoload - Check file permissions on
logs/directory - Verify all dependencies are installed
- Run
-
Performance Issues:
- Enable PHP OPcache in production
- Optimize Composer autoloader
- Monitor system resources
- Check the documentation
- Review the test results
- Examine application logs in the
logs/directory
This project is licensed under the MIT License. See the LICENSE file for details.
- Complete card verification system
- Secure payment processing with GlobalPayments SDK
- Real-time transaction dashboard
- Comprehensive test suite
- Production-ready architecture
- Professional documentation
Built with GlobalPayments PHP SDK | Production Ready | Comprehensive Testing