Spaces:
Running

File size: 14,019 Bytes
2606d6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Checkout - ContentCraft AI</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://js.stripe.com/v3/"></script>
    <style>
        .checkout-card {
            transition: all 0.3s ease;
        }
        .checkout-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body class="bg-gray-50 font-sans antialiased">
    <!-- Navigation -->
    <nav class="relative z-10 bg-white shadow-sm">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <a href="index.html" class="text-xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-cyan-500 to-indigo-500">ContentCraft AI</a>
                </div>
                <div class="hidden md:flex items-center space-x-8">
                <a href="index.html" class="text-gray-700 hover:text-primary-500 font-medium">Home</a>
                <a href="services.html" class="text-gray-700 hover:text-primary-500 font-medium">Services</a>
                <a href="about.html" class="text-gray-700 hover:text-primary-500 font-medium">About</a>
                <a href="faq.html" class="text-gray-700 hover:text-primary-500 font-medium">FAQ</a>
                <a href="contact.html" class="text-gray-700 hover:text-primary-500 font-medium">Contact</a>
                <button class="bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 rounded-lg font-medium transition-colors">Get Started</button>
            </div>
            <div class="md:hidden flex items-center">
                <button>
                    <i data-feather="menu"></i>
                </button>
            </div>
        </div>
    </nav>

    <!-- Checkout Content -->
    <section class="py-20">
        <div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-12">
                    <!-- Order Summary -->
                    <div class="checkout-card bg-white rounded-xl shadow-sm p-8">
                <h2 class="text-2xl font-bold text-gray-900 mb-6">Order Summary</h2>
                
                <div class="space-y-4">
                    <div class="flex justify-between items-center">
                        <span class="text-lg font-medium text-gray-900">Pro Plan</span>
                        <span class="text-lg font-bold text-gray-900">$79</span>
                        <span class="text-gray-500">/month</span>
                    </div>
                    
                    <div class="border-t border-gray-200 pt-4">
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">50,000 words per month</span>
                    </div>
                    
                    <div class="border-t border-gray-200 pt-4">
                        <div class="flex justify-between mb-1">
                            <span class="text-sm text-gray-600">Subtotal</span>
                            <span class="text-sm font-medium text-gray-900">$79.00</span>
                    </div>
                    
                    <div class="bg-gray-50 rounded-lg p-4">
                            <p class="text-sm text-gray-600">
                                <i data-feather="lock" class="inline mr-2 w-4 h-4"></i>
                            Secure checkout
                        </div>
                    </div>
                </div>
                
                <!-- Payment Form -->
                <div class="checkout-card bg-white rounded-xl shadow-sm p-8">
                        <h2 class="text-2xl font-bold text-gray-900 mb-6">Payment Details</h2>
                        
                        <form id="checkout-form" class="space-y-6">
                            <div>
                                <label for="email" class="block text-sm font-medium text-gray-700 mb-2">Email Address</label>
                        <input type="email" id="email" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent" placeholder="your@email.com" required>
                            </div>
                            
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-2">Card Information</label>
                            <div id="card-element" class="border border-gray-300 rounded-lg p-3">
                            </div>
                            <div id="card-errors" role="alert" class="text-red-500 text-sm mt-2"></div>
                            </div>
                            
                            <div class="grid grid-cols-2 gap-4">
                                <div>
                                    <label for="first-name" class="block text-sm font-medium text-gray-700 mb-2">First Name</label>
                            <input type="text" id="first-name" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent" placeholder="John" required>
                                </div>
                                <div>
                                    <label for="last-name" class="block text-sm font-medium text-gray-700 mb-2">Last Name</label>
                            <input type="text" id="last-name" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent" placeholder="Doe" required>
                                </div>
                            </div>
                            
                            <button type="submit" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-4 rounded-lg font-bold text-lg transition-colors">
                                    Complete Payment
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Footer -->
            <footer class="bg-gray-900 text-white pt-16 pb-8">
                <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
                    <div class="grid grid-cols-1 md:grid-cols-4 gap-12">
                    <div>
                        <h3 class="text-xl font-bold mb-6">ContentCraft AI</h3>
                    <p class="text-gray-400">
                        Revolutionizing content creation with advanced AI technology that delivers human-quality writing at scale.
                    </p>
                    <div class="flex space-x-4 mt-6">
                        <a href="#" class="text-gray-400 hover:text-white">
                            <i data-feather="twitter" class="w-5 h-5"></i>
                        </a>
                        <a href="#" class="text-gray-400 hover:text-white">
                            <i data-feather="facebook" class="w-5 h-5"></i>
                        </a>
                        <a href="#" class="text-gray-400 hover:text-white">
                            <i data-feather="linkedin" class="w-5 h-5"></i>
                        </a>
                    </div>
                </div>
                
                <div>
                    <h4 class="text-sm font-semibold uppercase tracking-wider mb-6">Services</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Blog Articles</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">SEO Content</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Product Descriptions</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Website Copy</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Newsletters</a></li>
                    </ul>
                </div>
                
                <div>
                    <h4 class="text-sm font-semibold uppercase tracking-wider mb-6">Resources</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Content Guide</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">SEO Tips</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">API Access</a></li>
                    </ul>
                </div>
                
                <div>
                    <h4 class="text-sm font-semibold uppercase tracking-wider mb-6">Company</h4>
                    <ul class="space-y-2">
                        <li><a href="about.html" class="text-gray-400 hover:text-white">About Us</a></li>
                        <li><a href="contact.html" class="text-gray-400 hover:text-white">Contact</a></li>
                        <li><a href="privacy.html" class="text-gray-400 hover:text-white">Privacy Policy</a></li>
                        <li><a href="terms.html" class="text-gray-400 hover:text-white">Terms of Service</a></li>
                    </ul>
                </div>
            </div>
            
            <div class="mt-12 pt-8 border-t border-gray-800 flex flex-col md:flex-row justify-between items-center">
                <p class="text-gray-400 text-sm">
                    © 2025 ContentCraft AI. All rights reserved.
                </p>
                <div class="mt-4 md:mt-0 flex space-x-6">
                <a href="privacy.html" class="text-gray-400 hover:text-white text-sm">Privacy Policy</a>
                <a href="terms.html" class="text-gray-400 hover:text-white text-sm">Terms of Service</a>
                <a href="#" class="text-gray-400 hover:text-white text-sm">Cookie Policy</a>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Stripe
        const stripe = Stripe('pk_test_51QNq8xRw2vV6x8V9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789');
        const elements = stripe.elements();
        
        // Create card element
        const card = elements.create('card', {
            style: {
                base: {
                    fontSize: '16px',
                    color: '#424770',
                    '::placeholder': {
                        color: '#aab7c4',
                    },
                });
                card.mount('#card-element');

        // Handle real-time validation errors from the card Element
        card.addEventListener('change', ({error}) => {
            const displayError = document.getElementById('card-errors');
                if (error) {
                    displayError.textContent = error.message;
                } else {
                    displayError.textContent = '';
                }
            });

        // Handle form submission
        const form = document.getElementById('checkout-form');
        form.addEventListener('submit', async (event) => {
                event.preventDefault();
                
                const submitButton = form.querySelector('button[type="submit"]');
                submitButton.disabled = true;
                submitButton.textContent = 'Processing...';

                const {error, paymentMethod} = await stripe.createPaymentMethod({
                    type: 'card',
                    card: card,
                    billing_details: {
                        name: document.getElementById('first-name').value + ' ' + document.getElementById('last-name').value,
                        email: document.getElementById('email').value,
                    },
                });

                if (error) {
                    document.getElementById('card-errors').textContent = error.message;
                    submitButton.disabled = false;
                    submitButton.textContent = 'Complete Payment';
                } else {
                    // Send payment method to your server
                    const response = await fetch('/api/create-subscription', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json',
                            },
                            body: JSON.stringify({
                                paymentMethodId: paymentMethod.id,
                                email: document.getElementById('email').value,
                            plan: 'pro'
                        });
                        
                        if (response.ok) {
                            const result = await response.json();
                            
                            if (result.success) {
                                window.location.href = '/success.html';
                            } else {
                                throw new Error('Payment processing failed');
                            }
                        } catch (err) {
                            document.getElementById('card-errors').textContent = 'Payment successful! Your subscription is now active.');
                            } else {
                                document.getElementById('card-errors').textContent = 'Payment failed. Please try again.';
                            submitButton.disabled = false;
                            submitButton.textContent = 'Complete Payment';
                        }
                    });
                </script>
                <script>
                    feather.replace();
                </script>
            </body>
            </html>