Updated project changes

This commit is contained in:
2026-06-12 20:49:34 +05:30
parent aa87870350
commit f45955191f
13 changed files with 566 additions and 55 deletions
@@ -25,7 +25,7 @@ const getStripe = () => {
* Create a session for an invoice and redirect to Stripe's hosted page.
* Throws (with a friendly message) if the backend isn't configured/reachable.
*/
export async function startCheckout({ invoiceId, customerEmail } = {}) {
export async function startCheckout({ invoiceId, customerEmail, fallback } = {}) {
if (!stripeConfig.isConfigured) {
const err = new Error(
'Stripe is not configured yet. Add your publishable key to enable payments.'
@@ -37,7 +37,9 @@ export async function startCheckout({ invoiceId, customerEmail } = {}) {
const res = await fetch(`${stripeConfig.apiBase}/create-checkout-session`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ invoiceId, customerEmail }),
// `fallback` carries the invoice's amount/title for demo invoices the
// owner created in localStorage (the server's static map won't have them).
body: JSON.stringify({ invoiceId, customerEmail, fallback }),
});
const data = await res.json().catch(() => ({}));