For decades, one of the perks most airline travelers have enjoyed is the ability to earn frequent flyer miles. Once you earned enough points or miles, you can redeem them for an award flight, and potentially other rewards. And for those who travel often for business, earning airline frequent flyer miles can be a great way to fund one or more family vacations each year.

However, not all airline tickets are eligible to earn miles, and it’s not always easy to know in advance which ones are eligible and which aren’t. Here’s when you should expect to earn miles on your flight, and when you won’t.

Learn more: Check out Bankrate’s travel toolkit for tips and tricks on how to maximize travel with a credit card.

When will you earn miles on a flight?

Not every ticket earns frequent flyer miles, but most do. To earn miles for your flight, you must fly on certain types of tickets and take steps to ensure you receive the mileage credits you’re entitled to.

Essential steps to earn miles from your flight

Before you can earn any miles, you need to create a frequent flyer account with the airline you’re flying. Thankfully, nearly all airlines allow you to set this up for free. In fact, you can even create accounts for your minor children.

But to receive mileage credit for your flights, you must then add your frequent flyer number to your reservation. This will be done by default when you log in to the airline’s website or mobile app before you purchase your tickets.

Alternatively, you can decide to use a frequent flyer number with a partner carrier and credit your miles to its program. Many airlines have partnerships with numerous other airlines that allow customers to earn miles in a partner program. Most of these partnerships also allow you to redeem miles for flights operated by their partners.

For example, if you’re flying on British Airways, you can earn miles on its partner American Airlines. You don’t have to create a British Airways account; you can simply use your American Airlines frequent flyer account number and earn miles in their AAdvantage program. Once you earn American Airlines miles, you can redeem them for award flights operated by American or for flights with their numerous airline partners, including British Airways.

Which kinds of tickets earn miles

You can earn reward miles or points from most kinds of tickets. For example, you can earn miles if you purchase tickets yourself or if someone else purchases the ticket for you, including employers and clients. You will also earn reward points or miles if you purchase the ticket with a travel voucher or a gift card. And you’ll earn even more miles when you use an airline credit card to purchase your ticket.

Airline miles used to be awarded based on the distance flown, but many airlines now award miles based on the price of your ticket and your status with the airline’s frequent flyer program.  However, most airlines won’t award miles for other purchases such as baggage fees, change fees and seat selection or seat upgrade fees.

Where you can purchase tickets that earn miles

You earn frequent flyer miles whether you purchase your ticket directly from the airline or through an online travel agency. You can even earn frequent flyer miles when you redeem your credit card rewards points directly for travel reservations booked through the card issuer.

For example, when you redeem your Chase Ultimate Rewards points to book travel through Chase, you’re essentially using miles to pay for a regular ticket purchased through Chase’s online travel agency. The same is true when you redeem your American Express Membership Rewards points for flights booked through AmexTravel.com. And when you redeem Capital One Miles to pay for flights, you’ll also receive mileage credit, so long as you remember to supply your frequent flyer number.

When will you not earn miles on a flight?

While most airline passengers will be eligible to earn frequent flyer miles for their flights, there are some situations where you may not:

You don’t enter your frequent flyer number

If you don’t put your frequent flyer number in your reservation, either because you don’t have one or because you forgot to, then you won’t earn frequent flyer miles. Thankfully, many airlines will allow you to retroactively claim credit for a flight. To do so, you will likely have to fill out a form that includes your flight information and reservation numbers.

You don’t complete the flight

Once you’ve purchased an eligible ticket and supplied your frequent flyer account number, the next thing that you need to do is to actually complete the flight. Simply purchasing a ticket isn’t sufficient to earn miles. To receive the frequent flyer miles that you’re eligible for, you have to check in for your flight, have your boarding pass scanned at the gate and make it to your destination. If you miss your flight, or even if the flight is canceled, then you won’t receive any frequent flyer miles. And if for some reason you’re able to board the aircraft without having your boarding pass scanned, then you won’t receive mileage credit.

You redeem frequent flyer miles to pay for your flight

When you redeem your frequent flyer miles to pay for award flights, you won’t earn miles from those flights. You won’t earn any miles on the taxes and fees you must pay for your award flights either.

However, there are rare occasions when your award flight is canceled and you’re accommodated on another airline’s flight that can allow you to earn frequent flyer miles. If this happens to you, always try to add your frequent flyer number to the new reservation on the off chance that you might receive miles.

You received your ticket as a benefit of the airline or a credit card

You will not earn frequent flyer miles when you travel using a companion pass benefit offered by the airline or its co-branded credit card. The paid traveler will earn miles, but the companion traveling for free will not. For example, those who travel as a benefit of the Southwest Airlines Companion Pass, or with a companion certificate offered by a Delta SkyMiles credit card won’t earn frequent flyer miles.

You travel as an airline employee benefit

If you are an airline employee, or you’re using the benefits offered to an employee’s friends or family, then you won’t earn frequent flyer miles.

You receive ultra-discounted fares and fare classes

There are deeply discounted fare classes, often called basic economy or economy lite, that don’t offer frequent flyer miles. The airline’s website or mobile app should specify when these highly discounted fares aren’t eligible to earn miles. There are also special fares offered to government and military travelers that may not earn miles.

The bottom line

It’s fun to earn frequent flyer miles and save them for an award flight. But before you get too excited, take a moment to figure out which flight tickets qualify for airline miles and which do not. All but the most highly discounted tickets that you purchase from the airline or an online travel agency will typically be eligible to earn miles.

But if you redeem miles for your ticket, or travel for free as a companion or on an employee pass, then you won’t earn any miles. Understanding which tickets are eligible for miles before you make your purchase will help you decide if earning miles should influence your decision.