A reference implementation demonstrating how to integrate with Paynetworx 3DS (3D Secure) endpoint for secure payment processing.
This repository provides an example of 3D Secure integration for online merchants. 3D Secure (3DS) is a security protocol designed to provide an additional layer of security for online credit and debit card transactions. This implementation demonstrates both the backend server integration and frontend payment form implementation using modern web technologies.
- Complete 3DS 2.0 workflow implementation
- Frontend payment form with card data collection
- Backend integration with Paynetworx 3DS API
- Docker containerization for easy testing
- Support for both frictionless flow and challenge flow
- Vue.js and TypeScript implementation
Before you begin, ensure you have the following installed:
- Docker and Docker Compose (for containerized deployment)
- Node.js and npm (for local development)
- TypeScript development environment
- Access to Paynetworx 3DS environment (credentials required)
The backend component is built with Express.js (Node.js) and handles:
- Hosting the payment web application
- Communicating with the Paynetworx 3DS API
- Managing the authentication flow
- Processing transaction responses
Key API endpoints:
/api/auth: Initiates the payment authorization process/api/3ds_method/:tranId: Handles 3DS method verification/api/challenge/:tranId: Processes the challenge completion
The frontend is a Vue.js application that provides:
- Payment form for card details collection
- 3DS flow integration
- User experience during authentication
- Response handling
git clone https://github.com/Paynetworx/3ds-merchant-example.git
cd 3ds-merchant-exampleCreate a docker-compose.yml file by copying the example and updating it with your credentials:
cp docker-compose.yml.example docker-compose.ymlEdit the docker-compose.yml file to include:
- Your Paynetworx 3DS endpoint URL
- Your API username and password
- Any other environment-specific configurations
# Build the Docker image
docker build .
# Start the containers
docker compose up -dOnce running, access the payment demo at:
http://localhost:8080
This implementation handles the complete 3DS authentication flow:
- Card Data Collection: Gather payment card details from the customer
- Authentication Initiation: Send card details to the 3DS server
- Method Verification (Browser fingerprinting): Collect browser data for risk assessment
- Authentication Request: Process authentication with the card issuer
- Challenge Flow (if required): Present challenge screen to the customer
- Authentication Result: Receive and process the authentication result
- Payment Authorization: Complete the payment transaction
The flow supports both frictionless (no challenge required) and challenge flows based on the issuer's risk assessment.
For local development:
docker compose build
docker compose up- This is not a production ready implementation, just a basic implemention to help you understand the integration process
- Never store card data permanently
- Always use HTTPS for production environments
- Follow PCI-DSS requirements for handling card data
- Implement proper error handling and logging
Common issues and solutions:
- Connection errors: Verify network connectivity and API credentials
- Authentication failures: Check card details and 3DS enrollment
- Challenge flow issues: Ensure proper handling of redirect URLs
Contributions are welcome! Please feel free to submit a Pull Request.
This is a reference implementation for educational purposes. Before going live with a payment integration, ensure all security and compliance requirements are met.
For questions or support regarding this implementation, please contact Paynetworx support.