Skip to content

Commit 566cddd

Browse files
committed
[AIMRefund] Pass credit card expiration date only when an expiration was set
Authorize.Net does not require the expiration date when performing refunds. When no expiration is passed in and a refund request is made, the response comes back with an error saying the card has expired. This check makes it so the expiration date is only sent when a valid expiry date is passed in to the request parameters. > At least the last four digits of the credit card number (x_card_num) used for the original, successfully settled transaction are submitted. An expiration date is not required.
1 parent ccf3229 commit 566cddd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Message/AIMRefundRequest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public function getData()
1717

1818
$data['x_trans_id'] = $this->getTransactionReference();
1919
$data['x_card_num'] = $this->getCard()->getNumber();
20-
$data['x_exp_date'] = $this->getCard()->getExpiryDate('my');
20+
if (!empty($this->getCard()->getExpiryMonth())) {
21+
$data['x_exp_date'] = $this->getCard()->getExpiryDate('my');
22+
}
2123
$data['x_amount'] = $this->getAmount();
2224

2325
return $data;

0 commit comments

Comments
 (0)