cancel
Showing results for 
Search instead for 
Did you mean: 

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.

 

thekestrelco
Member
1 REPLY 1

Thank you @thekestrelco for the information.

 

Richard

RichardH
Administrator Administrator
Administrator