Complete implementation of Global Payments Drop-In UI for processing Sale transactions using the official SDKs across 4 programming languages. All implementations follow the same architecture and use modern GP-API with GpApiConfig.
| Language | Framework | SDK Version | Status |
|---|---|---|---|
| PHP | Built-in Server | v13.4+ | β Complete |
| Node.js | Express.js | v3.10.6+ | β Complete |
| Java | Jakarta Servlet | v14.2.20 | β Complete |
| .NET | ASP.NET Core | v9.0.16 | β Complete |
All implementations use the same architecture:
- Tokenization Token - Generated server-side with
PMT_POST_Create_Singlepermission for Drop-In UI - Transaction Token - SDK-generated automatically during transaction processing
- POST /get-access-token - Generates access token for Drop-In UI initialization
- POST /process-sale - Processes Sale transaction using payment reference from Drop-In UI
Browser β /get-access-token β GP API (Tokenization Token)
β
Drop-In UI (Card Tokenization - PCI Compliant)
β
Browser β /process-sale β SDK β GP API (Sale Transaction)
β
Success/Error Response
cd php # or nodejs, java, dotnet# Copy environment template
cp .env.sample .env
# Edit .env with your credentials
GP_APP_ID=your_app_id_here
GP_APP_KEY=your_app_key_here
GP_ENVIRONMENT=sandboxPHP:
composer install
php -S localhost:8000Node.js:
npm install
npm startJava:
mvn clean package
mvn cargo:run.NET:
dotnet restore
dotnet run- Open http://localhost:8000
- Enter amount (e.g., 10.00)
- Use test card: 4263 9826 4026 9299
- CVV: 123, Expiry: Any future date
- Click SUBMIT
- Verify success with transaction ID
| Brand | Card Number | CVV | Expiry |
|---|---|---|---|
| Visa | 4263 9826 4026 9299 | 123 | Any future |
| Visa | 4263 9700 0000 5262 | 123 | Any future |
| Mastercard | 5425 2334 2424 1200 | 123 | Any future |
| Discover | 6011 0000 0000 0012 | 123 | Any future |
More test cards: Global Payments Test Cards
All implementations use the same environment variables:
# Required
GP_APP_ID=your_app_id_here # From developer dashboard
GP_APP_KEY=your_app_key_here # From developer dashboard
# Optional
GP_ENVIRONMENT=sandbox # sandbox or production
# Not Recommended (SDK auto-detects)
# GP_ACCOUNT_NAME=Transaction_Processing- Do NOT manually set
GP_ACCOUNT_NAME- The SDK automatically detects the correct account from yourAPP_ID/APP_KEY - Manually setting the account name can cause "Access token and merchant info do not match" errors
- Let the SDK handle account selection for best compatibility
- β Modern GP-API - Uses GpApiConfig (not legacy Portico)
- β Drop-In UI - Pre-built payment form from Global Payments
- β PCI SAQ A Compliant - Card data never touches your server
- β Two-Token Architecture - Secure tokenization + transaction flow
- β Auto-Configuration - SDK auto-detects account settings
- β Centered UI - Professional, responsive design
- β Error Handling - Comprehensive error handling
- β Test Cards Link - Elegant button to test cards documentation
- π SHA-512 hashing for token generation
- π Environment variables for credentials (not in code)
- π Drop-In UI handles card input (PCI compliant)
- π Token-based authentication
- π HTTPS ready for production
Each language implementation follows this structure:
language/
βββ server file # Main application file
βββ index.html # Drop-In UI frontend (or in static/webapp/wwwroot)
βββ .env # Credentials (not tracked in git)
βββ .env.sample # Configuration template
βββ README.md # Language-specific documentation
βββ dependencies file # package.json, requirements.txt, pom.xml, etc.
| Language | Server File | HTML Location | Config File |
|---|---|---|---|
| PHP | get-access-token.php, process-sale.php |
index.html |
composer.json |
| Node.js | server.js |
index.html |
package.json |
| Java | ProcessPaymentServlet.java |
src/main/webapp/index.html |
pom.xml |
| .NET | Program.cs |
wwwroot/index.html |
dotnet.csproj |
Get Access Token:
POST /get-access-token
Response: { "success": true, "token": "...", "expiresIn": 600 }
Process Sale:
POST /process-sale
Body: { "payment_reference": "PMT_...", "amount": 10.00, "currency": "USD" }
Response: { "success": true, "message": "Payment successful!", "data": {...} }
All implementations use this pattern:
// Conceptual example
config = new GpApiConfig()
config.appId = GP_APP_ID
config.appKey = GP_APP_KEY
config.environment = GP_ENVIRONMENT
config.channel = CardNotPresent
config.country = "US"
// Note: Don't set account name - SDK auto-detects
ServicesContainer.configure(config)GP_ENVIRONMENT=productionIn index.html, change Drop-In UI environment:
GlobalPayments.configure({
accessToken: accessToken,
apiVersion: '2021-03-22',
env: 'production' // Change from 'sandbox'
});- Use production credentials
- Enable HTTPS/SSL
- Configure CORS for your domain
- Set up rate limiting
- Enable logging and monitoring
- Review error handling (don't expose sensitive details)
- Test with production credentials in sandbox first
- Use production web server (not development server)
- PHP: Use Apache/Nginx with PHP-FPM
- Node.js: Use PM2 or similar process manager
- Java: Use Tomcat or similar servlet container
- .NET: Use Kestrel behind reverse proxy (Nginx/IIS)
Each implementation has its own detailed README:
- PHP README - Comprehensive PHP documentation
- Node.js README - Node.js specific guide
- Java README - Java/Maven documentation
- .NET README - .NET Core guide
"Access token and merchant info do not match"
- Solution: Comment out
GP_ACCOUNT_NAMEin.envfile. Let SDK auto-detect.
"Failed to generate access token"
- Solution: Verify
GP_APP_IDandGP_APP_KEYare correct in.envfile.
Drop-In UI not loading
- Solution: Check browser console for errors. Verify access token is generated successfully.
Transaction declined
- Solution: Ensure using test cards in sandbox. Verify amount > 0.
Server won't start
- Solution: Check if port 8000 is already in use. Verify dependencies are installed.
- Check language-specific README for detailed troubleshooting
- Review Global Payments Documentation
- Check GitHub Issues
This project uses modern GP-API with GpApiConfig (not legacy Portico/Heartland API).
| Legacy (Portico) | Modern (GP-API) |
|---|---|
| PorticoConfig | GpApiConfig |
| SECRET_API_KEY | GP_APP_ID + GP_APP_KEY |
| Manual account config | Auto-detection |
| Basic forms | Drop-In UI |
If migrating from Portico, see the commit history on the rewriting-implementations branch for migration patterns.
- 4 Languages: PHP, Node.js, Java, .NET
- 100% Feature Parity: All implementations identical
- PCI Compliant: SAQ A level compliance
- Production Ready: Comprehensive error handling
- Well Documented: Complete READMEs for each language
MIT License
Each language implementation follows the same architecture. When contributing:
- Maintain consistency across all languages
- Update all language implementations for feature additions
- Keep .env.sample files identical
- Ensure Drop-In UI integration remains consistent
- Test with sandbox credentials before committing
Potential future enhancements:
- Authorization (pre-auth) transactions
- Refund processing
- Recurring payments/subscriptions
- Multi-currency support
- Webhook handling for payment notifications
- Payment method management (save cards)
Built with official Global Payments SDKs:
- π Developer Portal β developer.globalpayments.com
- π¬ Discord β Join the community
- π GitHub Discussions β github.com/orgs/globalpayments/discussions
- π§ Newsletter β Subscribe
- πΌ LinkedIn β Global Payments for Developers
Have a question or found a bug? Open an issue or reach out at communityexperience@globalpay.com.