Skip to content

Payment Validation - Unhappy path - Notify user when processing completed/failed #2068

@Bambaclad1

Description

@Bambaclad1

Whenever a payment.intent is processing, the user should be notified whenever the payment intent has succeed.
That means to approach this issue, some sort of checking should be done whenever a booking's status is on awaiting payment. Based on if its failed or succeed, it should be updated and once succeed/failed, should be notified as well towards the user.

      switch (paymentIntent.status) {
        case "succeeded":
          setMessage(`Success! Payment received.`);
          ActivateBookingFunction(paymentIntent.id);
          navigate(`/bookingconfirmationoverview?&id=${bookingId}&paymentId=${paymentIntent.id}`)
          break;

        case "processing":
          setMessage(`Payment processing. We'll update you when payment is received.`);
          navigate(`/bookingconfirmationoverview?&id=${bookingId}&paymentId=${paymentIntent.id}`)
          break;

        case "requires_payment_method":
          DeactivateBooking(paymentIntent.id);
          setMessage(`Payment failed. Please try another payment method. No charges have been made.`);
          break;

        default:
          setMessage(`Something went wrong. Please contact support with error ${paymentIntent.status}.`);
          break;
      ]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions