Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191

This commit is contained in:
southseact-3d
2026-02-07 20:32:41 +00:00
commit ed67b7741b
252 changed files with 99814 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
# 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`: true
- `showSecurityBadge`: true
## Implementation Details
### Files Updated
1. **select-plan.html** - Plan selection checkout
2. **settings.html** - Subscription management checkout
3. **topup.html** - Token top-up checkout
### Core Changes
Each file now implements:
1. **Dodo Payments Script**
```html
<script src="https://js.dodopayments.com/v1"></script>
```
2. **Themed Inline Checkout**
```javascript
DodoPayments.Checkout.open({
checkoutUrl: checkoutUrl,
elementId: 'checkout-container',
options: {
themeConfig: {
light: { /* ... custom colors ... */ },
dark: { /* ... custom colors ... */ },
radius: '8px'
},
payButtonText: 'Complete Payment',
// ... other options
}
});
```
3. **Modal Container**
- Creates overlay: `rgba(0, 0, 0, 0.7)` backdrop
- Centered modal with `500px` max-width, `600px` height
- 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
1. **Theme Consistency**
- [ ] Colors match app design
- [ ] Border radius consistent with app
- [ ] Font family matches (Inter)
2. **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
3. **Responsiveness**
- [ ] Works on mobile devices
- [ ] Works on tablet devices
- [ ] Properly sized modal on various screens
4. **Integration**
- [ ] Plan selection checkout works
- [ ] Settings subscription checkout works
- [ ] Token top-up checkout works
- [ ] Payment method management works