Notes on Article 1238: Third Person Pays

Article 1238. Payment made by a third person who does not intend to be reimbursed by the debtor is deemed to be a donation, which requires the debtor's consent. But the payment is in any case valid as to the creditor who has accepted it.

If the deliver of the thing due by a third person is in the substance of a donation, the debtor's consent is required. Nevertheless, regardless of the fact that there was consent or there was not, the payment made by the stranger is still deemed valid as to the creditor who expressed acceptance of the same.
The Article does not specify any amount so even if the amount paid is below Php 5000, the debtor's consent is required. Moreover, there is no form of consent required so even if the consent was implied or express, it does not affect the validity of the payment.

What is the rationale behind the consent requirement?

The Code Commission underlined that no one should be compelled to accept the generosity of another.

XYZ are friends. X paid Y the amount of Z's debt without any intention to be reimbursed. However, Z did not consent to the same. What happens next?

Z's obligation to pay Y is already extinguished since Y accepted the payment. X may still recover from Z since there was no donation; however, he may only recover up to the extend beneficial to Z.