Validate an address in a Bitcoin payment form
Client-side pattern checks can accept malformed destinations. The node can validate an address in its network context and return the exact output script.
Check the original input
Set CANDIDATE to the address as supplied. The example uses a mainnet node. Keep the original string available for feedback rather than silently changing disputed characters.
bitcoin-cli validateaddress "$CANDIDATE" | jq '{isvalid, scriptPubKey, error, error_locations}'
Use diagnostic positions cautiously
An invalid result can include likely error positions for a damaged Bech32 string. Highlight those positions and ask the sender to obtain the address again. A valid result establishes decodability on this network, while ownership and payment intent still require the recipient's confirmation.