There are two things that might be involved when you talk about "credits." Authorship, and Ownership. Authorship is easy. Everyone who participates is entitled to be listed as an "author," no matter how big or small the contribution is.
Someone can elect to "opt out" of authorship, and people do so for a variety of reasons. But someone who does not contribute to actually writing cannot "opt into" or be "invited into" authorship. It is an ethical and legal problem for someone to claim contributions he/she did not make.
Authorship is related to, but distinct from Ownership and it (ownership) is almost entirely dependent upon what AGREEMENT was in place when the song was written. Deciding who is most responsible for the song BEFORE IT IS WRITTEN is vital if you want to avoid arguments.
In the absence of an agreement, all authors are (equal) co-owners under the law. That isn't strictly and rigidly true, but it is the starting point for ascertaining ownership. Point being, it makes no sense to NOT have an agreement in place about whose contribution is primary, secondary, and/or minor. And, it makes no sense to NOT have an agreement in place about who (based upon contributions) will own what percent of the completed song.
When I collaborate, I have a standard formula I use that is agreed to, and in place before the collaboration begins.
11% of a song belongs to the "initiator" of the song. In the case you cite, the person who wrote the music that your lyric is based upon is the "initiator."
27% of the song belongs to the person who writes the vocal melody. (the "tune" that the words are sung to.)
28% of the song belongs to the person who writes the instrumental music.
28% of the song belongs to the person who writes the lyrics.
6% of the song belongs to the person who will be responsible for marketing the song.
This formula works with ONE co-writer. Multiple co-writers need to tweak this.
Note that I avoid "round numbers." That is so one person controls at least 51% of the ownership of the song. This guarantees that one person can market the song without interference from the other(s). An agreement by all concerned to NOT interfere with marketing alleviates that need.
This is my understanding of the law in the U.S. It might be wrong. It might be different elsewhere. Hope this helped.