A comprehensive Python implementation for Global Payments payment processing and transaction reporting using Flask and the Global Payments Python SDK.
- Python 3.8+
- pip
- Global Payments Portico credentials (
PUBLIC_API_KEY,SECRET_API_KEY)
Copy .env.sample to .env and add your credentials:
PUBLIC_API_KEY=pkapi_cert_your_key_here
SECRET_API_KEY=skapi_cert_your_key_herepython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txt./run.shOr manually:
python server.pyThe application will start on http://localhost:8000
Open your browser to:
- Web Interface: http://localhost:8000/index.html
- Get Public Key: http://localhost:8000/config
- Reporting Config: http://localhost:8000/reports?action=config
- Process card payments with hosted fields tokenization
- Support for billing address verification (AVS)
- Real-time payment processing with Global Payments Portico API
- Search and filter transactions
- Export data (JSON, CSV, XML)
- Generate settlement, dispute, and deposit reports
- Transaction analytics and summaries
Get Configuration
curl http://localhost:8000/configProcess Payment
curl -X POST http://localhost:8000/process-payment \
-H "Content-Type: application/json" \
-d '{"payment_token":"YOUR_TOKEN","billing_zip":"12345","amount":"25.00"}'See REPORTING_README.md for complete reporting API documentation.
Quick Example - Search Transactions
curl "http://localhost:8000/reports?action=search&start_date=2025-09-01&page_size=10"python/
├── server.py # Main Flask application
├── reports.py # Reporting API endpoints
├── reporting_service.py # Reporting service logic
├── index.html # Payment form UI
├── requirements.txt # Python dependencies
├── .env # Your credentials (not in git)
├── .env.sample # Credential template
├── README.md # This file
└── REPORTING_README.md # Reporting API documentation
- Open http://localhost:8000/index.html in your browser
- Use test card:
4012002000060016 - Enter any future expiration date
- Enter CVV:
123 - Enter billing ZIP code
- Click "Pay $10.00"
After processing payments, search for them:
curl "http://localhost:8000/reports?action=search&page_size=20"Export transactions to CSV:
curl "http://localhost:8000/reports?action=export&format=csv&start_date=2025-09-01" -o transactions.csv| Card Type | Number | CVV | Expiry |
|---|---|---|---|
| Visa | 4012002000060016 | 123 | Any future date |
| Mastercard | 5473500000000014 | 123 | Any future date |
| Amex | 372700699251018 | 1234 | Any future date |
- Process a payment using the web interface
- Verify transaction appears in reporting:
curl "http://localhost:8000/reports?action=search" - Get transaction details:
curl "http://localhost:8000/reports?action=detail&transaction_id=TRN_xxx"
| Variable | Required | Description |
|---|---|---|
PUBLIC_API_KEY |
Yes | Portico public key for payment processing |
SECRET_API_KEY |
Yes | Portico secret key for payment processing |
PORT |
No | Server port (default: 8000) |
Port already in use?
# Use a different port:
PORT=8080 python server.pyMissing credentials error?
- Ensure
.envfile exists in thepython/directory - Verify all required credentials are set
- Check for trailing spaces in credential values
Payment processing fails?
- Verify
PUBLIC_API_KEYandSECRET_API_KEYare correct - Ensure using test credentials for test environment
Virtual environment issues?
- Ensure virtual environment is activated before running
- Recreate if needed:
python -m venv venv --clear
- Payment Processing: See API Endpoints section above
- Transaction Reporting: See REPORTING_README.md
- Global Payments Docs: https://developer.globalpayments.com
For issues or questions:
- Global Payments Developer Portal: https://developer.globalpayments.com
- SDK Documentation: https://github.com/globalpayments/python-sdk