地址验证概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
为什么要在 Maps JavaScript API 中使用地址验证?
Address Validation 库会将地址作为输入,以识别和验证地址组成部分。它还会对地址进行标准化处理以方便邮寄,并找到地址的最优纬度/经度坐标。(可选)对于美国和波多黎各的地址,您可以启用
编码准确性支持系统 (CASS™)。
借助地址验证 API,您可以提高送货可预测性并减少送货失败情况,从而改善客户体验。
为此,您需要找出无效地址并更好地了解地址特征。
您可以使用 Maps JavaScript API 中的地址验证功能执行哪些操作
借助 Maps JavaScript API 中的地址验证功能,您可以确定地址是否指向真实地点。如果地址不指向真实地点,该 API 可以识别可能有误的组成部分,以便您将其呈现给客户进行更正。以下是一个示例工作流程:
-
客户输入地址 - 以下图片显示了一个基本表单,客户可以在此表单中输入地址(可能作为结账流程的一部分)。
-
应用将地址发送到 API - 应用使用 fetchAddressValidation
方法传递此地址。
-
API 验证并标准化地址 - 在响应中,Address Validation API 会返回 API 确定的完整地址,或指明缺少信息的位置。
-
客户确认或更正地址 - 根据 API 返回的内容,您可以向客户提供以下提示:
- 确认建议的地址。
- 提供缺失的信息。
- 修正地址。
Maps JavaScript API 中的地址验证功能的运作方式
调用 fetchAddressValidation
时,该 API 会尝试执行以下操作:
- 更正 - 提供组件级验证检查,包括子地点(如果有)。
- 完成 - 尝试推断缺失或不正确的地址组成部分。
- 格式 - 清理并标准化地址组成部分的格式。
CASS™ 简介
美国邮政服务® (USPS®)1
维护
编码准确性支持系统 (CASS™),以支持和认证地址验证服务提供商。CASS 认证™服务(例如地址验证 API)已经验证,能够填充地址缺失的信息、对其进行标准化和更新,以便为您提供最新、最准确的地址。
CASS 默认处于停用状态,并且仅适用于“美国”和“波多黎各”地区。如需启用 CASS,请在验证请求中将 `enableUspsCass` 设置为 `true`。如需了解详情,请参阅验证地址。
在我们使用 USPS 服务的过程中,USPS 会评估人工创建的地址的相关请求。如果 USPS 认定输入地址是人为创建的,Google 必须停止为客户验证地址,并必须向 USPS 报告客户的联系信息(姓名和地址)、相关输入地址和汇总使用情况数据。使用此 API 即表示您同意这些
服务条款。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n| This product or feature is in Preview (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage\n| descriptions](/maps/launch-stages).\n\nWhy use Address Validation in Maps JavaScript API? \n\nThe Address Validation library takes an address as input to identify and validate address\ncomponents. It also standardizes the address for mailing and finds the best known\nlatitude/longitude coordinates for it. Optionally, for addresses in the United States and\nPuerto Rico, you can enable the\n[Coding Accuracy Support System (CASS™)](https://developers.google.com/maps/documentation/address-validation/overview#about-cass).\n\nWith Address Validation API, you can improve delivery\npredictability and reduce delivery failures, thereby providing improved customer experience.\nYou do this by catching bad addresses and obtaining better awareness of address\ncharacteristics.\n| The Geocoding API might be a better match for your needs if you don't need to validate the individual address components. The Geocoding API **converts** addresses into latitude and longitude coordinates. The Address Validation API validates addresses for **correctness** . See [Building location validation capability using Google Maps Platform](https://developers.google.com/maps/architecture/geocoding-address-validation) in the Architecture Center for a detailed comparison.\n\nWhat you can do with Address Validation in Maps JavaScript API\n\nWith Address Validation in Maps JavaScript API, you can determine if an address refers to a\nreal place. If the address does not refer to a real place, the API can identify possibly wrong\ncomponents that you can present to your customers to correct. Here is a sample workflow:\n\n1.\n **Customer enters an address** --- The following image shows a basic form\n that allows a customer to enter an address, possibly as part of a checkout flow.\n\n2.\n **App sends the address to the API** --- The application passes this\n address using the `fetchAddressValidation` method.\n\n3.\n **API validates and standardizes the address** --- In its response, the\n Address Validation API returns the complete address as determined by the API, or\n indicates where information is missing.\n\n4.\n **Customer confirms or corrects the address** --- Depending on what the\n API returns, you can provide the following prompts to the customer:\n\n 1. Confirm the recommended address.\n 2. Provide missing information.\n 3. Fix the address.\n\nHow Address Validation in Maps JavaScript API works\n\nWhen a call to `fetchAddressValidation` is made the API attempts the following:\n\n- **Corrects** --- Provides component-level vaidation checks, including sub-premises where available.\n- **Completes** --- Attempts to infer missing or incorrect address components.\n- **Formats** --- Cleans up and standardizes the format for address components.\n\nAbout CASS™\n\nThe United States Postal Service® (USPS®)^[1](#fn1)^\nmaintains the [Coding Accuracy Support System (CASS™)](https://postalpro.usps.com/certifications/cass)\nto support and certify address validation providers. A CASS Certified™ service,\nsuch as the Address Validation API, has been confirmed for its\nability to fill in information missing from an address, standardize it, and\nupdate it to give you the most current and most accurate address.\n\nCASS is not enabled by default and is only supported for the \"US\" and \"PR\"\nregions. To enable CASS, set \\`enableUspsCass\\` to \\`true\\` as part of a validation\nrequest. For more information, see [Validate an address](/maps/documentation/javascript/address-validation/TBD).\n\nAs part of our use of USPS services, USPS evaluates requests for artificially created\naddresses. If USPS identifies an input address as being artificially created, Google is\nrequired to stop validating addresses for the customer and must report the customer's\ncontact information (name and address), the relevant input address, and aggregated usage\ndata to USPS. By using the API you consent to these\n[Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms).\n\nNext steps\n\n- [Get started with Address Validation in Maps JavaScript API](/maps/documentation/javascript/address-validation/start)\n\n*** ** * ** ***\n\n1. Google Maps Platform is a non-exclusive Licensee of the United States Postal Service®. The following trademark(s) are owned by the United States Postal Service® and used with permission: United States Postal Service®, CASS™, CASS Certified™. [↩](#fnref1)"]]