Skip to main content
Back to plugins
@capgo/capacitor-nfc
Tutorial
@capgo/capacitor-nfc

NFC

Native NFC tag discovery, reading and writing for Capacitor apps on iOS and Android

Guide

Tutorial on NFC

Using @capgo/capacitor-nfc

Public API surface for the Capacitor NFC plugin.

Install

bun add @capgo/capacitor-nfc
bunx cap sync

What This Plugin Exposes

  • startScanning - Starts listening for NFC tags.
  • stopScanning - Stops the ongoing NFC scanning session.
  • write - Writes the provided NDEF records to the last discovered tag.
  • erase - Attempts to erase the last discovered tag by writing an empty NDEF message.

Example Usage

startScanning

Starts listening for NFC tags.

import { CapacitorNfc } from '@capgo/capacitor-nfc';

await CapacitorNfc.startScanning();

stopScanning

Stops the ongoing NFC scanning session.

import { CapacitorNfc } from '@capgo/capacitor-nfc';

await CapacitorNfc.stopScanning();

write

Writes the provided NDEF records to the last discovered tag.

import { CapacitorNfc } from '@capgo/capacitor-nfc';

await CapacitorNfc.write({} as WriteTagOptions);

erase

Attempts to erase the last discovered tag by writing an empty NDEF message.

import { CapacitorNfc } from '@capgo/capacitor-nfc';

await CapacitorNfc.erase();

Full Reference

Keep going from Using @capgo/capacitor-nfc

If you are using Using @capgo/capacitor-nfc to plan dashboard and API operations, connect it with @capgo/capacitor-nfc for the implementation detail in @capgo/capacitor-nfc, Getting Started for the implementation detail in Getting Started, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, and API Keys for the implementation detail in API Keys.