void CreateWalletFragment() { var walletStyle = new WalletFragmentStyle() .SetBuyButtonText(WalletFragmentStyle.BuyButtonText.LogoOnly) .SetBuyButtonAppearance(WalletFragmentStyle.BuyButtonAppearance.AndroidPayLightWithBorder) .SetBuyButtonWidth(WalletFragmentStyle.Dimension.MatchParent); var options = WalletFragmentOptions.NewBuilder() .SetEnvironment(WalletEnvironment) .SetTheme(WalletConstants.ThemeDark) .SetFragmentStyle(walletStyle) .SetMode(WalletFragmentMode.BuyButton) .Build(); var parameters = PaymentMethodTokenizationParameters.NewBuilder() .SetPaymentMethodTokenizationType(PaymentMethodTokenizationType.NetworkToken) .AddParameter("publicKey", Resources.GetString(Resource.String.public_key)) .Build(); _walletFragment = SupportWalletFragment.NewInstance(options); var walletRequest = Android.Gms.Wallet.MaskedWalletRequest.NewBuilder() .SetMerchantName(Resources.GetString(Resource.String.app_name)) .SetCurrencyCode(_judo.Currency) .SetEstimatedTotalPrice(_judo.Amount.ToString()) .SetPaymentMethodTokenizationParameters(parameters) .SetCart(Cart.NewBuilder() .SetCurrencyCode(_judo.Currency) .SetTotalPrice(_judo.Amount.ToString()) .Build()) .Build(); var startParams = WalletFragmentInitParams.NewBuilder() .SetMaskedWalletRequest(walletRequest) .SetMaskedWalletRequestCode(MaskedWalletRequest) .Build(); _walletFragment.Initialize(startParams); SupportFragmentManager.BeginTransaction() .Add(Resource.Id.container, _walletFragment) .Commit(); }
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(); }
private void CreateAndAddWalletFragment() { var walletFragmentStyle = new WalletFragmentStyle() .SetMaskedWalletDetailsTextAppearance( Resource.Style.BikestoreWalletFragmentDetailsTextAppearance) .SetMaskedWalletDetailsHeaderTextAppearance( Resource.Style.BikestoreWalletFragmentDetailsHeaderTextAppearance) .SetMaskedWalletDetailsBackgroundColor( Resources.GetColor(Resource.Color.bikestore_white)) .SetMaskedWalletDetailsButtonBackgroundResource( Resource.Drawable.bikestore_btn_default_holo_light); var walletFragmentOptions = WalletFragmentOptions.NewBuilder() .SetEnvironment(Constants.WALLET_ENVIRONMENT) .SetFragmentStyle(walletFragmentStyle) .SetTheme(WalletConstants.ThemeLight) .SetMode(WalletFragmentMode.SelectionDetails) .Build(); mWalletFragment = SupportWalletFragment.NewInstance(walletFragmentOptions); // Now initialize the Wallet Fragment var accountName = ((BikestoreApplication)Application).AccountName; var startParamsBuilder = WalletFragmentInitParams.NewBuilder() .SetMaskedWallet(mMaskedWallet) .SetMaskedWalletRequestCode(REQUEST_CODE_CHANGE_MASKED_WALLET) .SetAccountName(accountName); mWalletFragment.Initialize(startParamsBuilder.Build()); // add Wallet fragment to the UI SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.dynamic_wallet_masked_wallet_fragment, mWalletFragment) .Commit(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here SetContentView(Resource.Layout.Main); FindViewById <Button>(Resource.Id.buttonCard).Click += delegate { StartActivity(typeof(CardInputActivity)); }; var b = new WalletClass.WalletOptions.Builder() .SetEnvironment(WalletConstants.EnvironmentSandbox) .SetTheme(WalletConstants.ThemeLight) .Build(); googleApiClient = new GoogleApiClientBuilder(this) .AddConnectionCallbacks(this) .AddOnConnectionFailedListener(this) .AddApi(WalletClass.API, b) .Build(); var walletFragment = SupportWalletFragment.NewInstance(WalletFragmentOptions.NewBuilder() .SetEnvironment(WalletConstants.EnvironmentSandbox) .SetMode(WalletFragmentMode.BuyButton) .SetTheme(WalletConstants.ThemeLight) .SetFragmentStyle(new WalletFragmentStyle() .SetBuyButtonText(BuyButtonText.BuyWithGoogle) .SetBuyButtonAppearance(BuyButtonAppearance.Classic) .SetBuyButtonWidth(Dimension.MatchParent)) .Build()); var maskedWalletRequest = MaskedWalletRequest.NewBuilder() // Request credit card tokenization with Stripe by specifying tokenization parameters: .SetPaymentMethodTokenizationParameters(PaymentMethodTokenizationParameters.NewBuilder() .SetPaymentMethodTokenizationType(PaymentMethodTokenizationType.PaymentGateway) .AddParameter("gateway", "stripe") .AddParameter("stripe:publishableKey", STRIPE_PUBLISHABLE_KEY) .AddParameter("stripe:version", "1.15.1") .Build()) // You want the shipping address: .SetShippingAddressRequired(true) .SetMerchantName("Llamanators") .SetPhoneNumberRequired(true) .SetShippingAddressRequired(true) // Price set as a decimal: .SetEstimatedTotalPrice("20.00") .SetCurrencyCode("USD") .Build(); // Set the parameters: var initParams = WalletFragmentInitParams.NewBuilder() .SetMaskedWalletRequest(maskedWalletRequest) .SetMaskedWalletRequestCode(LOAD_MASKED_WALLET_REQ_CODE) .Build(); // Initialize the fragment: walletFragment.Initialize(initParams); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.frameFragment, walletFragment).Commit(); }