Bring Android Pay to Your Apps with Stripe

Android Pay + StripeAndroid Pay has just launched, and Xamarin has everything you need to get your apps ready. The Google Play Services – Wallet NuGet adds the necessary APIs for Android Pay integration.

We’re also proud to announce that the Xamarin Stripe Component is Android Pay compatible! We’ve updated the sample to show you just how easy it is to process Android Pay transactions through Stripe.

After installing the Google Play Services – Wallet NuGet package and the Xamarin Stripe Component, start by initializing the Google API client in your Activity with the appropriate API:

googleApiClient = new GoogleApiClientBuilder (this)
    .AddConnectionCallbacks (this)
    .AddOnConnectionFailedListener (this)
    .AddApi (WalletClass.API, b)
    .Build ();

Google provides the SupportWalletFragment class, which will display a branded Purchasebutton within the fragment:

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 ());

The MaskedWalletRequest class is used to build a new purchase request. You could use any payment gateway that can accept EMVCO Network Tokens, or in this case set up your Stripe account as the payment gateway with some configuration options:

var maskedWalletRequest = MaskedWalletRequest.NewBuilder ()
// Request credit card tokenization with Stripe
.SetPaymentMethodTokenizationParameters (
    PaymentMethodTokenizationParameters.NewBuilder ()
        .SetPaymentMethodTokenizationType (PaymentMethodTokenizationType.PaymentGateway)
        .AddParameter ("gateway", "stripe")
        .AddParameter ("stripe:publishableKey", STRIPE_PUBLISHABLE_KEY)
        .AddParameter ("stripe:version", "1.15.1")
        .Build ())
    .SetShippingAddressRequired (true)
    .SetMerchantName ("Xamarin")
    .SetPhoneNumberRequired (true)
    .SetShippingAddressRequired (true)
    .SetEstimatedTotalPrice ("20.00")
    .SetCurrencyCode ("USD")

Android Pay UI Flow

Once the request has been built, it needs to be assigned to the wallet fragment. This will cause the request to be used when the user taps the Payment button:

walletFragment.Initialize (WalletFragmentInitParams.NewBuilder ()
    .SetMaskedWalletRequest (maskedWalletRequest)
    .SetMaskedWalletRequestCode (LOAD_MASKED_WALLET_REQ_CODE)
    .Build ());
SupportFragmentManager.BeginTransaction ()
    .Replace (Resource.Id.frameFragment, walletFragment).Commit ();

When the Buy button is tapped, your MaskedWalletRequest will be executed. At this point, Google will handle asking the user which account and payment method they’d like to use, as well as their shipping address (if you requested one) by presenting them with the necessary dialogues.

Eventually when the user has entered the required information, your activity’sOnActivityResult will be called. At this point you can use the result to create aFullWalletRequest to finalize the transaction:

protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
    if (requestCode == LOAD_MASKED_WALLET_REQ_CODE && resultCode == Result.Ok) {
        var maskedWallet = data.GetParcelableExtra (WalletConstants.ExtraMaskedWallet)
            .JavaCast ();
        var fullWalletRequest = FullWalletRequest.NewBuilder ()
            .SetCart (Cart.NewBuilder ()
                .SetCurrencyCode ("USD")
                .SetTotalPrice ("20.00")
                .AddLineItem (LineItem.NewBuilder () // Identify item being purchased
                    .SetCurrencyCode ("USD")
                    .SetQuantity ("1")
                    .SetDescription ("Premium Banana")
                    .SetTotalPrice ("20.00")
                    .SetUnitPrice ("20.00")
                    .Build ())
                .Build ())
            .SetGoogleTransactionId (maskedWallet.GoogleTransactionId)
            .Build ();
            WalletClass.Payments.LoadFullWallet (googleApiClient, fullWalletRequest,

Once the request to load a full wallet completes, your activity’s OnActivityResult will once again be called with the results. You can parse the Stripe Token object from these results:

protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
    if (requestCode == LOAD_FULL_WALLET_REQ_CODE && resultCode == Result.Ok) {
        var fullWallet = data.GetParcelableExtra (WalletConstants.ExtraFullWallet)
            .JavaCast ();
        var tokenJson = fullWallet.PaymentMethodToken.Token;
        var stripeToken = Stripe.Token.FromJson (tokenJson);

The stripeToken is what you will send to your server, which is responsible for communicating the actual payment request to Stripe’s servers.

For the complete example of integrating Android Pay and Stripe in your app, check out the sample in the Xamarin Stripe Component.

Note: you may continue to see ‘Google Wallet’ branding until Android Pay is fully rolled out.

The post Bring Android Pay to Your Apps with Stripe appeared first on Xamarin Blog.

New VCL Styles and Style Enhancements in RAD Studio 10 Seattle

New VCL Styles and Style Enhancements in RAD Studio 10 Seattle

In Delphi, C++ Builder and RAD Studio 10 Seattle, we provide a variety of new VCL styles and VCL style enhancements.


Windows 10 Styles

Choose from three built-in Windows 10 styles: Modern Light, Modern Dark and Modern Blue. These styles work great with the new VCL Windows 10 UI controls as well as the existing VCL UI controls.


Common Dialog Styling

VCL styling now extends to dialogs such as TPrinterSetupDialog, TOpenDialog, TSearchDialog and more.


VCL Web Browser Styling

The VCL Web Browser control now fully supports custom styling.


New Style Templates for Windows 10

New Windows 10 Style Templates allow you to create custom Windows 10 styles using your own color schemes. The Bitmap Style Designer can be found in the bin directory or accessed from the IDE via Tools > Bitmap Style Designer.



New OnyxBlue Style

OnxyBlue is a new VCL style included with RAD Studio 10 Seattle. Easily apply it to your existing application via Project > Options > Application > Appearance. RAD Studio 10 Seattle includes dozens of VCL styles.

All included VCL styles can be accessed by browsing to C:\Users\Public\Documents\Embarcadero\Studio\17.0\Styles.



Premium Styles

Quickly change the entire look of your application with one of the eight premium VCL styles that are part of the Bonus Pack if you purchase RAD Studio 10 Seattle by September 30, 2015.


Build apps that run on iOS 9 with RAD Studio 10 Seattle today


iOS 9 was released today. With Delphi, C++Builder and RAD Studio 10 Seattle, you can now build Delphi and C++ iOS applications that will run on iOS 9 32-bit and 64-bit devices, with debugging support on both, in addition to iOS 8 and iOS 7 that we previously supported.


The RAD Studio 10 Seattle IDE and PAServer are compatible with the new Xcode 7 release, allowing you to build iOS apps using all the great new FireMonkey and platform features that we released a couple of weeks ago with the 10 Seattle release. This includes the following:


  • Support for existing iPhone 3.5”, 4.0”, 4.7” (iPhone 6) and 5.5” (iPhone 6 Plus) form factors and iPad form factors
  • Create applications for the new iPhone 6s, iPhone 6s Plus and iPad Pro devices
  • Develop apps for iOS 7, iOS 8 and iOS 9
  • Build, deploy and debug applications on 32-bit and 64-bit iOS 9 devices
  • Create apps for Ad-Hoc or App Store distribution
  • iOS 9 Native UI styles
  • Support for the new iOS 9 system font
  • iOS 9 platform rendering support for TCalendar, TEdit, TListView, TMemo, TSwitch, TPresentedScrollBox, TPresentedVertScrollBox, TPresentedHorzScrollBox, TPresentedFramedScrollBox and TPresentedFramedVertScrollBox


To download a trial of RAD Studio 10 Seattle, please visit

Embarcadero MVP

We are excited to announce that we are now an Embarcadero MVP.

We have been using Embarcadero products for over 20 years, and we would like to thank Embarcadero, David I, Jim McKeeth, Christine Ellis and all the team for their support over those 20 years.  As an Embarcadero Technology Partner and MVP we look forward to bring you the very latest software for all your devices, using Embarcadero’s C++, Delphi and related technologies.

What is an Embarcadero MVP ?

“Embarcadero’s MVP (Most Valuable Professional) program chooses the “best of the best” Embarcadero community members to be trusted assets for our customers and prospects. An MVP is passionate about Embarcadero products and the success of everyone who uses them. An MVP evangelizes (cheers for, promotes, teaches about, etc.) Embarcadero products by writing and speaking on the elegance, simplicity and productivity of our products at user groups, conferences, and webinars, and in websites, articles, newsgroups, blogs and social networks.” – Embarcadero