Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Global Payments Java Integration

A comprehensive Java implementation for Global Payments payment processing and transaction reporting using Jakarta EE and the Global Payments SDK.

Requirements

  • Java 17+
  • Maven 3.8+
  • Global Payments Portico credentials (PUBLIC_API_KEY, SECRET_API_KEY)

Quick Start

1. Configure Credentials

Copy .env.sample to .env and add your credentials:

PUBLIC_API_KEY=pkapi_cert_your_key_here
SECRET_API_KEY=skapi_cert_your_key_here

2. Install Dependencies

mvn clean install

3. Start the Server

./run.sh

Or manually:

mvn cargo:run

The application will start on http://localhost:8000

4. Verify Setup

Open your browser to:

Features

✅ Payment Processing

  • Process card payments with hosted fields tokenization
  • Support for billing address verification (AVS)
  • Real-time payment processing with Global Payments Portico API

✅ Transaction Reporting

  • Search and filter transactions
  • Export data (JSON, CSV, XML)
  • Generate settlement, dispute, and deposit reports
  • Transaction analytics and summaries

API Endpoints

Payment Processing

Get Configuration

curl http://localhost:8000/config

Process Payment

curl -X POST http://localhost:8000/process-payment \
  -d "payment_token=YOUR_TOKEN" \
  -d "billing_zip=12345" \
  -d "amount=25.00"

Transaction Reporting

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"

Project Structure

java/
├── src/main/java/com/globalpayments/example/
│   ├── ProcessPaymentServlet.java    # Payment processing endpoint
│   ├── ReportsController.java        # Reporting API endpoints
│   ├── ReportingService.java         # Reporting service logic
│   └── CorsFilter.java               # CORS support
├── src/main/webapp/
│   ├── index.html                    # Payment form UI
│   └── WEB-INF/web.xml              # Servlet configuration
├── pom.xml                           # Maven dependencies
├── .env                              # Your credentials (not in git)
├── .env.sample                       # Credential template
├── README.md                         # This file
└── REPORTING_README.md               # Reporting API documentation

Usage

Processing a Payment

  1. Open http://localhost:8000/index.html in your browser
  2. Use test card: 4012002000060016
  3. Enter any future expiration date
  4. Enter CVV: 123
  5. Enter billing ZIP code
  6. Click "Pay $10.00"

Searching Transactions

After processing payments, search for them:

curl "http://localhost:8000/reports?action=search&page_size=20"

Exporting Data

Export transactions to CSV:

curl "http://localhost:8000/reports?action=export&format=csv&start_date=2025-09-01" -o transactions.csv

Testing

Test Card Numbers

Card Type Number CVV Expiry
Visa 4012002000060016 123 Any future date
Mastercard 5473500000000014 123 Any future date
Amex 372700699251018 1234 Any future date

Testing Workflow

  1. Process a payment using the web interface
  2. Verify transaction appears in reporting:
    curl "http://localhost:8000/reports?action=search"
  3. Get transaction details:
    curl "http://localhost:8000/reports?action=detail&transaction_id=TRN_xxx"

Environment Variables

Variable Required Description
PUBLIC_API_KEY Yes Portico public key for payment processing
SECRET_API_KEY Yes Portico secret key for payment processing

Troubleshooting

Port already in use?

# Change the port in run.sh or use:
mvn cargo:run -Dcargo.servlet.port=8080

Missing credentials error?

  • Ensure .env file exists in the java/ directory
  • Verify all required credentials are set
  • Check for trailing spaces in credential values

Payment processing fails?

  • Verify PUBLIC_API_KEY and SECRET_API_KEY are correct
  • Ensure using test credentials for test environment

Build fails? Verify Java 17+: java -version. Verify Maven 3.8+: mvn -version.

Documentation

Support

For issues or questions: