This project demonstrates Google Pay payment processing integration with the Global Payments GP-API across multiple programming languages. Each implementation shows how to handle encrypted mobile payment tokens from Google Pay and process them securely through the GP-API.
- .NET Core - (Preview) - ASP.NET Core web application
- Java - (Preview) - Jakarta EE servlet-based web application
- PHP - (Preview) - PHP web application
- Google Pay Token Processing - Handle encrypted mobile payment tokens
- GP-API Integration - Secure processing through Global Payments GP-API
- Comprehensive Validation - Input validation and error handling
- Production Ready - Complete implementation with security best practices
Each implementation includes:
-
Google Pay Configuration
- Merchant configuration endpoint
- Google Pay button settings
- Environment-specific configuration
- Currency and country code management
-
Payment Processing
- GET
/config- Google Pay merchant configuration - POST
/process-google-pay- Google Pay token processing - Encrypted mobile token handling
- Multi-currency transaction support
- GET
-
Security & Validation
- Token format validation
- Amount and currency validation
- Comprehensive error handling
- Transaction status verification
- Choose your language - Navigate to any implementation directory (dotnet, java, php)
- Set up credentials - Copy
.env.sampleto.envand add your Global Payments GP-API credentials - Configure Google Pay - Update Google Pay merchant settings in
.envfile - Run the server - Execute
./run.shto install dependencies and start the server - Test payments - Use the web interface to test Google Pay transactions
To use this integration, you'll need:
- Global Payments GP-API Account - With Google Pay processing enabled
- Google Pay Merchant Account - Registered with Google Pay
- SSL Certificate - Required for Google Pay in production
- Development Environment - For your chosen language (.NET, Java, or PHP)
- Global Payments GP-API account with credentials:
GP_API_APP_ID- Your application IDGP_API_APP_KEY- Your application key
- Google Pay merchant configuration:
- Google Merchant ID for Google Pay
- Merchant name and display settings
- Development environment for your chosen language
- Package manager (dotnet, maven, composer)
Each implementation uses the following environment variables:
# Global Payments GP-API Configuration
GP_API_APP_ID=your_app_id_here
GP_API_APP_KEY=your_app_key_here
ENVIRONMENT=TEST # or PRODUCTION
MERCHANT_ID=your_merchant_id
MERCHANT_NAME="Your Merchant Name"
# Google Pay Configuration
GOOGLE_PAY_MERCHANT_ID=12345678901234567890
GOOGLE_PAY_COUNTRY_CODE=US
GOOGLE_PAY_CURRENCY_CODE=USD
GOOGLE_PAY_BUTTON_COLOR=black- Register for a Google Pay merchant account
- Configure your merchant settings in the Google Pay console
- Add your domain to the allowed origins list
- Update the environment variables with your merchant information
- Use Google Pay test cards for development
- Ensure your development environment uses HTTPS for Google Pay
- Test with multiple currencies if supporting international payments
Returns Google Pay configuration for client-side initialization:
{
"success": true,
"data": {
"merchantInfo": {
"merchantName": "Your Merchant Name",
"merchantId": "your_merchant_id"
},
"googlePayConfig": {
"googleMerchantId": "12345678901234567890",
"environment": "TEST",
"countryCode": "US",
"currencyCode": "USD",
"buttonColor": "black"
}
}
}Processes Google Pay payment tokens:
Request:
{
"token": "{google_pay_encrypted_token}",
"amount": "10.00",
"currency": "USD"
}Success Response:
{
"success": true,
"message": "Payment successful! Transaction ID: TXN_123456",
"data": {
"transactionId": "TXN_123456",
"amount": "10.00",
"currency": "USD",
"status": "SUCCESS",
"responseCode": "00",
"authCode": "AUTH123",
"timestamp": "2023-01-01T12:00:00Z"
}
}| Brand | Number | CVV | Expiry |
|---|---|---|---|
| Visa | 4263 9826 4026 9299 | 123 | Any future |
| Mastercard | 5425 2334 2424 1200 | 123 | Any future |
Google Pay sandbox uses virtual test cards. Refer to the Google Pay Test Cards docs for token-based testing.
This implementation includes production-ready security features:
- Input validation and sanitization
- Encrypted token processing
- Comprehensive error handling
- Transaction verification
- Secure credential management
- Rate limiting recommendations
- HTTPS enforcement for production
- 🌐 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.
MIT