This is discouraged in the industry.
Because there are so many things that can go wrong between the inspection and closing. So if you ask for payment to be made at closing and don’t buy the home, they’ll have little recourse to collect for services on a home you don’t own.
So if it’s unavoidable and there is no other option then a credit card number is usually given or a check is written to the inspector at the time of inspection with the understanding that if no closing occurs the credit card will be run or the check will be deposited.