'use client' import Link from 'next/link' import { useState } from 'react' export default function HomePage() { const [paymentId, setPaymentId] = useState('') const [loading, setLoading] = useState(false) const [error, setError] = useState('') const [customerName, setCustomerName] = useState('Demo Customer') const [customerEmail, setCustomerEmail] = useState('demo@example.com') const [customerCompany, setCustomerCompany] = useState('Demo Company') const [message, setMessage] = useState('') const createDemoPayment = async () => { setLoading(true) setError('') // Validate required fields if (!customerName || !customerEmail) { setError('Customer name and email are required') setLoading(false) return } try { const requestBody = { amount: 2500, currency: 'USD', description: 'Demo payment from custom UI', customerName, customerEmail, customerCompany: customerCompany || undefined, message: message || undefined, } console.log('Sending payment request:', requestBody) const response = await fetch('/api/demo/create-payment', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(requestBody), }) const data = await response.json() if (data.success) { setPaymentId(data.payment.id) } else { setError(data.error || 'Failed to create payment') } } catch (err) { setError(err instanceof Error ? err.message : 'An error occurred') } finally { setLoading(false) } } return (

Billing Plugin Demo

Test the @xtr-dev/payload-billing plugin with the test provider

๐ŸŽฎ Interactive Demo

This demo shows how to integrate the billing plugin into your application. Click the button below to create a test payment and see the custom payment UI in action.

Create Test Payment

{!paymentId ? (
setCustomerName(e.target.value)} placeholder="John Doe" className="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required />
setCustomerEmail(e.target.value)} placeholder="john@example.com" className="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required />
setCustomerCompany(e.target.value)} placeholder="Acme Corporation" className="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />