A comprehensive multi-language demonstration of multi-use one-click payment processing using the Global Payments SDK. This example showcases secure payment method storage, multi-use token creation with integrated customer data, and streamlined payment processing across multiple programming languages.
- Multi-Use Token Creation - Convert single-use tokens to stored payment tokens with customer data integration
 - Payment Method Management - Store, retrieve, edit, and manage customer payment methods securely
 - One-Click Payment Processing - Process immediate charges ($25) using stored payment methods
 - Customer Data Integration - Associate billing information directly with payment tokens
 - Real-Time Processing - Immediate transaction processing with live API integration
 
- Mock Mode Support - Test payment flows with simulated responses without hitting live APIs
 - Test Card Integration - Built-in Heartland certification test cards for development
 - Comprehensive Web Interface - Complete UI with payment method management and transaction processing
 - Global Payments SDK Integration - Secure tokenization using hosted payment fields
 
- Consistent API Structure - Identical endpoints and functionality across all language implementations
 - JSON-Based Storage - Simple file-based persistence for payment methods and customer data
 - Environment Configuration - Secure credential management with .env files
 - Health Monitoring - System status endpoints for monitoring and debugging
 
Each implementation provides identical functionality with language-specific best practices:
| Language | Framework | Requirements | Status | 
|---|---|---|---|
| .NET | ASP.NET Core | .NET 9.0+ | β Complete | 
| Java | Jakarta EE | Java 11+, Maven | β Complete | 
| PHP | Native PHP | PHP 7.4+, Composer | β Complete | 
- Global Payments SDK Integration - Secure tokenization with hosted payment fields
 - Responsive Web Interface - Complete payment management UI
 - Test Card Helper - Integrated Heartland certification test cards
 - Real-Time Validation - Client-side form validation and error handling
 
- RESTful API Design - Consistent endpoints across all implementations
 - Multi-Use Token Creation - Secure conversion of single-use to stored payment tokens
 - Customer Data Storage - Integrated billing information with payment methods
 - Mock Mode Capability - Simulated responses for development and testing
 
| Method | Endpoint | Description | 
|---|---|---|
GET | 
/health | 
System health check and status | 
GET | 
/config | 
Frontend configuration (public API key, mock mode) | 
GET | 
/payment-methods | 
Retrieve all stored payment methods | 
POST | 
/payment-methods | 
Create new payment method or edit existing | 
POST | 
/charge | 
Process $25 charge using stored payment method | 
GET | 
/mock-mode | 
Get current mock mode status | 
POST | 
/mock-mode | 
Toggle mock mode on/off | 
- Global Payments account with API credentials (Sign up here)
 - Development environment for your chosen language
 - Package manager (npm, composer, maven, dotnet, go mod)
 
- 
Clone the repository
git clone <repository-url> cd save-and-reuse-payment-methods
 - 
Choose your implementation
cd dotnet # or java, php
 - 
Configure environment
cp .env.sample .env # Edit .env with your Global Payments GP API credentials: # GP_API_APP_ID=your_app_id # GP_API_APP_KEY=your_app_key # GP_API_ENVIRONMENT=sandbox
 - 
Install dependencies and run
./run.sh
Or manually for each language:
# .NET dotnet restore && dotnet run # Java mvn clean compile cargo:run # PHP composer install && php -S localhost:8000
 - 
Access the application Open http://localhost:8000 in your browser
 
Each implementation includes a mock mode that allows you to:
- Test payment flows without live API calls
 - Use simulated responses for consistent testing
 - Develop and debug without API costs
 - Toggle between mock and live modes via the UI
 
Built-in Heartland certification test cards:
- Visa: 4012002000060016
 - MasterCard: 2223000010005780, 5473500000000014
 - Discover: 6011000990156527
 - American Express: 372700699251018
 - JCB: 3566007770007321
 
All test cards use:
- Expiry: 12/2028
 - CVV: 123 (1234 for Amex)
 
The system includes pre-filled customer information for testing:
- Name: Jane Doe
 - Email: jane.doe@example.com
 - Phone: 5551112222
 - Address: 1 Example Way, Jeffersonville, IN 47130, USA
 
- Customer Information - Collect name, email, phone, and billing address
 - Payment Details - Secure tokenization using Global Payments SDK
 - Multi-Use Token Creation - Convert single-use token to multi-use token with customer data
 - Storage - Save payment method with optional nickname and default status
 
- Method Selection - Choose from stored payment methods
 - One-Click Processing - Immediate $25 charge processing
 - Real-Time Results - Live transaction status and details
 - Transaction History - Complete transaction information display
 
Each implementation provides a solid foundation for:
- Custom Payment Amounts - Modify charge amounts and currency
 - Additional Payment Types - Add authorization/capture, refunds, voids
 - Enhanced Customer Management - Expand customer data fields
 - Subscription Processing - Recurring payment capabilities
 - Advanced Reporting - Transaction history and analytics
 
Before deploying to production:
- Security: Implement proper input validation and sanitization
 - Logging: Add comprehensive logging and monitoring
 - Error Handling: Enhance error handling and user feedback
 - Database: Replace JSON storage with production database
 - Authentication: Add user authentication and authorization
 - Compliance: Ensure PCI DSS compliance measures
 
Each language implementation includes detailed documentation:
- Setup Instructions - Environment configuration and dependencies
 - API Documentation - Endpoint specifications and examples
 - Code Structure - File organization and architecture
 - Troubleshooting - Common issues and solutions
 - Recent Updates - Bug fixes and improvements
 
- β Unified API Structure - Consistent endpoints across all implementations
 - β Payment Token Handling - Fixed frontend/backend data structure alignment
 - β Customer Data Integration - Standardized customer information collection
 - β Mock Mode Functionality - Consistent testing capabilities
 
- β Java: Fixed compilation errors and response validation with Global Payments SDK
 - β .NET: Fixed CAPTURED response validation and multi-use token creation
 - β PHP: Implemented comprehensive GP API payment system
 - β All Languages: Migrated from Portico to GP API configuration
 
This project serves as a comprehensive example for Global Payments SDK integration. When contributing:
- Maintain consistency across all language implementations
 - Follow each language's best practices and conventions
 - Ensure thorough testing with both mock and live modes
 - Update documentation to reflect any changes
 
This project is provided as an educational example for Global Payments SDK integration. Please review the license file for specific terms and conditions.
For technical support:
- Global Payments Developer Documentation: https://developer.globalpay.com/
 - SDK Documentation: Language-specific SDK guides
 - Community Support: Developer forums and resources
 
Note: This is a demonstration application for development and testing purposes. For production use, implement additional security measures, error handling, and compliance requirements specific to your use case.