On my first solo trip to Shanghai, I got to the metro station and realized something: everyone in front of me just waved their phone at the gate and walked through. I opened Alipay and all I could find was the payment code, no ride QR code anywhere. There was a line building up behind me, and yes, I panicked a little. Riding the metro with Alipay really isn’t hard. The tricky part usually isn’t the scanning itself, it’s picking the right city, activating that city’s metro ride code, and making sure your payment method actually works for it.
This guide walks through the situations international travelers run into most: Can you set it up before you leave home? What do you tap once you’re in Shanghai or Beijing? If you scanned in, do you need to scan out too? What if your foreign card is linked but the ride code still won’t activate? Everything here is based on official information from Alipay and the Beijing and Shanghai governments, but the app interface changes by version and by city. The flow diagrams are step-by-step illustrations made by JEKO, not real Alipay screenshots. Images labeled “official screenshot” come from public tutorials published by the Beijing and Shanghai municipal governments.
Alipay’s Payment Code vs. Metro Ride Code: What’s the Difference?
When you pay at a convenience store, you open “Pay/Receive” and let the cashier scan your payment code. For the metro, though, you need the metro ride code under “Transport“. Both look like QR codes, but they do completely different jobs. The metro ride code is tied to that city’s transit service: the gates read it when you enter and when you exit so the system can match it to one trip, then charge you according to local fare rules. Holding a store payment code up to the gate usually won’t work.
Also, don’t assume that “Alipay works with my foreign card in shops” means “one ride code works on every metro in China.” Each city runs its own partner system, so the name of the code, identity checks, payment options and what’s supported can all differ. Beijing has an official illustrated guide to getting the metro code in Alipay; Shanghai lists the Shanghai Metro service inside Alipay plus backups like the Metro Daduhui app, Suishenxing, contactless credit cards and single-journey tickets.
| What you want to do | Where to look in Alipay | How to use it at the station |
|---|---|---|
| Pay in a shop | Pay/Receive (payment code) | Let the merchant scan your payment code, or scan the shop’s code yourself |
| Enter and exit the metro | Transport → Metro → local ride code | Scan the ride code from the same account at both entry and exit, following the gate signs |
| Take the bus | Transport → Bus | Use the bus code supported in that city; it’s not necessarily the same as the metro code |
| Ride code won’t activate | Metro ticket machine / service counter / other local tickets | Buy a single-journey ticket or use an officially accepted contactless bank card |
Do These Three Things Before You Go (Not at the Gate)
One: make sure you can log in to Alipay. Download Alipay from the official app store and complete your phone number, account and any required identity verification. A foreign phone number can be used to register and receive verification codes in many cases, but whether you can activate a specific transit service depends on what the app allows at that moment. If you haven’t linked a card yet, check our guide to Alipay, WeChat Pay and linking a foreign credit card first. I won’t repeat every card-linking screen here.
Two: check your payment source. Foreign Visa and Mastercard cards can often be linked to Alipay, but “card linked successfully” doesn’t guarantee that a city’s transit code will accept that card. If the activation screen asks for extra verification, pre-authorization or a specific payment channel, just follow it. If it still doesn’t work, switch to an eligible payment method or plan to buy a single-journey ticket. Don’t keep unlinking cards or creating new accounts just because you’re rushing for a train.
Three: have a phone that’s online. Getting the code, refreshing it and checking your ride history usually need data. Before you fly, sort out a travel eSIM, your hotel’s address in Chinese and your Alipay login details. JEKO’s China travel eSIM plans give you data on arrival for checking routes and opening apps. They’re data-only plans, so they won’t replace your home SIM for receiving bank text messages. When you need an OTP, your regular home number still has to be able to receive it.
Step by Step: How to Activate Your Alipay Metro Ride Code
The most reliable reference is Beijing’s official Alipay tutorial: open “Transport” → choose “Metro” → claim the local transit card and agree to the terms → enter your payment password if asked → the metro QR code appears. Your phone might say “Get now”, “Claim card” or “Agree and claim”, but the order is roughly the same.
- Open Alipay and find “Transport”. If it’s not among the home-screen shortcuts, search “Transport” or “metro ride code”. Don’t tap the regular “Pay/Receive” by mistake.
- Check the city first. If you’re already in Beijing, don’t stay on Shanghai from your last trip. If location detection is off, switch manually.
- Choose “Metro”. Some cities split “Bus” and “Metro” into separate tabs. Don’t use a bus code at a metro gate.
- Claim the local ride code. The first time, you may need to read an agreement, complete identity or payment authorization and enter your payment password. Only after that does a scannable ride screen show up.
- Bring up the ride code at the gate. Make sure the screen shows the right city and the metro service, then hold it over the scanner. Once you’re through, put your phone away.
Alipay has also posted a bilingual (Chinese/English) example of “Transport → get your bus/metro code → scan at the gate”. You can see it in Alipay’s official tutorial post. Being publicly viewable doesn’t mean it can be downloaded and reused in a commercial article, so I’m only linking to the original here.
Real App Screens: Activating Transport in Alipay in Shanghai
These are official screenshots from that year, so your phone in 2026 may not look exactly the same. For Shanghai’s latest “Shanghai public transport ride code” info, check the Shanghai Municipal Transportation Commission’s official Q&A. Beijing and Shanghai ride codes have to be activated separately, so don’t assume the Beijing screens apply to Shanghai.
Beijing’s Official Five-Step Screenshots
You Scanned In. Do You Need to Scan Out Too?
With metro QR code services that charge by distance, you usually scan both when you enter and when you exit, so the system knows where you started and where you got off. At the gate, find the scanner area marked on the machine, open the same metro ride code and wait for the gate to open before walking through. Don’t scan one code twice for two people, and don’t share a screenshot of a payment code as a ticket. Ride codes may refresh dynamically, and it’s one person, one code, according to the local system.
Entering with account A and exiting with account B can easily leave you with an incomplete trip. The safest approach is to use the same Alipay account and the same city’s ride service for the whole journey. If the gate shows “no entry record”, “trip error” or can’t read your code, don’t force your way through. Ask station staff for help.
Beijing, Shanghai, Hangzhou: Same Metro, Different Setup
Beijing: The official visitor guide has full Alipay metro code steps. Choose Metro under “Transport” first, then claim the card. If your payment setup gets stuck as an international traveler, Beijing also has Beijing Pass, ticket machines, staffed counters and eligible contactless bank cards. Different ticket types and lines have their own rules, so go by the signs at the station.
Shanghai: The city government’s transport guide says you can activate the Shanghai Metro service through Alipay or WeChat, or use the Metro Daduhui app. If you’d rather not use an app, Shanghai Metro also accepts eligible contactless bank cards and sells single-journey tickets in stations. Special lines such as the airport link may have different fares, so don’t assume every line is charged the same way.
Hangzhou and other cities: Alipay’s public materials have listed a Hangzhou Metro ride code, plus differently named transit cards for Nanjing, Suzhou, Xi’an and others. The point is “choose the right local code in each city”. That doesn’t mean every city supports the same foreign credit card. What you can actually claim depends on what shows up on the “Transport” page for that city.
| City | What to look for first | Backup if it won’t activate |
|---|---|---|
| Beijing | Alipay → Transport → Metro → Beijing local ride code | Beijing Pass, ticket machine / service counter, eligible contactless bank card |
| Shanghai | Shanghai Metro service in Alipay, or Metro Daduhui | Suishenxing, eligible contactless bank card, single-journey ticket |
| Hangzhou | Alipay → Transport → Metro → Hangzhou Metro ride code (check the current interface) | Local official app or a single-journey ticket at the station |
Ride Code Not Working? First Figure Out Which Situation You’re In
Sometimes it’s not a balance problem or slow internet. You’ve just picked the wrong code, or your last trip never closed. Instead of scanning ten times in a row, it’s faster to step aside and read the message properly.
Can’t find “Transport”: Search “Transport” or “metro ride code” on the home screen, or make sure you’ve switched to the Chinese city you’re in. Depending on your language setting it may show as Transport, Travel or Metro.
Claiming the card fails: Check your identity verification, payment authorization and card-linking status. Some cities or card types restrict foreign cards, and being able to pay at a convenience store doesn’t mean you can get a transit code. Switch to an official station ticket instead of resubmitting over and over during rush hour.
The ride code opens, but the gate won’t let you through: Check whether you picked a bus code, the wrong city or a regular payment code. Then turn up your screen brightness and line it up with the marked scanner. If it says there’s a trip error, go to the service counter.
Entry worked, but exit fails: First make sure it’s still the same account and the same metro code. If your phone died, the app won’t open or it says “incomplete trip”, ask station staff. They may need to check your entry time or have you pay the fare difference.
Delayed charge or two records showing: Metro fare calculation and payment notifications don’t always appear at the same time. Check your ride history, payment details and processing status in Alipay before deciding you’ve been charged twice based on two notifications. If something really is wrong, contact in-app support or the station’s official channels with the time, station names and order details. Never post your full payment QR code publicly online.
No Data or No Chinese Phone Number: Can You Still Take the Metro?
Whether you can open or refresh the ride code depends on the city’s service and the app’s status at the time. Don’t assume a screenshot will work offline. Ride codes may refresh regularly, and a screenshot can be rejected as invalid. If reception is bad in an underground station, open the app first in the concourse where there’s signal, or try the station’s official Wi-Fi, but be careful with hotspots from unknown sources.
For international travelers, the easiest setup is usually this: keep your home SIM for your phone number and bank texts, and let a travel eSIM handle data in China. Before you go through the gates, just make sure “Mobile Data” is set to the line that’s actually connected. Routing, roaming and support for China travel eSIMs vary by product, so check the specs when you buy. Don’t believe claims that every eSIM is VPN-free or guarantees a particular payment feature just for riding the metro.
You honestly don’t need to master every Chinese payment tool just to ride the metro. Before you leave, make sure you can log in to Alipay and your payment method is set. Once you land, pick the right city and metro code under “Transport” and scan at entry and exit as the gates show. If it won’t activate, buy a single-journey ticket from a machine or the service counter and keep going. If you want maps, Alipay and staying in touch sorted in one go, take a look at JEKO’s China eSIM plans, together with our China trip pre-departure checklist.
Official sources checked: Beijing government: How to Buy Tickets / Alipay metro ride code | Shanghai government: How to take metro (2026) | Shanghai government: Easy metro access (2025) | Alipay official bus/metro ride code guide
FAQ
Do I need a Chinese phone number to activate the Alipay metro ride code?
Not necessarily. Alipay supports eligible foreign phone numbers and bank cards, but each city’s ride code may have its own identity, payment or verification requirements. Go by what the actual claim page shows. If it doesn’t work, you can still buy a single-journey ticket or use another transit option officially supported in that city.
I’ve already linked my foreign credit card to Alipay. Why can’t I get a ride code?
Regular shopping payments and transit ride codes are separate services. A linked card is only one of the requirements; the local transit code may also need payment authorization, identity confirmation or a specific card type. Read the error message first and don’t keep deleting and re-adding your card.
Can I use the same ride code in Shanghai and Beijing?
Don’t count on it. When you move to a different city, switch the city first and make sure the local metro ride code is claimed and working before you enter. Your Alipay account can be the same, but the transit services aren’t necessarily shared.
After scanning in at the metro, do I need to scan out too?
QR code ride services that charge by distance usually require scanning at both entry and exit. Use the same account and the matching ride code so you don’t end up with an incomplete trip.
Can I send a screenshot of my ride QR code to a friend so they can ride?
Not recommended. Ride codes may refresh dynamically, and they’re tied to your personal trips and payment security. When traveling as a group, everyone should use their own valid ticket rather than sharing screenshots.
The ride code keeps loading and my phone has no data. What should I do?
Check that mobile data is working, and try moving back to the concourse where the signal is better. If you still can’t open the code, it’s more practical to just buy a single-journey ticket from a machine or the service counter. Don’t hold up the gate trying for too long.
Can I just tap a Visa or Mastercard instead of using Alipay?
In some cities, yes. Both Beijing and Shanghai have officially announced ways to ride with eligible contactless bank cards, but supported card types, activation conditions, lines and whether your issuing bank allows it all depend on local rules. Use gates marked as accepting contactless bank cards.
The charge didn’t show up right away. Does that mean the payment failed?
Not necessarily. Check your ride history and transaction status to see whether the trip is complete, then decide whether you need to contact support. Don’t pay again just because you didn’t get an instant notification.
Fact-checked: November 8, 2026. Ride code names, supported payments, fares and interfaces may change by city. Always follow the latest announcements from Alipay and local transit authorities. Flow diagrams were made by JEKO; official screenshots come from public tutorials by the Beijing and Shanghai municipal governments. Embedded YouTube videos include Alipay’s official channel and a third-party hands-on tutorial.
















