Rakuten Inc., the Japanese online retailer controlled by billionaire Hiroshi Mikitani, is buying the Viber Internet messaging and calling service for $900 million as it moves into social networking.