Updated project changes
This commit is contained in:
@@ -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(() => ({}));
|
||||
|
||||
Reference in New Issue
Block a user