Security Libraries
Available libraries
- Sopague Library
- Anti-fraud Library
- 3DS Library
Integrated solution
The Sopague Library is our most complete solution, combining RSA encryption and anti-fraud in a single JavaScript library.
Key features:
- RSA-OAEP encryption with SHA-256
- Built-in anti-fraud system
- Zero dependencies
- Lightweight and fast (~5KB minified)
- Compatible with all modern browsers
Legacy anti-fraud system
A specialized system for fraud detection and prevention with advanced technology.
Features:
- IP geolocation
- Device fingerprinting
- Positive and negative lists
- Neural models
- Velocity and proximity monitoring
3D Secure authentication
Full implementation of the 3D Secure protocol for two-step authentication.
Features:
- 3D Secure 2.0 authentication
- Secure redirect/challenge flow
- Transaction validation
- Support for multiple issuers
Quick start guide
1. Choose your library
For new projects: We recommend the Sopague Library because it provides integrated functionality.
For existing projects: You can continue using the dedicated libraries (Anti-fraud or 3DS).
2. Installation
<!-- To obtain the CDN URL for the Sopague library, contact support -->
<script src="https://cdn.exemplo.com/sopague/sopague.min.js"></script>
<!-- Or download and reference it locally -->
<script src="/libs/sopague-integration-library-1.0.0.min.js"></script>
3. Basic setup
// Set public key
Sopague.setEncryptPublicKey('your-public-key-here');
// Initialize anti-fraud
const sessionId = Sopague.initAntiFraud('your-session-id');
// Encrypt data
const encrypted = await Sopague.encryptCard('card-number');
Practical examples
Full e-commerce
A practical integration example in an e-commerce system with:
- Payment form
- Data validation
- Card encryption
- Anti-fraud system
- Responsive UI
NextJS integration
Custom hook and payment component for React/NextJS applications with:
- TypeScript
- State management
- Error handling
- Form validation
Vanilla JavaScript
Simple HTML + JavaScript implementation for:
- Static pages
- Quick prototypes
- Legacy system integrations
Advanced configuration
Environment variables
# RSA public key
NEXT_PUBLIC_RSA_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----..."
# Organization ID
NEXT_PUBLIC_ORG_ID="your_organization_id"
# Library version
NEXT_PUBLIC_SOPAGUE_VERSION="1.0.0"
Server configuration
// Example endpoint to process payments
app.post('/api/payments', async (req, res) => {
const { encryptedCard, antiFraudSessionId, amount } = req.body;
// Validate required security data
if (!encryptedCard || !antiFraudSessionId) {
return res.status(400).json({
message: 'Dados de segurança obrigatórios'
});
}
// Process payment with the SoPague API
// ...
});
Tests and validation
Encryption test
async function testEncryption() {
const testCard = '4111111111111111';
const encrypted = await Sopague.encryptCard(testCard);
console.log('Encryption test:', encrypted ? '✅ Success' : '❌ Failure');
}
Anti-fraud test
function testAntiFraud() {
const sessionId = Sopague.initAntiFraud('test-session');
const currentSession = Sopague.getAntiFraudSessionId();
console.log('Anti-fraud test:', currentSession ? '✅ Success' : '❌ Failure');
}
Compatibility
| Browser | Minimum version | Status |
|---|---|---|
| Chrome | 37+ | ✅ Supported |
| Firefox | 34+ | ✅ Supported |
| Safari | 11+ | ✅ Supported |
| Edge | 79+ | ✅ Supported |
| Opera | 24+ | ✅ Supported |
Requirements:
- HTTPS required (Web Crypto API)
- JavaScript enabled
- Promise support
Support and resources
Additional documentation
- Payments API - Full API documentation
- Tokenization - Secure card storage
- Webhooks - Real-time notifications
Useful resources
- Settlement Simulator - Test different scenarios
- Response Codes - Understand API results
- Health Check - Monitor availability
Next steps
- Choose the library that best fits your needs
- Implement following the provided examples
- Test in a development environment
- Configure environment variables
- Integrate with your Payments API
- Monitor behavior in production
For questions or support, contact our technical team.