When using the ARCreditCardRefund request with the SDK, you must provide one or more Credit Memo TxnID values
to link your refund to.
From the QuickBooks SDK documentation (starts on page 317, has several pages devoted to this topic):
You link this refund to the target credit memo using the RefundAppliedToTxnAdd aggregate.
You must link to at least one of these transactions; you can link to as many as you want.
The TxnID is unique among these transactions, so you don’t (in fact you can’t) specify a
transaction type.
The XML looks something like this:
<RefundAppliedToTxnAdd> <!-- required, may repeat -->
<TxnID>IDTYPE</TxnID> <!-- required -->
<RefundAmount>AMTTYPE</RefundAmount> <!-- required -->
</RefundAppliedToTxnAdd>
It's also worth quoting this part of the docs:
The ARAcountRef is also optional. If you omit it, the default Accounts Receivable account is used. Make sure this account matches the ARAccountRef in the credit memo transactions you are linking to.
To expand a bit more on that - if you don't specify the A/R account and the default is not the one your credit memo belongs to, or if you specify an A/R account that's different from the one your credit memo belongs to, you will get an error back indicating that the transaction could not be found. That could very well be what you're running into.