I feel your pain. Nobody will answer your question directly. I finally suceeded. First sign out of the Apple ID (id #1 in your case) used for the iTunes & App Store under Settings. Then sign back into the iTunes & App Store (under Settings) with your Apple ID you want to use the gift card & purchase the iClould storage under(id #2 in your case). Then open the App Store app. Tap "Today" at the bottom of the screen, scroll all the way to the bottom. Then tap "Redeem". Scratch off the back of you card, use the camera to scan the code in the box. You now have a credit from the gift card you redeemed.
Go to Settings again, tap you name, then iCloud, Manage Storage, Change Storage Plan, select the plan you want. It will chage the cost against the only payment method is has, the gift card credit.
Now go back in Settings to iTunes & App Store, sign out of (id #2), then back in with orginal id #1 (the id you were using for Family Share).
Now on the home page of Settings you will see the 2 different id's shown, id #2 under iCloud, and id #1 under iTunes & App Store.