How does a payment method detect whether it is available?

See also: