1# @ohos.nfc.cardEmulation (标准NFC-cardEmulation)(系统接口) 2 3本模块主要提供NFC卡模拟业务,包括判断支持哪种卡模拟类型,HCE卡模拟的业务实现等。 4HCE(Host Card Emulation),称为基于主机的卡模拟,表示不依赖安全单元芯片,应用程序模拟NFC卡片,可以通过NFC服务和NFC读卡器通信。 5 6> **说明:** 7> 8> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 9> 当前页面仅包含本模块的系统接口,其他公开接口参见[@ohos.nfc.cardEmulation (标准NFC-cardEmulation)](js-apis-cardEmulation.md) 10 11 12## 导入模块 13 14``` 15import { cardEmulation } from '@kit.ConnectivityKit'; 16``` 17 18## getPaymentServices<sup>11+</sup> 19 20getPaymentServices(): [AbilityInfo](../apis-ability-kit/js-apis-bundleManager-abilityInfo.md)[] 21 22获取所有支付类型的服务列表。如果应用程序声明支持HCE功能,并且声明了"payment-aid",则会包含在列表里面,参考[HCE卡模拟和AID列表的声明定义](js-apis-cardEmulation.md#hce卡模拟和aid列表的声明定义)。 23 24**系统接口:** 此接口为系统接口。 25 26**系统能力:** SystemCapability.Communication.NFC.CardEmulation 27 28**需要权限:** ohos.permission.NFC_CARD_EMULATION 29 30**返回值:** 31 32| **类型** | **说明** | 33| ------- | ------------------------------------ | 34| [AbilityInfo](../apis-ability-kit/js-apis-bundleManager-abilityInfo.md)[] | 返回所有支付类型的服务。 | 35 36**错误码**: 37 38以下错误码的详细介绍请参见[NFC错误码](errorcode-nfc.md)。 39 40| 错误码ID | 错误信息 | 41| -------- | ---------------------------- | 42|201 | Permission denied. | 43|202 | Non-system applications are not allowed to use system APIs. | 44|801 | Capability not supported. | 45 46**示例:** 47```js 48import { cardEmulation } from '@kit.ConnectivityKit'; 49 50let paymentServices = cardEmulation.getPaymentServices(); 51if (paymentServices == undefined || paymentServices.length == 0) { 52 console.log('paymentServices is null.'); 53} 54 55``` 56 57