As to the how, you don't have a lot of options. If you're wanting (insisting) on giving songwriting credit to someone who may or may not be deserving of it, all you have to do is determine how much of your copyright (property) you would like to give away.
50%? 25%? More, or less? Totally up to you.

Just understand you will now be co-owners on a piece of intellectual property, in perpetuity. You can't do anything with the song without your co-writer's approval or blessing. A movie studio wants to put your song in a feature film, but your "cowriter" won't agree to the contract? It's dead in the water.

I applaud the moral position driving your thought process, but the business side of it doesn't make sense. One of my old publishers had a plaque on his desk that said "Emotion + Business = Big Mistakes".

I'll also say this, as someone who feeds his family by writing songs. If I were to make a melodic suggestion on your song, and you offered me co-writing credit, I wouldn't take it. Because I (and this is me personally) don't want my name on anything that I don't feel like I made a significant contribution to.

Follow your own conscience on this, I hope I'm not backseat driving. I just think you should have all the information to consider that you can get.