1 The indirect object indicates the person, animal or thing where the action of the transitive verb is achieved or finished.
The indirect object answers to the questions ¿a quién? or ¿para quién?, ?, and mentions the person, animal or thing that benefits from the action of the verb.
Dale esto a Andrés .
He comprado esta camisa para Daniel .
The indirect object may be represented by pronouns.
Voy a comprarme unas zapatillas. (Me is the indirect object.)
Véndele tu cámara, tú no la usas. (Le is the indirect object.)
The indirect object is used with transitive or intransitive verbs.
Dale esto a Luis. (Dar is transitive.)
Me gusta el café. (Gustar is intransitive.)
The explicit indirect object always is preceded by the preposition a or by the preposition para.
Dale esto a Andrés.
Es un regalo para Justo.
2 The clauses built with the verbs comprar or vender, and an indirect object preceded by the preposition a are not always clear.
Le compré un libro a Lucía, may mean that I bought a book that Lucía sold to me, or also that I bought a book and gave it to Lucía. However, in the option: compré un libro para Lucía, only the second meaning makes sense.
The clause: Manuel le vendió unos libros a Ricardo, may be understood in two ways: Manuel es librero y vendió los libros a su cliente Ricardo, or also Ricardo era el propietario de los libros y Manuel hizo la gestión de venderlos.