Can't refundTransaction for ApplePay transaction

47 Views Asked by At

Trying to integrate ApplePay payments using Authorize.net authCaptureTransaction (https://developer.authorize.net/api/reference/index.html#mobile-in-app-transactions-create-an-apple-pay-transaction). Payment is authorized successfully.

But now trying to integrate refund operation using refundTransaction (https://developer.authorize.net/api/reference/index.html#payment-transactions-refund-a-transaction) which looks doesn't support ApplePay.

Here is require to pass "creditCard": { "cardNumber": "0015", "expirationDate": "XXXX" } but ApplePay has only card token. Even trying to pass I have error: The referenced transaction does not meet the criteria for issuing a credit. also passing token doesn't help "opaqueData": { "dataDescriptor": "COMMON.APPLE.INAPP.PAYMENT", "dataValue": 1234567890ABCDEF1111AAAA2222BBBB3333CCCC4444DDDD5555EEEE6666FFFF7777888899990000" } error is There was an error processing the payment data. Opaque data cannot be used for a linked credit

Can someone help to understand why no API support for ApplePay refund? Also using Merchant Interface here is possibility to refund ApplePay. Also void method works with ApplePay (https://developer.authorize.net/api/reference/index.html#payment-transactions-void-a-transaction)

BTW I am using https://github.com/AuthorizeNet/sdk-php (2.0.2 version)

1

There are 1 best solutions below

0
Maksim Tarleckis On

To refund ApplePay transaction using refundTransaction API need to pass last four digits of tokennumber. This value can be taken from getTransactionDetailsRequest API (https://developer.authorize.net/api/reference/index.html#transaction-reporting-get-transaction-details) Example of getTransactionDetailsRequest:

{"transId":"111111","submitTimeUTC":"2024-02-05T10:36:21Z","submitTimeLocal":"2024-02-05T02:36:21Z","transactionType":"authCaptureTransaction","transactionStatus":"settledSuccessfully","responseCode":1,"responseReasonCode":1,"responseReasonDescription":"Approval","authCode":"####","aVSResponse":"P","cAVVResponse":"2","batch":{"batchId":"######","settlementTimeUTC":"2024-02-06T07:48:17Z","settlementTimeLocal":"2024-02-05T23:48:17Z","settlementState":"settledSuccessfully"},"order":{"invoiceNumber":"#####","description":"Sale","discountAmount":0,"taxIsAfterDiscount":false},"authAmount":1,"settleAmount":1,"taxExempt":false,"payment":{"tokenInformation":{"tokenSource":"Apple Payments","tokenNumber":"XXXX3310","expirationDate":"XXXX"}},"recurringBilling":false,"customerIP":"##.##.#.###","product":"Card Not Present","marketType":"eCommerce"}

refund API example:

{ "createTransactionRequest": { "merchantAuthentication": { "name": "5KP3u95bQpv", "transactionKey": "346HZ32z3fP4hTG2" }, "refId": "111111", "transactionRequest": { "transactionType": "refundTransaction", "amount": "1.00", "payment": { "creditCard": { "cardNumber": "3310", "expirationDate": "XXXX" } }, "refTransId": "1234567890" } } }

Tokennumber is not the credit card number even it is not related to unique ApplePay device number. Looks AuthorizeNet generate his own number. Therefore need to request getTransactionDetailsRequest to get it.