Sure. Companies often invest in other companies. Google Ventures is an example of this. Microsoft invested in Facebook then promptly integrated connect into Bing, Xbox Live and Outlook.com (with probably more to come).
Starbucks can benefit from the Square deal, invest in them, and help promote them all at the same time. Actually pretty brilliant.