When and Why to Configure Behavior
Configure checkout form behavior to optimize for your specific business requirements and user demographics. Strategic configuration helps reduce payment failures while improving user experience.Card Network Filtering
Optimize payment acceptance by controlling which card brands to support. Reduce processing fees and improve conversion rates by accepting only the most relevant cards for your target markets and business agreements.
Payment Method Priority
Payment method ordering and priority are automatically managed through the PayNext Dashboard. The SDK automatically optimizes for user context and device capabilities.
Callback Integration
Build robust payment workflows with comprehensive event handling. Implement custom business logic, analytics tracking, and user experience flows that respond to payment success, failures, and different payment methods.
Environment Management
Ensure reliable deployments across all environments with proper configuration management. Set up environment-specific validation, error handling, and testing strategies that prevent production issues and maintain security.
Configure via PayNextConfig
Configure checkout form behavior through the PayNextConfig interface:
Create the instance with
new PayNextCheckout() and pass the element ID as the first parameter and your assembled PayNextConfig as the second parameter into checkout.mount('element-id', { ...config }) as demonstrated in Mount the Checkout. Apply the configuration fragments below before calling mount.Supported Card Networks
Visa
CardType.Visa
Mastercard
CardType.Mastercard
JCB
CardType.JCB
Diners Club
CardType.DinersClub
UnionPay
CardType.UnionPay
Maestro
CardType.Maestro
Advanced Patterns
Digital Wallet Configuration
Digital wallet availability (Apple Pay, Google Pay, PayPal, Venmo, Cash App Pay) depends on both your dashboard configuration and the user’s device/browser capabilities.All digital wallet configurations (merchant names, supported networks, authentication settings) are managed in your PayNext dashboard. No code changes are required when enabling or disabling payment methods.
Payment Method Priority
Set priority directly in the PayNext Dashboard (Checkout → Payment methods). Drag to reorder wallets, toggle them on/off, and add conditions for card visibility. The SDK reads this configuration on every load—no code changes or redeploys required.
- The dashboard order becomes the exact order shown in the SDK (top to bottom).
- If you never customized the list, PayNext falls back to its default order: digital wallets → PayPal → cards.
- When a method is disabled or hidden by conditions, the SDK closes the gap and keeps the remaining order intact.
- Shows payment methods available to the customer’s device/browser (e.g., hides Apple Pay on Windows)
- Applies your dashboard ordering after filtering out unsupported methods
- Respects your conditions per processor/country/currency
- Automatically hides methods when a processor disconnects or the customer’s device can’t use it.
Understanding Payment Method Availability
The SDK determines payment method availability using multiple factors:Device Capabilities
Device Capabilities
- Apple Pay: Safari on iOS/macOS with Apple Pay configured
- Google Pay: Chrome/Chromium browsers with Google Pay enabled
- PayPal: Shown when enabled in your dashboard
- Venmo: Shown for US users on desktop browsers (via QR code) and mobile browsers (via deep link or web fallback)
- Cash App Pay: Available when Stripe + Cash App Pay are enabled and the customer is in a supported region/device context
Geographic Optimization
Geographic Optimization
- North America: Prioritizes Apple Pay, Google Pay, PayPal, Venmo
- Europe: Emphasizes Apple Pay, Google Pay, PayPal, SEPA
- Asia: Focuses on local payment methods and digital wallets
- Global: Falls back to major card networks (Visa, Mastercard)
User Behavior Patterns
User Behavior Patterns
- Returning users: May see previously used payment methods first
- Mobile users: Digital wallets prioritized over card forms
- Desktop users: Traditional card forms are more prominent
- High-value transactions: May show premium payment options first
Layout Variants
Control how payment methods are initially presented:- Default Layout
- Compact Layout
Refer to Mount the Checkout for the complete mounting flow.
- Desktop-focused experiences
- Users are comfortable with traditional forms
- When screen space is abundant
- Clear overview of all payment options needed
Success States and Decline Messages
The SDK automatically handles success states and localized decline fallback messaging across all devices and browsers. Success States The SDK automatically displays success confirmations when payments are completed successfully. No additional configuration is required. Decline Messages When a payment is declined, the SDK displays a single localized fallback message regardless of the specific decline reason: This consistent messaging approach simplifies the user experience while maintaining security by not exposing specific decline detailsBest Practices
Environment Configuration
Configure different behavior per environment:environment-detection.ts
Form Validation and Error Handling
The SDK provides real-time validation for all payment fields:Card Number Validation
Card Number Validation
- Format validation: Checks card number format in real-time
- Card type detection: Automatically detects Visa, Mastercard, etc.
- Luhn algorithm: Validates card number using industry standard
- Length verification: Ensures correct number of digits
Expiry Date Validation
Expiry Date Validation
- Format checking: MM/YY format validation
- Date logic: Validates month (01-12) and future dates
- Expiry detection: Prevents expired card acceptance
- Input formatting: Auto-formats as user types
Security Code (CVC) Validation
Security Code (CVC) Validation
- Length validation: 3 digits for most cards, 4 for Amex
- Numeric verification: Ensures only numbers are entered
- Real-time feedback: Immediate validation as user types
- Card-specific rules: Adapts based on detected card type
Common Pitfalls
Avoid these behavior configuration mistakes:- Overly restrictive card filtering that excludes common payment methods
- Missing error handling for network or payment failures
- Exposing sensitive data in client-side error messages
- Not testing across environments before production deployment
- Ignoring mobile-specific considerations for payment method availability