用户想要购买商品时,应调用 IStoreController 的 InitiatePurchase 方法来识别用户想要购买的商品。
// Example method called when the user presses a 'buy' button
// to start the purchase process.
public void OnPurchaseClicked(string productId) {
controller.InitiatePurchase(productId);
}
您的应用程序将异步地收到结果通知(购买成功时调用 ProcessPurchase,而购买失败时调用 OnPurchaseFailed)。