3.4 KiB
3.4 KiB
Dodo Inline Checkout Theming Implementation
Overview
All checkout implementations have been updated to use Dodo Payments' inline checkout with custom theming that matches the app design. The checkout process now displays inline (embedded) rather than in popup windows, providing a more integrated user experience.
Theming Configuration
Color Scheme
The inline checkout uses a carefully crafted theme based on the app's design system:
Light Mode:
bgPrimary: '#FFFFFF' (white background)bgSecondary: '#F8FAFC' (light gray secondary)buttonPrimary: '#008060' (app's signature green)buttonPrimaryHover: '#004C3F' (darker green on hover)inputFocusBorder: '#008060' (green focus border)
Dark Mode:
- Consistent with app's dark theme
- Maintains same green accent color (
#008060) - Adjusted text colors for readability
Other Customizations
radius: '8px' (matches app button style)payButtonText: 'Complete Payment'fontSize: '14px'fontWeight: '500'showTimer: trueshowSecurityBadge: true
Implementation Details
Files Updated
- select-plan.html - Plan selection checkout
- settings.html - Subscription management checkout
- topup.html - Token top-up checkout
Core Changes
Each file now implements:
- Dodo Payments Script
<script src="https://js.dodopayments.com/v1"></script>
- Themed Inline Checkout
DodoPayments.Checkout.open({
checkoutUrl: checkoutUrl,
elementId: 'checkout-container',
options: {
themeConfig: {
light: { /* ... custom colors ... */ },
dark: { /* ... custom colors ... */ },
radius: '8px'
},
payButtonText: 'Complete Payment',
// ... other options
}
});
- Modal Container
- Creates overlay:
rgba(0, 0, 0, 0.7)backdrop - Centered modal with
500pxmax-width,600pxheight - Close button with hover effects
- ESC key and click-outside-to-close support
Enhanced User Experience
- No popup blockers: No longer using
window.open() - Integrated design: Checkout matches app colors and typography
- Improved feedback: Loading states, timeout handling, success/error messages
- Better accessibility: Keyboard controls, screen reader friendly
API Integration
The backend remains unchanged:
/api/subscription/checkout- Create checkout sessions/api/subscription/confirm- Confirm payment status/api/account/payment-methods/*- Manage payment methods
Browser Support
Dodo inline checkout is supported on all modern browsers and automatically handles browser compatibility issues. The implementation includes fallback handling and error states.
Testing Checklist
-
Theme Consistency
- Colors match app design
- Border radius consistent with app
- Font family matches (Inter)
-
Functionality
- Checkout opens inline (not popup)
- Payment processing works correctly
- Close button works properly
- ESC key closes modal
- Clicking backdrop closes modal
- Payment success redirects appropriately
- Payment failure shows error messages
-
Responsiveness
- Works on mobile devices
- Works on tablet devices
- Properly sized modal on various screens
-
Integration
- Plan selection checkout works
- Settings subscription checkout works
- Token top-up checkout works
- Payment method management works