ParadoxLabs-Inc / authnetcim

Authorize.net CIM payments for Magento 2
Apache License 2.0
12 stars 1 forks source link

[BUG] Payment Action: Authorize and Capture does not work correctly #4

Closed doninnick closed 1 month ago

doninnick commented 2 months ago

:bug: Bug report

Current Behavior

Expected Behavior

Magento ver. 2.4.4-p1 and paradoxlabs/authnetcim 5.0.1 with "Payment Form Type: Accept Hosted iframe" and "Payment Action: Authorize and Capture" always send as Authorize. We contacted authorize technical support and received a response that they were receiving a request with payment action authorize

Minimal reproduction of the problem with instructions

Step 1. Enable "Payment Form Type: Accept Hosted iframe" and "Account Type: Live Merchant Account" Step 2. Enable "Payment Action: Authorize and Capture" Step 3. Enable "Enable Captcha: Yes" Step 4. Enable "Require CCV for all transaction: Yes" Step 5. Enable "New Order Status: Processing" Step 6. Adding any product to cart and go to checkout Step 7. Fill in all fields. Address for testing: 197 Spring Street 3rd Floor South Unit Staten Island, New York, 10304 United States Step 8. Click "Place Order" button.

What is the motivation / use case for changing the behavior?

Environment


Authnetcim version: 5.0.1
Magento version: 2.4.4-p1 
PHP version: 8.1


Others:

rhoerr commented 2 months ago

Hi! Thanks for reporting this.

This is actually working as intended with the hosted form. The user manual notes:

With the hosted payment form, and ‘authorize’ or ‘capture’ payment action, clicking the button within the form immediately runs a payment authorization with Authorize.net. If that transaction succeeds, the success status is passed to your checkout page (via the JS event messaging ‘communicator’), and then the checkout page submits the order to Magento (like clicking ‘Place Order’). This means the payment is processed (creating an authorization) before the order actually exists in Magento.

If your payment action is ‘capture’, the funds are captured after the order exists in Magento, making it a two-step process. This prevents any risk of money being taken without having a corresponding order.

We chose to do it this way because no Magento order exists at the time that the payment form is submitted, and there's no guarantee the Magento order will go through. If we captured funds, you could end up in situations where you've taken money from customers with no record and no recourse other than finding and handling them in Authorize.net. So instead, we authorize, and then as soon as the Magento order is created, we capture the authorization.

If you find that it's not capturing at all, and Magento orders are not being invoiced despite it being set to "capture" payment action, then something is going wrong. If so, we will want to see a transaction log for an order payment.

What brought this to your attention?

doninnick commented 2 months ago

@rhoerr Thanks for the answer. There were complaints from customers that they place an order through a payment method, but in the end there is neither an order nor payment goes through. If the order is not created, then most likely the problem is in your module, which means it loses the quote or creates a new one. In the quote I see reserved ID orders, but the created order itself is not there. Sometimes an order is formed, no confirmation is received in response, about a month later it is confirmed, and this is not good for business, so you have to confirm it manually (when the client calls and complains)

rhoerr commented 2 months ago

@doninnick Okay, thanks for the additional details.

I would suggest examining your site logs around the time of the transactions, to find what error in Magento prevented the order from saving. In my experience this is always caused by some other extension or integration that acts on orders.

Please see our knowledgebase: https://support.paradoxlabs.com/en/support/solutions/articles/4000203045-authorize-net-cim-extra-authorizations-when-using-hosted-forms and https://support.paradoxlabs.com/en/support/solutions/articles/4000171132-error-orders-missing-from-magento-but-payment-transaction-exists

rhoerr commented 1 month ago

Closing the issue as stale and out of scope.

If anyone else is similarly affected, please see my responses and the knowledgebase articles above.