Re: HTTP 402 (payment required) -- the missing link

On 17 June 2015 at 05:40, UniDyne <unidyne@gmail.com> wrote:

> Yes, you can return headers including "Location" with a 402. The issue is
> that user-agents today won't do anything with it. For now, you would also
> need to include a page with a link as suggested by David.
>

Why do you think user agents wont do anything with a 402?  It's easy enough
to trap such a return code:

            $.ajax({
                url: uri,
                success: function(result) {
                },
                statusCode: {
                    402: function() {
                    }
                }
            });

I could use this to take the next steps.


>
> On Tue, Jun 16, 2015 at 8:34 PM, Melvin Carvalho <melvincarvalho@gmail.com
> > wrote:
>
>>
>>
>> On 17 June 2015 at 02:23, David I. Lehn <dil@lehn.org> wrote:
>>
>>> On Tue, Jun 16, 2015 at 7:57 PM, Melvin Carvalho
>>> <melvincarvalho@gmail.com> wrote:
>>> > I've implemented HTTP 402 a few times for payment protected resources.
>>> > ...
>>> > If payment is required, how does the client know what to do next?
>>> > ...
>>> > What about sending a Location: header telling the client where to go
>>> next?
>>> >
>>> > Then the client can find all the information about how to pay, their
>>> > balance, the cost etc.
>>> > ...
>>>
>>> Won't user agents only follow that Location for 3xx codes?  How about
>>> just including human and/or machine readable info in the 402 response
>>> content?
>>>
>>
>> Seems possible.  But are you allows to return data with a 4xx?  Im not
>> sure on this ...
>>
>>
>>>
>>> -dave
>>>
>>
>>
>

Received on Wednesday, 17 June 2015 04:07:48 UTC