Refunds at Authorize.net are showing as income payments on contribution.
We have had a couple of occurrences of this issue show up for a client. A member pays for their membership via the online contribution page. They then want to get a refund for the payment, so they contact the client and the client first goes into Authorize.net's admin interface to process the refund. Since I had assumed that refunds wouldn't get reported back to Civi, I then had the client go into Civi and record a refund on the contribution with the transaction information from Authorize.
It seems though that the refund is sending an IPN notification with a refund.create event, but the issue is that this refund.create event is actually creating a new payment for the refunded amount instead of a refund credit for the amount.
Here is an example json output for the payments on a contribution with this issue. You can see the 12220 would be the initial payment by the member/contact. Then payment 12221 was the refund.create IPN notification from Authorize that should have been a refund but was being recorded as an income payment. Lastly payment 12222 is the actual manual refund the client created in Civi with the information from Authorize refund transaction.
{
"is_error": 0,
"version": 3,
"count": 3,
"values": [
{
"id": "12220",
"to_financial_account_id": "7",
"trxn_date": "2022-01-29 14:00:52",
"total_amount": "350.00",
"fee_amount": "0.00",
"net_amount": "350.00",
"currency": "USD",
"is_payment": "1",
"trxn_id": "xxxxxxxxx",
"status_id": "1",
"payment_processor_id": "1",
"payment_instrument_id": "1",
"contribution_id": "41115"
},
{
"id": "12221",
"from_financial_account_id": "7",
"to_financial_account_id": "7",
"trxn_date": "2022-01-31 10:53:06",
"total_amount": "350.00",
"fee_amount": "0.00",
"net_amount": "350.00",
"currency": "USD",
"is_payment": "1",
"status_id": "1",
"payment_processor_id": "1",
"payment_instrument_id": "1",
"contribution_id": "41115"
},
{
"id": "12222",
"from_financial_account_id": "7",
"to_financial_account_id": "12",
"trxn_date": "2022-01-31 13:51:00",
"total_amount": "-350.00",
"currency": "USD",
"is_payment": "1",
"trxn_id": "xxxxxxxxxx",
"status_id": "7",
"payment_instrument_id": "1",
"pan_truncation": "2007",
"contribution_id": "41115"
}
]
}
Looking at the system logs for IPN notification, that created the 12221 payment, you can see the following being sent from Authorize and saved in the logs:
{
"id": "1177",
"message": "payment_notification processor_id=1",
"context": "{\"notificationId\":\"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx\",\"eventType\":\"net.authorize.payment.refund.created\",\"eventDate\":\"2022-01-31T16:52:45.0332498Z\",\"webhookId\":\"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx\",\"payload\":{\"responseCode\":1,\"avsResponse\":\"P\",\"authAmount\":350,\"invoiceNumber\":\"00000000000000\",\"entityName\":\"transaction\",\"id\":\"00000000000000\"}}",
"level": "alert",
"timestamp": "2022-01-31 10:53:05",
"hostname": "xxx.xxx.xxx.xxx"
}
The payLoad is stating the refund.create event, but it isn't being recorded as a refund but another income payment as seen in 12221.
Not sure if the amount should be a negative amount instead of positive when calling the payment->create api method? (mjwpayment->create_payment)