description | icon |
---|---|
Visa Click to Pay is evolving to provide a better checkout experience with enhanced security features and improved performance. This guide will help you migrate from V1 to V2 in less than 30 minutes. |
cc-visa |
The evolution from Click to Pay V1 to V2 represents a fundamental shift in digital payment capabilities, addressing key merchant and consumer pain points while setting new standards for security and user experience. V2 introduces significant architectural improvements and feature enhancements that align with the industry's movement toward passwordless authentication and seamless checkout experiences. This transformation comes at a crucial time when digital commerce demands both frictionless transactions and robust security measures.
Feature Aspect | V1 | V2 |
---|---|---|
🔐 Security Features | ⛔️ card data handling, prone to fraud. | ✅ tokenization and biometric authentication, meeting FIDO standards. |
🚀 Speed of Payment | ⛔️ Requires multiple steps - OTPs are used for cardholder verification during online transactions, adding an extra layer of security but also introducing additional steps in the checkout process | ✅ V2 integrates advanced authentication methods, such as biometrics and device recognition, reducing the reliance on OTPs. This shift enhances security while streamlining the user experience by minimizing interruptions during checkout.Biometric authentication reduces checkout time by 50%. |
🛜 Integration | ⛔️ Separate APIs and infrastructure for different card networks. | ✅ Unified integration across multiple card network |
🙎🏻♂️ User Experience | ⛔️ Authentication requires username/password login for:
⛔️ Separate authentication needed across different devices
|
✅ Hybrid authentication approach:
✅ Device-specific recognition:
|
💳 Push Provisioning | ⛔️ Not supported. Users cannot add their cards directly to Click to Pay from the issuer's app. | ✅ Supported. Issuers can enrol cardholders into Click to Pay directly from their banking app, streamlining the enrolment process. |
🌏 Global Market Adoption | 🚧 Limited deployment and compatibility with some regions and merchants. | ✅ Available in 35+ countries, supported by major card networks |
🔁 Recurring Payments | 🚧 Limited support for saving credentials and managing recurring payments | ✅ Built-in support for recurring payments and saved credentials |
The migration to V2 is powered by Hyperswitch's specialized wrapper solution, ensuring a frictionless transition that protects your existing integration while unlocking next-generation features. Our wrapper automatically handles version detection, request/response mapping, and backward compatibility - eliminating the risk of business disruption during migration.
This guide will help you migrate from Visa Click to Pay SDK V1 to V2 in less than 30 minutes. Our wrapper maintains backward compatibility while giving you access to V2's enhanced features.
Choose your integration path based on your business needs:
Method | Best For | Key Benefits | Considerations |
---|---|---|---|
PSP Integration | Small-medium businesses | • Fastest deployment |
Limited customization |
Acquirer Integration | Established merchants | • Moderate effort |
Shared compliance |
Direct Integration | Large enterprises | • Full control |
Requires PCI-DSS |
Decision factors: Dev resources, time to market, customization needs, compliance capabilities
npm install @visa/click-to-pay-wrapper
// Old V1 Import
import { VisaSRCI } from '@visa/click-to-pay-v1';
// New V2 Import
import { VisaClickToPayWrapper } from '@visa/click-to-pay-wrapper';
// Old V1 Initialization
const visaCheckout = new VisaSRCI();
await visaCheckout.init({
apikey: 'your_api_key',
visaSrci: true
});
// New V2 Initialization
const visaCheckout = new VisaClickToPayWrapper({
debug: true, // Optional: Enable debug logging
apikey: 'your_api_key',
srcInitiatorId: 'your_initiator_id',
environment: 'production' // or 'sandbox' for testing
});
await visaCheckout.init();
// Optional: Configure additional features
await visaCheckout.init({
apiKey: 'your_api_key',
environment: 'production',
features: {
biometrics: true,
quickCheckout: true
},
locale: 'en-US' // Optional: Set preferred locale
});
// New event handling system
visaCheckout.on('checkout_started', (data) => {
console.log('Checkout started:', data);
});
visaCheckout.on('payment_complete', (data) => {
console.log('Payment complete:', data);
});
// Additional events available in V2
visaCheckout.on('authentication_required', (data) => {
console.log('Authentication required:', data);
});
visaCheckout.on('biometric_prompt', (data) => {
console.log('Biometric authentication prompted:', data);
});
// Both V1 and V2 formats work with the wrapper
const checkoutResponse = await visaCheckout.checkout({
amount: '100.00',
currency: 'USD',
merchantName: 'Test Store'
});
Before enabling biometric authentication, verify device capabilities:
// Check biometric availability
const checkBiometricSupport = async () => {
const capabilities = await visaCheckout.checkDeviceCapabilities();
if (capabilities.biometrics) {
// Enable biometric flow
await visaCheckout.enableBiometrics();
} else {
// Fallback authentication methods in order of preference:
// 1. Device binding (Remember this device)
// 2. OTP verification
// 3. Password authentication
await visaCheckout.enableFallbackAuth({
preferDeviceBinding: true,
allowOTP: true
});
}
};
if (visaCheckout.version === 'v2') {
try {
await visaCheckout.enableBiometrics();
console.log('Biometrics enabled successfully');
} catch (error) {
console.error('Biometrics setup failed:', error);
// Fallback to traditional authentication
}
}
if (visaCheckout.version === 'v2') {
try {
const quickCheckoutResponse = await visaCheckout.quickCheckout(token);
console.log('Quick checkout completed:', quickCheckoutResponse);
} catch (error) {
console.error('Quick checkout failed:', error);
// Fallback to regular checkout
const regularCheckoutResponse = await visaCheckout.checkout(options);
}
}
Common Error Scenarios:
// Network and Connection Errors
NETWORK_ERROR: 'Connection failed during API call'
TIMEOUT_ERROR: 'Request timed out'
API_ERROR: 'API endpoint not responding'
// Authentication Errors
AUTH_INVALID: 'Invalid authentication credentials'
AUTH_EXPIRED: 'Authentication session expired'
BIOMETRIC_FAILED: 'Biometric authentication failed'
// Transaction Errors
CARD_DECLINED: 'Card was declined'
INSUFFICIENT_FUNDS: 'Insufficient funds'
RISK_DECLINE: 'Transaction declined due to risk assessment'
Error Handling Best Practices:
try {
const response = await visaCheckout.checkout(options);
handleSuccess(response);
} catch (error) {
switch(error.code) {
case 'NETWORK_ERROR':
await retryWithBackoff(3); // Retry up to 3 times
break;
case 'AUTH_EXPIRED':
await refreshAuthSession();
break;
case 'BIOMETRIC_FAILED':
await fallbackToOTP();
break;
// Add more specific error handling
}
}
V2 supports multiple authentication methods:
// Configure authentication preferences
await visaCheckout.init({
apiKey: 'your_api_key',
environment: 'production',
authentication: {
preferBiometric: true, // Prefer biometric when available
fallbackToPassword: true, // Allow password as fallback
allowRememberMe: true // Enable "Remember Me" feature
}
});
// Handle authentication events
visaCheckout.on('authentication_method_selected', (method) => {
switch(method) {
case 'biometric':
console.log('User selected biometric authentication');
break;
case 'password':
console.log('User selected password authentication');
break;
case 'otp':
console.log('One-time password required');
break;
}
});
- Install new wrapper package
- Update import statements
- Update initialization code
- Test existing V1 flows with wrapper
- Implement error handling
- Add V2 specific features (optional)
- Test in sandbox environment
- Deploy to production
- Enable new V2 features gradually
- Monitor error rates and user feedback
- Update documentation and support materials
- Train customer support team on new features
- Use the wrapper for gradual migration
- Test both V1 and V2 flows in sandbox first
- Enable new features progressively
- Implement proper error handling
- Monitor for any issues after deployment
- Use feature detection for V2-specific features
- Maintain fallback options for all new features
- Test across different browsers and devices
- Monitor performance metrics
- Keep error handling and logging comprehensive
// Lazy load the SDK when needed
const loadSDK = async () => {
if (!window.visaCheckout) {
await import('@visa/click-to-pay-wrapper');
}
return window.visaCheckout;
};
// Configure optimal resource loading
await visaCheckout.init({
apiKey: 'your_api_key',
environment: 'production',
loading: {
preload: ['essential'], // Preload essential components
lazy: ['biometrics', 'analytics'], // Lazy load optional features
timeout: 5000 // Set reasonable timeouts
}
});
// Solution: Use wrapper's normalizeConfig method
const config = visaCheckout.normalizeConfig(yourConfig);
// Solution: Use wrapper's unified event system
visaCheckout.on('checkout_started', handleCheckoutStarted);
// Solution: Wrapper automatically handles conversion
const response = await visaCheckout.checkout(options);
// Solution: Explicitly check version compatibility
if (!visaCheckout.isFeatureSupported('biometrics')) {
// Fallback to traditional authentication
}
// Solution: Implement proper session handling
visaCheckout.on('session_expired', async () => {
await visaCheckout.refreshSession();
// Retry the last operation
});
The wrapper maintains PCI compliance while handling sensitive data:
// Configure secure data handling
await visaCheckout.init({
apiKey: 'your_api_key',
environment: 'production',
security: {
pciCompliant: true,
tokenization: true,
encryptPayload: true
}
});
// Enable additional security features
await visaCheckout.init({
apiKey: 'your_api_key',
environment: 'production',
security: {
validateOrigin: true,
strictCSP: true,
requireHTTPS: true
}
});
// Initialize in sandbox mode
const visaCheckout = new VisaClickToPayWrapper({
apikey: 'your_sandbox_api_key',
environment: 'sandbox',
debug: true
});
// Test card numbers
const testCards = {
success: '4111111111111111',
decline: '4000000000000002',
error: '4000000000000069'
};
// Test error scenarios
await visaCheckout.simulateError('NETWORK_ERROR');
await visaCheckout.simulateError('AUTHENTICATION_FAILED');
await visaCheckout.simulateError('CARD_DECLINED');
// Test recurring payment setup
const recurringTest = async () => {
// Initial charge
const initial = await visaCheckout.checkout({
amount: '10.00',
currency: 'USD',
recurring: true,
recurringType: 'subscription'
});
// Subsequent charge
const recurring = await visaCheckout.recurringCharge({
originalTransactionId: initial.transactionId,
amount: '10.00'
});
};
await visaCheckout.init({
apiKey: 'your_api_key',
environment: 'production',
analytics: {
enabled: true,
captureErrors: true,
capturePerformance: true
}
});
// Track custom events
visaCheckout.trackEvent({
category: 'Checkout',
action: 'Started',
label: 'Quick Checkout Button',
value: cartTotal
});
For additional support:
- Contact Visa support team at [email protected]
- Visit our developer portal at https://developer.visa.com
- Join our developer community at https://community.visa.com
- API Reference - JavaScript SDK reference for implementing Click to Pay
- Integration Overview - Comprehensive implementation guide and requirements
- Merchant & PSP Guide - Best practices and implementation paths for merchants and payment service providers
Remember to test thoroughly in the sandbox environment before deploying to production, and enable new features gradually to ensure a smooth transition for your users.