📜 ⬆️ ⬇️

Browser API for registering on the site and making instant payments

I am infinitely sure that all people hate forms and consider their filling as unnatural and unnecessary things. Moreover, the yard is already 12 years old as the XXI century.

Present to your attention the translation of a small note by Alex MacCaw (Alex Maccaw, a JavaScript programmer, (co) author of some books (even free ones) by O'Really) about the concept of a browser-based API that would save developers from various kinds of bicycle writing and users from routine operations on filling out forms for registration and execution of payments.

Alex, the author of the note, should be identified by the reader with the pronoun "I".

At the beginning of the 20th century, when there was a transition from horse-drawn carriages to automobiles, designers were so used to authentic carts that drivers of automobiles of that time had to drive a vehicle while sitting outside. Design "genius" reached the point that the front of the car (which was entirely similar to the crew) attached a full-scale figure of a horse, in the eyes of which were the headlights, in the mouth - horn, and inside - the trunk.
')
image

I think that auto-completion of forms is very similar to “Crews without horses”: it solves a specific problem, but it does not solve a more voluminous one. And what will happen if we abandon the form at all?

I propose the idea of ​​a browser-based API, which would allow to receive data for auto-completion already stored in the browser: for example, to the address and credit card data. Thus, checking the browser of the site would be reduced to: processing a click on the purchase button and providing the domain of the site with access to the required information.

image

This approach can be used not only to make payments, but also to ensure registration and authorization on the site. In this case, the site can check the support of this API by the browser and, in case of failure, show an ordinary form. The fact that in this situation the process of using the site will be much more transparent indicates that the conversion should increase.

The proposed API is very, very simple. He is calling
navigator.requestProfile 
and passing an array of required data types and callback functions, for example:

 navigator.requestProfile(['firstName', 'email', 'cardNumber'], function(profile){ console.log('Your name is:', profile.firstName); /* ... */ }); 


As a prototype, I developed a Chrome browser extension that implements the described APIs and provides sites with access to a pre-configured data repository.

There are a number of things that I would like to do better. For example, to make the dialog of allowing access to data modal, encrypt data on credit card numbers and make a preview of any data that the site wants to access. However, I think this is a good start.

The key point in the implementation of this API is the ability to come to certain agreements in matters relating to security.

Also, I opened the discussion in one of the W3C mailing lists . In general, I hope that together we can come to a common opinion!

Source: https://habr.com/ru/post/149397/


All Articles