ECheck payment throws error and doesn't complete order but payment goes through

Created on 4 November 2024, 18 days ago

Problem/Motivation

When testing the paypal checkout, I went through the normal checkout procedure, and tried to make a payment with my bank account. This "echeck" threw me the following error.

Message The PayPal payment is pending. Reason: ECHECK.
Severity Error

This did not complete the order through Commerce. Yet, when I checked my paypal account, the payment went through as a pending echeck, which will go through in a couple of days.

Steps to reproduce

Check out like normal using the paypal checkout option, but instead of using a credit or debit card, pay with a bank account. This will throw the error, and the transaction will not be completed, but the payment will still go through.

🐛 Bug report
Status

Active

Version

1.0

Component

PayPal Checkout

Created by

🇺🇸United States ixlr8

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ixlr8
  • 🇮🇱Israel jsacksick

    There is specific handling whenever the state of the payment in PayPal is pending.

      // Special handling of the "pending" state, if the order is "pending review"
        // we allow the order to go "through" to give a chance to the merchant
        // to accept the payment, in case manual review is needed.
        if ($state === 'pending' && $remote_state === 'pending') {
          $reason = $remote_payment['status_details']['reason'];
          if ($reason === 'PENDING_REVIEW') {
            $state = 'authorization';
          }
          else {
            throw new PaymentGatewayException(sprintf('The PayPal payment is pending. Reason: %s.', $reason));
          }
        }

    This was added as part of #3143995: Pending payments stuck on the review step without any message .

  • 🇮🇱Israel jsacksick

    The attached patch is allowing ECHECK with the state "pending" to go through.
    In order for the payment state to be set to completed in Drupal, Webhooks have to be configured.

    I'm also wondering if there isn't a PayPal setting allowing you to set which state the payment should have in PayPal when this happens.

  • 🇺🇸United States ixlr8

    #3 works insofar as it allows the order to continue in a pending state. It does paint the order into a corner as there's no native way to manually change the payment state to "paid." It sets the payment status as "authorized" in the order. Attempting to "capture" the funds throws an error. This does make a case for either webhooks, as you described, or another way to just let the user set the status to "paid."

Production build 0.71.5 2024