I'm not sure what you mean about check the history of the phone. There's a tool Apple provides to check AppleCare coverage and, possibly (in not sure), the repairs the phone possibly had, using the serial number of the phone. Here's the official guide to find the serial number: https://support.apple.com/en-us/HT204308
And here's the online tool for warranty coverage: https://checkcoverage.apple.com