There are verbs that can take the indirect object (le / les) without a direct one. For example:
- Verbs of emotion and mental process: Le gustas mucho (He/She likes you a lot)
Other verbs in this group are encantar, agradar, parecer, asombrar, molestar, preocupar, interesar, extrañar, importar, enojar
- Verbs related to ownership: quedar, faltar, tocar, sobrar, pertenecer
Le quedan cuatro (He has four left)
- Verbs related to size, duration and convenience: quedar, convenir, durar, caber
Les queda bien (It fits them well) / Le conviene (It suits him)
- Verbs where the direct object is implicit: escribir, pegar, pagar, robar, contestar, ganar
Le escribí (I wrote - a letter, an email - to him/her)
Le pegué (I hit him/her - I gave him a punch / a slap)
Le pagué (I paid him/her - an amount of money)
Le robé (I robbed him/her - of something)
Le contesté (I answered him/her - the question)
Le gané (I beat him/her - at the game/competition)
To dispel any doubt, under DPD we can read (the bolds are mine):
pegar(se). 1. Cuando significa ‘dar [un golpe o una serie de ellos] a alguien’, es transitivo; además del complemento directo, lleva un complemento indirecto de persona: «Se volvió el ex boxeador hacia Charo y le pegó dos bofetadas que la tiraron al suelo» (VqzMontalbán Soledad [Esp. 1977]). A menudo se omite el complemento directo, por quedar implícito o sobrentendido; en ese caso, el complemento de persona, en la lengua culta de la mayor parte del ámbito hispánico, sigue considerándose indirecto: «No es caso insólito que a un santo cualquiera sus devotos le peguen y lo castiguen hasta que acceda al milagro que se le pide» (Ortiz Música [Cuba 1975]). No obstante, en estos casos, es normal que los hablantes de ciertas zonas de España interpreten el complemento de persona como directo: «Nos dijo que su padre la pegaba» (País@[Esp.] 9.7.94); este uso, influido además por el régimen del verbo sinónimo golpear, que rige complemento directo de persona, solo se da en zonas laístas (→ laísmo), por lo que se desaconseja en el habla culta.
Using "la" or "lo" instead of "le" with the verb "pegar" used to be nonstandard Spanish. Notice above that transitive "pegar" takes "le" while transitive "castigar" takes "lo". Being transitive is not a condition for taking only "lo" or "la".
According to the Tweet mentioned in the other reply, the RAE seems to have reconsidered the case and will decree the grammatical acceptability of "lo" and "la" with the verb "pegar" meaning "hit", although in the expanded version of the response published by ABC Cultura it is acknowledged that this is a minority usage (apparently mostly restricted to Madrid, as it arises from several comments by Twitter users) rejected by many speakers all over the Spanish-speaking world.
To confirm the above, below you can find another Tweet by the RAE which clarifies that both constructions are accepted and that the one with "le" is the more traditional and widely used:
