Reply
Member
Posts: 4
Registered: ‎04-07-2017

AcceptJS Refund a transaction

Hello,

 

I'm trying to refund a transaction using NodeJS (backend) / AcceptJS.

 

Here is what I'm trying to do.

 

  1. Get opaqueData from AcceptJS (so I don't have to send CC info to my server)
  2. Using opaqueData, doing a authorize and capture on the CC in my NodeJS backend
  3. I save the transactionId and other response information from step 2 into my db
  4. Refund the authorize and capture transaction from step 2 in my NodeJS backend.

I'm running into an error with step 4, the message I get back is 'Credit card number is required.'. However, I don't want to save the credit card information on my server. How do I go about doing a refund of a transaction that was initiated using the opaqueData from AcceptJS?

 

I read that you cannot use the nonce/opaqueData from step 1 for the refund. 

 

Thanks in advance.

Contributor
Posts: 17
Registered: ‎09-18-2015

Re: AcceptJS Refund a transaction

I'm not sure if this will help, but here's what I did.  My backend is C#, but I'm using Accept.js and opaqueData in the front-end so Credit Cards numbers don't touch my server.

 

In my web site (asp.net MVC).  If the transaction is settled, you need to do a refund and specify the refund amount.  If it's not settled, you do a void.  As a side note, it works the same for ACH too: Void and Debit.

 

Here's some of my c# code with my comment.  I think it will help you:

 

            /*
                When issuing a credit card refund, the request must include either a full card number and expiration, 
                or previous transID and last 4 digits of the card number. If you don't have the last 4 digits, 
                you can use getTransactionDetails to get the payment object needed to issue a refund.               
            */
            var creditCard = new creditCardType
            {
                cardNumber = CCLast4Digits,
                expirationDate = "XXXX"
            };

   

 

 

Hope that helps!

Member
Posts: 4
Registered: ‎04-07-2017

Re: AcceptJS Refund a transaction

Thanks for the help. Now I'm getting a E00027 error with

 

CODE: 54

EXPLANATION: The referenced transaction does not meet the criteria for issuing a credit.

 

Any suggestions? Does the transaction need to be 'settled' before you issue a 'refund' on the transaction? If so, how can you cancel a transaction if it has been captured but not settled. 

Posts: 2,765
Topics: 57
Kudos: 248
Blog Posts: 67
Registered: ‎12-05-2011

Re: AcceptJS Refund a transaction

@joshyboyrules

 

You are correct, an unsettled transaction can only be voided which cancels the entire transaction.  After it settles, you can issue a refund.

 

Richard

Member
Posts: 4
Registered: ‎04-07-2017

Re: AcceptJS Refund a transaction

I figured out that you can void a transaction that has been unsettled transaction.

 

How would you know if a transaction has been settled or not? 

Member
Posts: 4
Registered: ‎04-07-2017

Re: AcceptJS Refund a transaction

Thanks for the update. Please see my latest question. Thanks!

Posts: 2,765
Topics: 57
Kudos: 248
Blog Posts: 67
Registered: ‎12-05-2011

Re: AcceptJS Refund a transaction

Hello @joshyboyrules

 

You can use getTransactionDetails using the transaction ID to obtain the settlement state.

 

Richard