Section 57 in The Indian Contract Act, 1872
Title: Reciprocal promise to do things legal, and also other things illegal.
Where persons reciprocally promise, firstly, to do certain things which are legal, and, secondly, under specified circumstances, to do certain other things which are illegal, the first set of promises is a contract, but the second is a void agreement.
A and B agree that A shall sell B a house for 10,000 rupees, but that, if B uses it as a gambling house, he shall pay A 50,000 rupees for it.
The first set of reciprocal promises, namely, to sell the house and to pay 10,000 rupees for it, is a contract.
The second set is for an unlawful object, namely, that B may use the house as a gambling house, and is a void agreement.
Title: Alternative promise, one branch being illegal.
In the case of an alternative promise, one branch of which is legal and the other illegal, the legal branch alone can be enforced.
A and B agree that A shall pay B 1,000 rupees, for which B shall afterwards deliver to A either rice or smuggled opium.
This is a valid contract to deliver rice, and a void agreement as to the opium.
Title: Application of payment where debt to be discharged is indicated.
Where a debtor, owing several distinct debts to one person, makes a payment to him, either with express intimation, or under circumstances implying, that the payment is to be applied to the discharge of some particular debt, the payment, if accepted, must be applied accordingly.
(a) A owes B, among other debts, 1,000 rupees upon a promissory note which falls due on the first June. He owes B no other debt of that amount. On the first June, A pays to B 1,000 rupees. The payment is to be applied to the discharge of the promissory note.
(b) A owes to B, among other debts, the sum of 567 rupees. B writes to A and demands payment of this sum. A sends to B 567 rupees. This payment is to be applied to the discharge of the debt of which B had demanded payment.
Title: Application of payment where debt to be discharged is not indicated.
Where the debtor has omitted to intimate and there are no other circumstances indicating to which debt the payment is to be applied, the creditor may apply it at his discretion to any lawful debt actually due and payable to him from the debtor, whether its recovery is or is not barred by the law in force for the time being as to the limitation of suits.
Title: Application of payment where neither party appropriates.
Where neither party makes any appropriation, the payment shall be applied in discharge of the debts in order of time, whether they are or are not barred by the law in force for the time being as to the limitation of suits. If the debts are of equal standing, the payment shall be applied in discharge of each proportionally.