Though most people think that they are making their payment at the moment their credit card is swiped at a restaurant, in most cases the card is simply being authorized for the amount of the meal. This means that a temporary hold is being placed on the credit card account for the amount of the meal in order to make sure that there is sufficient credit to cover the expense; the amount hasn't actually been charged to the credit card. The hold lasts until the charge has been finalized, usually up to a few days. The time that the hold remains on the account allows the final amount to be edited before the charge is finalized so that the restaurant can add your tip to the charge without having to charge your card a second time.
Determining Tip Amount
Unless it is explicitly stated on the menu or near the register, most restaurants won't add any sort of tip without their customers' written consent; even in those cases where tips are automatically added, it is usually in special cases (such as a 15 percent gratuity added to parties of a certain size or mandatory tips being added to reserved tables.) The restaurant copy of most credit card receipts has a space for you to add the tip amount.
Finalizing the Payment
Depending on the credit card processing system, the restaurant may be able to enter the amended credit card amount directly into its register system (provided that the register system and the credit card system are combined). Otherwise, they will enter the transaction number from the credit card receipt in order to edit the amount that has been entered directly through the credit card terminal. All credit card transactions are double-checked against receipts at the end of the night before the day's transactions are finalized, allowing the restaurant manager a chance to catch any mistakes and correct any incorrect credit card transactions before it's too late. Once all amounts have been verified against the receipts, the finalized versions of all credit cards processed that day will be sent in to the credit card companies so that the temporary authorizations can be canceled and replaced with the final charges.