Would you mind walking me through the security issues with this approach?
The 402 response for "payment/bitcoin" contains a Bitcoin URI, and can be served up through HTTPS to avoid MITM attacks. Short of a server compromise I'm not sure what the attack vector is.
Yes I can, and if your just use the 402 http header as a way to tell programs thru an api to pay, and return a bitcoin URI is fine. BUTTTTTTTT someone was describing using 402 to start the client to start the payment process and locking down the browser, this is a security flaw. PHP can start a 402 and use javascript to control everything so the user would have no idea until funds are flowing.
Thanks for the extra detail.
From what you describe, you're worried that the browser would handle the Bitcoin URI differently as a result of a 402 than it would as a result of, say, a user clicking on a link. That is not the case. Having the additional information from the server that a payment is about to be made, the browser can tighten its security to provide a temporary locked down sandbox while the payment process goes through. Simply clicking a link does not give the browser this information.
Of course, a compromised browser would have the option of rewriting data, but that would happen with any HTML feed and the browser manufacturers go to some lengths to detect internal compromise. That is outside the scope of this proposal.
Regarding a PHP/JavaScript attack by controlling the browser to make the payment, this is mitigated by the Bitcoin client (the protocol handler) asking the user to confirm the payment in the same way as clicking on the link does. The browser isn't in charge of the payment, an external app is.
EDIT To emphasise that JavaScript is not permitted to take over the mouse pointer and drive it around the screen
http://stackoverflow.com/a/4752512/396747