It’s the most wonderful time of the year to shop for gifts. But if you’re not careful, you could receive an unwelcome surprise: an overdraft error in your checking account. Here’s how technology plus smart shopping can keep you from spending your way into the red.

Many banks and credit unions can send a text message if your balance drops below a level that you set. If your institution offers the service, take advantage of it.

Text alerts can also help you quickly spot other account problems, such as unauthorized charges or direct deposits gone haywire.

» MORE: What to know about mobile banking

Say you make a debit card purchase that causes your balance to dip below zero. Your financial institution still may approve the transaction, if you’ve given them permission. But the institution would probably charge an overdraft fee, sending your already-negative balance even further below zero. The national median is $34 per overdraft.

To avoid the fee, consider opting out of overdraft coverage. The drawback? A debit card purchase would be declined if funds weren’t available in your account, and that could be embarrassing at the checkout counter. But at least you wouldn’t be charged an overdraft fee for the transaction.

Keep tabs on your balance, however. While you can opt out of overdraft coverage for debit swipes, the bank doesn’t need your permission to cover checks or automatic payments that cause your balance to dip below zero — and that can still trigger an overdraft fee.

You can also avoid overdrafts by selecting a linked account, such as a savings account or line of credit, to serve as a backup. Your bank or credit union would transfer money from the backup account to your checking account if you overspent. Some institutions charge a transfer fee of about $10, but that’s still lower than overdraft fees.

Patrice Williams, the author of “Looking Fly on a Dime,” a budget guide to thrift-shop fashion, isn’t worried about overdraft fees on her checking account, because she plans to use a prepaid debit card for her holiday spending. “I know how dangerous it can be to just swipe my debit card and possibly overspend,” she says.

“Instead, I buy prepaid debit cards. If I know my budget is $500 for the holiday season, then I add $500 to the card. Since it’s prepaid, there’s no way I can overspend,” Williams says.

Because prepaid cards aren’t linked to your checking account, you’ll avoid overdraft fees. But they can come with fees of their own, such as purchase fees and fees to add cash to the card.

You can avoid unplanned purchases by creating a holiday shopping list of what you plan to buy and how much each item costs. If you think you won’t be able to resist a surprise sale, such as a Black Friday deal, add a budget line item for last-minute buys.

» MORE: How to build a budget

You also can try using a mobile financial app, such as Mint or Level Money, while you shop. It can help you keep track of your spending in real time, so you’ll know how much money you have left. If you’re shopping and see something you want to buy but didn’t budget for, slow the urge to splurge by telling yourself you may “get it later, just not now.”

These tips can help make sure your checking account balance stands up to your shopping. An account that stays out of the red is one you can enjoy long after the holidays are over.

Margarette Burnette is a staff writer at NerdWallet, a personal finance website. Email: mburnette@nerdwallet.com. Twitter:@margarette.

This article was written by NerdWallet and was originally published by USA Today.

The article Dodge Checking-Account Disaster Over the Holidays originally appeared on NerdWallet.