diff --git a/.env.example b/.env.example
index 9c6c8f22..a1fc9900 100644
--- a/.env.example
+++ b/.env.example
@@ -12,8 +12,9 @@ NEXT_PUBLIC_API_TERMS_CONDITIONS="https://request.network/api-terms"
FEE_PERCENTAGE_FOR_PAYMENT=""
FEE_ADDRESS_FOR_PAYMENT=""
+REDIS_URL=redis://localhost:7379
# Optional
# NEXT_PUBLIC_GTM_ID=""
# NEXT_PUBLIC_CRYPTO_TO_FIAT_TRUSTED_ORIGINS=""
-
+INVOICE_PROCESSING_TTL=""
diff --git a/src/components/payment-section.tsx b/src/components/payment-section.tsx
index 871873d1..58f80e5c 100644
--- a/src/components/payment-section.tsx
+++ b/src/components/payment-section.tsx
@@ -142,6 +142,9 @@ export function PaymentSection({ serverInvoice }: PaymentSectionProps) {
const { mutateAsync: payRequest } = api.invoice.payRequest.useMutation();
const { mutateAsync: sendPaymentIntent } =
api.invoice.sendPaymentIntent.useMutation();
+ const { mutateAsync: setInvoiceAsProcessing } =
+ api.invoice.setInvoiceAsProcessing.useMutation();
+
const {
data: paymentRoutesData,
refetch,
@@ -375,6 +378,18 @@ export function PaymentSection({ serverInvoice }: PaymentSectionProps) {
} else {
await handleDirectPayments(paymentData, signer);
}
+
+ try {
+ await setInvoiceAsProcessing({
+ id: invoice.id,
+ });
+ } catch (statusError) {
+ console.error("Status update failed:", statusError);
+ toast("Payment Successful", {
+ description:
+ "Payment confirmed but status update failed. Please refresh.",
+ });
+ }
} catch (error) {
console.error("Error : ", error);
toast("Payment Failed", {
@@ -468,7 +483,7 @@ export function PaymentSection({ serverInvoice }: PaymentSectionProps) {
{/* Payment Steps */}
- {paymentStatus !== "paid" && (
+ {paymentStatus === "pending" && (
{/* Step indicators */}
@@ -652,11 +667,7 @@ export function PaymentSection({ serverInvoice }: PaymentSectionProps) {