The Merchant of Venice traces the difficulties Antonio, the merchant, has after a "bond" becomes due to Shylock. Antonio loans the money on behalf of Bassanio who has "disabled mine estate" (I.i.123) and squandered his own wealth. As Antonio's best friend, Antonio will do anything to help his friend who wants to win over Portia in the hope of marrying her.
There is an age old feud between Antonio and Shylock; Antonio feeling contempt for "the Jew" and Shylock hating Antonio "for he is a Christian."(I.iii.37) Antonio is confident that his ships will return "a month before the day"(176) and he will settle his bond and Shylock, rather than settle for money, suggests a bond of "a pound of man's flesh"( 160) should Antonio be unable to deliver the funds in time. Bassanio is concerned about "a villain's mind"(173) but the deal goes ahead.
When the debt is due and Antonio cannot pay, Shylock demands his bond, his "pound of flesh.' Portia, disguised as a lawyer, pleads for Shylock to show mercy to Antonio and take money instead of the "pound of flesh." Shylock, who has been maligned and poorly-treated by Antonio and Christians in general, refuses to reconsider because "the villainy you teach me, I will execute" (III.i.60) and he intends to get his revenge.
Ultimately, Portia, as the lawyer, manages to manipulate the situation to ensure that Shylock cannot take his bond if he spills any of Antonio's blood, as that was not agreed to (a loophole in other words.) Shylock is then made to convert to Christianity as he has apparently subverted justice by "seek(ing) the life of any citizen" (IV.i.356) and must be punished in return. His wealth is to be divided and he is left with nothing, not even his dignity!