1. If the actual amount of incoming raw materials is greater than the advance payment, you need to make the following two entries.
Borrow: raw materials
Credit: advance payment
Debit: advance payment
Loan: bank deposit (to make up for the unpaid account)
2. If the actual quantity of raw materials in stock is less than the advance payment, the following two entries need to be made.
Borrow: raw materials
Credit: advance payment
Debit: bank deposit (to recover overpaid advance payment)
Credit: advance payment