Re:HTTP 402 – Payment Required
by spindritf on Friday June 06, 2014 @08:34AM
(#7857481)
Not really useful until there's an integrated way for paying for a piece of content. Which most people probably won't use anyway, see: http auth.
[ Parent
| on HN ]
Still useful for API's with mixed (paid & free) content, so you can keep a uniform URL structure.
This is exactly what I've used the 402 code for. Some API routes are available to all users, but others require paid access. If a freemium user attempts to access API routes behind the "paywall" I return the 402 code.
Re:HTTP 402 – Payment Required
by michaelmior on Friday June 06, 2014 @08:49AM
(#7857538)
This gives more information than a 401 or 403, but agreed that it's use is still limited. Would make sense to return a 402 along with a redirect to a payment page.
> return a 402 along with a redirect
So a 3xx error.
I think a 402 with a typed "Link" response header field of "payment" (per http://tools.ietf.org/html/rfc5988) would probably be the most appropriate no?
Excellent observation.