Problem with Magsafe charging.
I recently got an iphone 12 and an magsafe charger along with it but there seems to be a problem with the magsafe's charging. I plug it in and it shows charging but when I check it after 15 minutes the battery percentage remains the same but sometimes it just works fine and gives about 7-8% charge in 10-15 minutes. When I charge using the lighting cable there seems to be no such problem.
Is this a problem with the magsafe charger or my device? I've tried updating the software and hard resetting the device.
I've heard magsafe stops charging if it overheats, could that be the case as it is quite hot where I live (47° C or 116° F)
iPhone 12, iOS 14