Skip to main content
MetaMask
Mobile
Multichain API

wallet_scanQRCode

Summary: Requests that the user scan a QR code.

Requests that the user scan a QR code using their device camera. Introduced by EIP-945.

Parameters

Regex
string

A regular expression (regex) string for matching arbitrary QR code strings.

Returns

QR code string
string

A string corresponding to the scanned QR code. If a regex string is provided, the resulting string matches it. If no regex string is provided, the resulting string matches an Ethereum address. If neither condition is met, the method returns an error.

Customize request
Parameter
Value
string

Connect your MetaMask wallet to run requests successfully.

Request

await window.ethereum.request({
"method": "wallet_scanQRCode",
"params": [],
});