void Start() { Instance = this; if (GameDefines.OutputVerDefs == OutputVersionDefs.WPay) { InitializePurchasing(); } }
public async Task <bool> InitializeAsync(string clientToken) { try { initializeTcs = new TaskCompletionSource <bool>(); mBraintreeFragment = BraintreeFragment.NewInstance(CrossCurrentActivity.Current.Activity, clientToken); GooglePayment.IsReadyToPay(mBraintreeFragment, this); } catch (InvalidArgumentException e) { initializeTcs.TrySetException(e); } return(await initializeTcs.Task); }
public async Task <string> TokenizePlatform(double totalPrice, string merchantId) { payTcs = new TaskCompletionSource <string>(); if (isReady) { GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest(); googlePaymentRequest.InvokeTransactionInfo(TransactionInfo.NewBuilder() .SetTotalPrice($"{totalPrice}") .SetTotalPriceStatus(WalletConstants.TotalPriceStatusFinal) .SetCurrencyCode("USD") .Build()); mBraintreeFragment.AddListener(this); GooglePayment.RequestPayment(mBraintreeFragment, googlePaymentRequest); } else { OnTokenizationError?.Invoke(this, "Platform is not ready to accept payments"); payTcs.TrySetException(new System.Exception("Platform is not ready to accept payments")); } return(await payTcs.Task); }