'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 createDemoPayment = async () => { setLoading(true) setError('') try { const response = await fetch('/api/demo/create-payment', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ amount: 2500, currency: 'USD', description: 'Demo payment from custom UI', }), }) 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 ? (
{error && (
{error}
)}
) : (
โœ“ Payment Created Successfully!

Payment ID: {paymentId}

Go to Payment Page โ†’
)}

๐Ÿ“š Quick Links

๐Ÿ’ณ Payments
View all payment transactions
๐Ÿงพ Invoices
Manage invoices and billing
๐Ÿ”„ Refunds
Process and track refunds
๐Ÿ‘ฅ Customers
Manage customer information

๐Ÿ’ก About This Demo

This demo application showcases the @xtr-dev/payload-billing plugin for PayloadCMS 3.x with the following features:

  • Test payment provider with customizable scenarios
  • Custom payment UI page with modern design
  • Customer relationship management with auto-sync
  • Invoice generation with line items and tax calculation
  • Refund processing and tracking
  • Sample data seeding for quick testing

The test provider allows you to simulate different payment outcomes including success, failure, cancellation, and more - perfect for development and testing!

) }