import Link from 'next/link'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
import {
CheckCircle,
XCircle,
AlertCircle,
ExternalLink,
Package,
ShoppingCart,
CreditCard,
Settings,
Zap
} from 'lucide-react'
export default async function StripeSetupPage() {
// Test Stripe connectivity
const testResponse = await fetch('http://localhost:3000/api/stripe/test', {
method: 'POST',
cache: 'no-store'
})
const testResult = testResponse.ok ? await testResponse.json() : null
const stripeWorking = testResult?.success
return (
{/* Header */}
Stripe Integration Setup
Everything is ready for your Stripe products. Complete the setup below to activate your e-commerce functionality.
{/* Status Overview */}
{stripeWorking ? (
<>
Stripe Integration Active
Your Stripe account is connected and ready for products.
>
) : (
<>
Setup Required
Complete the steps below to activate Stripe integration.
>
)}
{/* Quick Actions */}
Add Products
Create your first product in Stripe Dashboard
Test Store
Browse your products and test checkout
Admin Panel
Manage orders and view analytics
{/* Setup Checklist */}
Setup Checklist
Complete these steps to activate your e-commerce store
{/* Step 1: Products */}
1
Add Products to Stripe
Create your vending machine products with prices in Stripe Dashboard
{testResult?.products?.total ? (
{testResult.products.total} products
) : (
No products yet
)}
{/* Step 2: Payment Methods */}
2
Enable Payment Methods
Ensure customers can pay with credit cards, Apple Pay, Google Pay, etc.
{stripeWorking && testResult?.paymentMethods ? (
{testResult.paymentMethods.total} methods
) : (
Check Stripe Dashboard
)}
{stripeWorking ? (
Ready
) : (
Configure
)}
{/* Step 3: Webhook */}
3
Webhook Configuration
Webhooks are already configured to handle order completion and payments
{process.env.STRIPE_WEBHOOK_SECRET ? (
Configured
) : (
Missing
)}
{/* Step 4: Test */}
4
Test Your Store
Add products to cart and test the checkout process
{stripeWorking ? (
Ready to Test
) : (
Complete Setup First
)}
{/* Account Status */}
{stripeWorking && testResult?.account && (
Stripe Account Status
Account ID
{testResult.account.id}
Business Name
{testResult.account.name || 'Not set'}
Country
{testResult.account.country}
Charges Enabled
{testResult.account.charges_enabled ? (
Yes
) : (
No
)}
Payouts Enabled
{testResult.account.payouts_enabled ? (
Yes
) : (
No
)}
API Version
{testResult.apiVersion}
)}
{/* Getting Started */}
Quick Start Guide
Get your store running in 4 easy steps
For New Products:
- Go to Stripe Dashboard → Products
- Click "Add product"
- Fill in product details and set price
- Save and publish the product
- Visit your store to see it!
For Existing Products:
- Go to Stripe Dashboard → Products
- Find your existing products
- Ensure they have active prices
- Check that they're marked as "Active"
- They'll appear in your store automatically!
Need help? Check the Stripe documentation or contact support.
)
}
export const metadata = {
title: 'Stripe Setup | Rocky Mountain Vending',
description: 'Complete your Stripe integration setup and add products to your store',
}