Apply Overpayment by One Customer to Underpayment for Another Customer

Apply Overpayment by One Customer to Underpayment for Another Customer

One of my customers, customerA, included in their payment an amount that they are paying on behalf of another customer, customerB.  Two be specific, both customerA and customerB ordered two items costing $150 and $25, totaling $175 for each customer.  Both customers paid by check; customerA's check is $200 and customerB's check is $150.  CustomerA would like to apply his $25 overpayment to customerB's $25 underpayment.

How do I apply the overpayment on customerA's invoice to the underpayment on customerB's invoice?

For example, is there any way (including via a journal entry) to create a Credit Note for customerB with the overpayment (in the account Unearned Revenue) from customerA'?

Thank you for your help.