AuthorizeNet / sample-code-php

This repository contains working code samples which demonstrate php integration with the Authorize.Net API
MIT License
175 stars 197 forks source link

Charge Customer Profile sample seems to consider DECLINED transactions as APPROVED #126

Closed Richtermeister closed 5 years ago

Richtermeister commented 5 years ago

According to this sample code, the transaction is APPROVED, but no check against the response code of the transaction response has been conducted, so the transaction could in fact be Declined or Error status. Am I reading this correctly? Thank you for your help.

https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/charge-customer-profile.php#L46-L47

ashtru commented 5 years ago

Yes, you are right.

The support page states the following correlation between response code and status: 1: Approved 2: Declined 3: Error 4: Action Required (typically used for AFDS transactions that are held for review)

Other higher numbers are also error cases: https://support.authorize.net/s/article/What-Is-the-Decline-Reason-Code-for-a-Transaction

gnongsie commented 5 years ago

I'm closing this issue based on @ashtru's response. Please reopen if any further issues or open a new issue for other questions.

Richtermeister commented 5 years ago

On my end I'm good, since I have adjusted my code. My concern with having this sample code in the open is that it invites faulty implementations. It costs us a lot of money in uncaptured transactions before it was caught. If I PR a proposed fix for the code sample, will you consider it?

gnongsie commented 5 years ago

Hi @Richtermesiter,

We'd be happy to look into any PR. Please feel free to do that.

We appreciate the enthusiasm and are grateful for any suggestions.