Reply
Highlighted
Member
Posts: 1
Registered: ‎11-29-2018

Adding Invoice Number to Refunds in Node

It was frustrating not finding this in the API docs so I thought I'd share here.

Occasionally, in trying to issue multiple refunds back-to-back for transactions that were very similar (same customer, cc, price), we would get a duplicate transaction error. We needed to adjust the invoiceNumber, but it wasn't explicit how. Well, it's the same as with charging a card. Just work from the API documentation for refunds but add the first two lines below (declaring & configuring the orderDetails) before you instantiate your transactionRequestType and then include the last line below to add these details to your refund.

 

 

    var orderDetails = new ApiContracts.OrderType();
    orderDetails.setInvoiceNumber(INSERT_YOUR_INVOICE);

    var transactionRequestType = new ApiContracts.TransactionRequestType();
    transactionRequestType.setTransactionType(ApiContracts.TransactionTypeEnum.REFUNDTRANSACTION);
    transactionRequestType.setPayment(paymentType);
    transactionRequestType.setAmount(INSERT_YOUR_AMOUNT);
    transactionRequestType.setOrder(orderDetails);

 

You might've guessed that, but I don't like guessing when it comes to payment processing. Happy holidays, y'all.

 

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

Re: Adding Invoice Number to Refunds in Node

Thank you @thekestrelco for the information.

 

Richard