Experimenting with Bitcoin machine to machine payments

We will see more and more machines directly and autonomously interacting with each other. Machines provide services to each other that are needed to fulfill their tasks.
Many tools that we are regularly using today are already mashups relying on different services and with the rise IoT we will see only more devices consuming remote services and services directly from other devices. 

Providing services obviously also involves paying for these and this is where Bitcoin comes in. Bitcoin as this decentralized, open network to transfer value allows to send value/payments directly the counterpart.

I’ve been experimenting on how this could be implemented. Here is a client and server implementation of an example for Bitcoin based API payments. 

The example server is exposing an API endpoint (to lookup the weather) that requires the client to attach “some money” to its request. If no payment is attached the server responds with a BIP70 payment request and the client resends the request with the requested payment.

Here is a diagram that shows the sequence of requests:

image

Have a look at the README and try it yourself. What do you think?

21.co lately also released their ideas of Bitcoin-payable APIs and a marketplace for APIs running on their Bitcoin computer.
For sure something to keep an eye on.