sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

Refund Unsettled Transactions

Open suneel11 opened this issue 6 years ago • 15 comments

Hello, can anyone help me with the issue for how can I refund the unsettled transactions which are not currently refundable. Or the void can help me to refund back the amount charged for particular transaction. Please help me with that as I am making the payment from the card and I want to refund the amount even when the transaction is unsettled.

Thanks.

suneel11 avatar Dec 06 '18 07:12 suneel11

Hi @suneel11 ,

Thanks for reaching out to us.

After you've made a transaction, the transaction can be in Unsettled or Settled state.

For canceling an Unsettled transaction, you can void it. This can be done in one of three ways:

  • Sending a Void Transaction API request.
  • Going to the Merchant Interface, searching for your unsettled transaction and voiding the transaction there.
  • Going to the Merchant Interface and creating a Void Transaction from the Virtual Terminal.

For canceling a Settled transaction, you can refund it. This can be done in one of three ways:

  • Sending a Refund Transaction API request.
  • Going to the Merchant Interface, searching for your unsettled transaction and refunding the transaction there.
  • Going to the Merchant Interface and creating a Refund Transaction from the Virtual Terminal.

Kindly let us know if you need further information.

gnongsie avatar Dec 07 '18 06:12 gnongsie

I am getting an issue with the settled transactions for the refund while sending the transaction id in refTransID, please check and help me with the issue:

[0] => net\authorize\api\contract\v1\TransactionResponseType\ErrorsAType\ErrorAType Object (

   [errorCode:net\authorize\api\contract\v1\TransactionResponseType\ErrorsAType\ErrorAType:private] => 54                      
   [errorText:net\authorize\api\contract\v1\TransactionResponseType\ErrorsAType\ErrorAType:private] => The referenced transaction does not meet the criteria for issuing a credit.

)

Thanks.

suneel11 avatar Dec 07 '18 08:12 suneel11

Hi @suneel11 ,

Well, error code 54 can have different reasons (Error Response 54). Are you sure the transaction ID you placed in the refTransId is the same transaction ID you got from our servers?

Or maybe the transaction has not been settled yet? I would need to understand the timeline for your requests to check if the transaction has settled or not.

gnongsie avatar Dec 09 '18 11:12 gnongsie

The status for the transaction is settled payment and its money has been settled. And the transaction is generated from your servers only i.e: 11 digit number. Everything is good just the refund api is creating the problem while refunding settled transaction.

suneel11 avatar Dec 10 '18 03:12 suneel11

Is it possible to share the request sent for RefundTransaction API ? You can hide all sensitive information, like credit card information, dates, keys, etc.

gnongsie avatar Dec 10 '18 16:12 gnongsie

Here it is, I am working with the laravel framework

$merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName(env("ANET_LOGIN_KEY")); $merchantAuthentication->setTransactionKey(env("ANET_TRANSACTION_KEY"));

$refId = 'ref' . time();

$creditCard = new AnetAPI\CreditCardType(); $creditCard->setCardNumber($cardNo); $creditCard->setExpirationDate($expDate); $payOne = new AnetAPI\PaymentType(); $payOne->setCreditCard($creditCard);

$tranRequest = new AnetAPI\TransactionRequestType(); $tranRequest->setTransactionType( "refundTransaction"); $tranRequest->setAmount('5.00'); $tranRequest->setPayment($payOne); $tranRequest->setRefTransId($t_tranId);

$req = new AnetAPI\CreateTransactionRequest(); $req->setMerchantAuthentication($merchantAuthentication); $req->setRefId($refId); $req->setTransactionRequest( $tranRequest); $contr = new AnetController\CreateTransactionController($req); $respo = $contr->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION);

Thanks

suneel11 avatar Dec 11 '18 03:12 suneel11

This seems correct. Perhaps there's something wrong with the original transaction. Is it possible to share the transaction details of the original transaction? If you want a secure way of sending, please feel free to send it to my personal email: [email protected].

gnongsie avatar Dec 11 '18 06:12 gnongsie

Hi @suneel11

Can you help me with a few questions:

  1. How are you getting the value of $cardNo and $expDate
  • For card number, is it the last 4 digits, or the entire card number?
  • What is the format for the expiration date YYMM or YYYY-MM?

ashtru avatar Dec 11 '18 19:12 ashtru

Hello @ashtru

I am using the values in this format: $cardNo = '4242424242424242' $expDate = YYYY-MM format (2022-11)

Even if I am using the 4 digits card number and date with YYMM format then also it is providing me the same issue.

Thanks.

suneel11 avatar Dec 12 '18 03:12 suneel11

Hi @suneel11 ,

From the information you shared, I see that you are using v1.9.6 of the SDK.

The latest stable version is v1.9.9. Is it possible for you to test this out with the latest version?

gnongsie avatar Dec 12 '18 07:12 gnongsie

Does the old version do not support the refund api and if so then how it can be done in the older version.

suneel11 avatar Dec 13 '18 12:12 suneel11

hello there is there any help for me regarding that.

suneel11 avatar Dec 26 '18 04:12 suneel11

Hi @suneel11

If a transaction is in unsettled state you need to do a Void Transaction API request. And if the transaction is in settled state you need to do a Refund Transaction API request.

As per your original issue you were trying to do a refund of a unsettled transaction, hence you were getting Transaction Response Code 54 (the transaction does not meet the criteria). Now the next day the transaction state changed to settled as per your comment, so you will not be able to void it anymore, but you can now call the Refund API till 120 days from the date of settlement.

Hope this resolves your issue.

Kaushik

kikmak42 avatar Jan 03 '19 11:01 kikmak42

hello But why i am not able to refund the settled transaction whose payment has been done

suneel11 avatar Jan 03 '19 11:01 suneel11

hello @kikmak42

I am still waiting for your reply that why I am not able to refund the transaction whose payment has beed confirmed or has been settled.

suneel11 avatar Jan 10 '19 03:01 suneel11