/** * Here the client should connect to their server, process the credit card/instrument * and get back a status indicating whether charging the card was successful or not */ void fetchTransactionStatus(FullWallet fullWallet) { if (mProgressDialog.IsShowing) { mProgressDialog.Dismiss(); } // Log Stripe payment method token, if it exists PaymentMethodToken token = fullWallet.PaymentMethodToken; if (token != null) { // getToken returns a JSON object as a String. Replace newlines to make LogCat output // nicer. The 'id' field of the object contains the Stripe token we are interested in. Android.Util.Log.Debug(TAG, "PaymentMethodToken:" + token.Token.Replace('\n', ' ')); } // NOTE: Send details such as fullWallet.getProxyCard() or fullWallet.getBillingAddress() // to your server and get back success or failure. If you used Stripe for processing, // you can get the token from fullWallet.getPaymentMethodToken() // The following code assumes a successful response and calls notifyTransactionStatus WalletClass.Payments.NotifyTransactionStatus(mGoogleApiClient, WalletUtil.CreateNotifyTransactionStatusRequest(fullWallet.GoogleTransactionId, NotifyTransactionStatusRequest.Status.Success)); Intent intent = new Intent(Activity, typeof(OrderCompleteActivity)); intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask); intent.PutExtra(Constants.EXTRA_FULL_WALLET, fullWallet); StartActivity(intent); }
private void createAndAddWalletFragment() { var walletFragmentStyle = new WalletFragmentStyle() .SetBuyButtonText(BuyButtonText.BuyWithGoogle) .SetBuyButtonAppearance(BuyButtonAppearance.Classic) .SetBuyButtonWidth(Dimension.MatchParent); var walletFragmentOptions = WalletFragmentOptions.NewBuilder() .SetEnvironment(Constants.WALLET_ENVIRONMENT) .SetFragmentStyle(walletFragmentStyle) .SetTheme(WalletConstants.ThemeLight) .SetMode(WalletFragmentMode.BuyButton) .Build(); mWalletFragment = SupportWalletFragment.NewInstance(walletFragmentOptions); // Now initialize the Wallet Fragment var accountName = ((BikestoreApplication)Application).AccountName; MaskedWalletRequest maskedWalletRequest; if (mPaymentMethodParameters != null) { maskedWalletRequest = WalletUtil.CreateStripeMaskedWalletRequest(Constants.ITEMS_FOR_SALE[mItemId], mPaymentMethodParameters); } else { maskedWalletRequest = WalletUtil.CreateMaskedWalletRequest(Constants.ITEMS_FOR_SALE[mItemId]); } var startParamsBuilder = WalletFragmentInitParams.NewBuilder() .SetMaskedWalletRequest(maskedWalletRequest) .SetMaskedWalletRequestCode(REQUEST_CODE_MASKED_WALLET) .SetAccountName(accountName); mWalletFragment.Initialize(startParamsBuilder.Build()); // add Wallet fragment to the UI SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.dynamic_wallet_button_fragment, mWalletFragment) .Commit(); }
void getFullWallet() { WalletClass.Payments.LoadFullWallet(mGoogleApiClient, WalletUtil.CreateFullWalletRequest(mItemInfo, mMaskedWallet.GoogleTransactionId), REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET); }