NASIR KAHN: Hello and welcome to another episode of Google
Wallet Developers Live.
We're going to talk about Instant Buy today.
We have had previous sessions on Instant Buy.
This is another session.
My name is Nasir Kahn.
I'm a developer advocate with Google Wallet team.
And I have with me Nagesh Susarta, who is a developer
programs engineer on our team.
We also have a partner from Tagstand.
His name is Joshua Krohn, joining us on Google Hangout.
Hi, Josh.
JOSHUA KROHN: Hi, guys.
NASIR KAHN: So as I said, Tagstand is one of our Instant
Buy partners.
And in this show, we're going to talk about the app that
they have developed with Instant Buy.
So, Josh, let me just start with you first.
I know that you have a few apps.
Tell us what Tagstand does and what have
you been doing recently.
JOSHUA KROHN: So we're working on developing software that
allows your device to use its knowledge of where it is and
what you're doing, respond to its current context, and do
things like change settings or perform actions on your
behalf, rather than requiring the user to take out their
device and interact with it to perform all of
these routine tasks.
NASIR KAHN: OK, nice.
And I know that you have a few apps.
We have one app called NFC Task Launcher, with which we
have the Instant Buy integration.
So, Nagesh, I think you had a plan to show
the demo to our viewers.
NAGESH SUSARTA: So I'm bringing up the NFC Task
Launcher here.
It has a few tabs.
If you can see, there's Buy tags, obviously-- but that's
the first thing you want to do--
My Tasks, and Examples, which has a custom list of tasks.
So the first thing you want to do with the NFC Task Launcher,
if you don't have the tags, is to buy them.
And this is where the Instant Buy integration comes in.
And let's say I like the black NFC tags here.
So I can actually program them once I have them.
NASIR KAHN: So let me ask this.
What is an NFC tag?
What are we buying here with this?
NAGESH SUSARTA: So what an NFC tag is is that it's actually a
small tag, which can be programmed by using the NFC
Task Launcher.
NASIR KAHN: OK.
NAGESH SUSARTA: It can be programmed to do a set of
tasks, which can vary from starting Wi-Fi, stopping
Wi-Fi, launching an application, starting media.
And I'll show you an example of that.
NASIR KAHN: OK.
NAGESH SUSARTA: I mean through the demo.
But first, let me buy the tags.
NASIR KAHN: Excellent.
NAGESH SUSARTA: And so they have integrated Instant Buy.
So I click on it, and it shows me my masked wallet
information, which is exactly which card I want to use for
this transaction.
I say, OK, I want to use this particular card.
And then I go through the flow, and it shows me my
masked wallet information, my shipping address, in case I
wanted to change it.
There is an ability for me to change it.
And it also shows me the card I've chosen.
I have the ability to even change that option right now.
NASIR KAHN: So, Nagesh, when you did that, and you clicked
on the Buy with Google button, is that when you were
interacting with the Google Wallet APIs?
NAGESH SUSARTA: Yes.
NASIR KAHN: And you're getting the card, or the masked card
at least, and the shipping information.
NAGESH SUSARTA: Yeah, the first step is to get the
masked information.
And then once you have the masked information, typically
you would show it to the user.
And Josh has done a great job by showing it to the user.
And then when the user is ready, like when I'm now ready
to buy the tags, I confirm the order.
And this is where I'm actually getting the virtual proxy
card, which is sent to my payment network.
So I confirm the order, and then I get a particular proxy
card and the CVV associated with it.
And I send it back.
I mean, Josh sends it back to his servers and completes the
transaction.
Now since I've already completed my transaction and I
selected super fast delivery, I already have
the tags with me.
I mean, Josh, I should say you guys have an awesome
fulfillment going on there.
But I mean, jokes aside, I already bought the tags
because I'm a fan of NFC tags.
And what I'm going to show you is an example tag.
Now, since I like listening to music in my car, what I did
was I built a small little task list that launches the
Play Music application.
Now this is an app that I'm already subscribed to.
I'm already subscribed to Google Play Music.
You can replace it with any other app that also provides
music in this case.
And then the second task is to actually start media playback.
So once I created this task, I can go ahead and get ready to
write this on a particular tag.
So once it's written that's it.
That's what it takes to actually write on a tag.
Now once I've done this, I take this,
stick it in my car--
I mean, on the central console or something like that.
And when I just get into my car, I tap my NFC and there
comes my play list.
And you know that I'm listening to
Maroon Five right now.
That's how easy it is to integrate NFC Task Launcher
and the NFC tags, which are very useful.
Now that aside, coming back to the actual Instant Buy
integration, I should ask Josh, how was the integration
from your side?
JOSHUA KROHN: So from our side, the integration was
pretty easy.
We saw two main benefits from our side.
One was the reduction in complexity for
payments for the users.
And the other was the ability to get some information about
the users, so we could really tailor the checkout
experience for them.
Previously, we'd been using Google Wallet because--
or I'm sorry, Google Checkout.
Because we know no one likes to enter billing information,
shipping information, and card information.
But there were some real limitations with that.
The Instant Buy API removed those limitations.
So now once the user clicks Purchase, they
select their card.
They select their address.
We have all of that information.
We can then call back out to our servers and dynamically
get them the best shipping rates, any current promotions
we have, like free shipping for some items.
And we can give them effectively the lowest price
possible very easily.
And then from the user end, as soon as they hit Buy, we're
able to process that payment, send that order directly to
fulfillment, and it's processed right away.
So we don't have to worry about queueing up orders and
sending them nightly.
It's very easy.
To do that, we had to do the integration in the app, as
well as build the back-end system itself.
NASIR KAHN: Now would you elaborate on the back-end?
So when you said back-end, did you have to create some
fulfillment of your own?
Is that what you did?
JOSHUA KROHN: We had to create an order management system.
We had to write the actual payment processing, which
we've worked with Braintree to do that.
And then we had to work with our fulfiller to create an API
to push orders to them directly.
NASIR KAHN: OK
JOSHUA KROHN: We had one developer doing that.
And all of those tests were completed in
less than one week.
And so even creating from the ground up, it wasn't this huge
upscale effort that we had to do.
NASIR KAHN: OK.
Now If there is a merchant who already has a back-end payment
processor set up, and they have some kind of fulfillment
in place already, integrating just the Google
Wallet Instant Buy API--
that piece alone is that--
how long did it take you to do that?
JOSHUA KROHN: That part of it took us about a day.
NASIR KAHN: Oh, OK.
JOSHUA KROHN: Instant Buy APIs are very modular and worked
really well with our checkout outflow, the way we have the
items set up.
It was really simple to integrate.
The sample code was very good.
It demonstrated the actual flow, the logic flow, in cases
to handle very well.
So very easy for us in retrospect.
NASIR KAHN: And for the benefit of our viewers who are
interested in getting more detail about Instant Buy, we
have had previous shows in which we have gone into
details of the flow--
masked wallet and full wallet as you
heard Nagesh talk about.
We have much more details there So feel free to go ahead
and check out those videos to get more detail.
But while we have you here Josh, could you would show us
a little bit of a code snippet or something that our viewers
would be interested in looking at to see how the integration
actually looks like?
JOSHUA KROHN: Yeah, sure.
So here is, this is the fragment that displays after
the item is loaded.
So you see the images and the item description and the Buy
Now button.
So this extends a base WalletFragment that handles
making the connection to the Wallet client, disconnecting,
handles some basic error cases, resolving errors,
things like that.
And that was really useful to reuse as we go
through this process.
Because it makes the individual fragments and
activity through [? the flow ?] much easier.
So you can see here that when this loads, immediately we
check for pre-authorization.
We ensure that we have a Wallet request ready, to get
that masked wallet from the user.
And [? you can see ?]
we're using the item itself, getting the price, and then
padding it a little bit.
And then right away we make a call to
load the masked wallet.
And this is done so that as soon as the user clicks the
Buy button, they're either presented with the chooser
dialogue, or they go right to the confirmation, if it loads
successfully the first time.
There's no waiting.
And that's what we really liked.
It's a very quick experience.
So in that fragment itself, we have to deal with some changes
in the masked wallet possibly.
So if it's successful, we check to see if we're ready to
go, effectively, if the user has clicked Buy or not.
If we are, we launch right into the confirmation page.
And all that data is ready for us to use.
If not, we store the connection result for later
and just wait.
NASIR KAHN: You wait for the user to click on the button
and then you resolve the connection result.
JOSHUA KROHN: So as soon as I hit Buy, we have this
convenient method, Buy with Google Wallet.
NASIR KAHN: Um-hum.
JOSHUA KROHN: We'll check to make sure
Wallet's not disabled.
If they have the Wallet previously loaded, we go right
into the confirmation page.
And then if there's any outstanding issue, we don't
have a valid connection result, or Wallet is connected
but we don't have a masked wallet, we dropped back into a
shared method to resolve unsuccessful connections.
And that's going to fall back into that MaskedWalletLoaded
method, so that as soon as we get a valid result, they're
immediately sent to the confirmation.
So it's all very easy.
NAGESH SUSARTA: Yeah, perfect.
NASIR KAHN: Very nice.
JOSHUA KROHN: So here is the actual confirmation screen
that gets displayed.
And again, we're extending the same Wallet fragments.
You don't have to worry about managing the connection, for
start or pause or anything like that.
And all we have to do is onCreate, we're going to pull
the masked wallet out of the intent that we sent.
This is a async task that we set up that's going to go get
shipping data for the user, based on their country, their
localities, their state--
or if they're foreign, other locality--
and return all valid shipping options for that item
specifically.
So we can give them their rate-based shipping and only
give them only relevant cheap options.
NASIR KAHN: Very nice.
JOSHUA KROHN: So at this point, as Nagesh showed, you
can change your payment method.
You can change your address.
So we have to listen for these changes.
So when you click that button, we call changeMaskedWallet.
And then we handle these results.
When that comes back, we'll get it, pull the wallet out of
the intent, and repopulate the data on the screen.
I've taken that out because there's a lot of code there.
NASIR KAHN: Yeah, yeah.
JOSHUA KROHN: So then that's all we have to do.
At that point, once we get that masked wallet back, it
dynamically populates everything for us.
And we're just waiting for the user to
confirm their purchase.
Once they hit Confirm, we make a call to getFullWallet.
We show them a loading dialogue while it
does that and wait.
But when we call getFullWallet, we're just
going to grab their state and country again from the masked
wallet, so that we can get shipping and taxes, so we can
calculate an accurate total.
We're going to use the createFullWallet method that
we have to create that request and load it.
So at that point, all we do is wait.
And once we get a successful result, we can make a call out
to process the payment or handle any incoming errors.
And again, it all calls back into itself.
So if they have to reload the full wallet for any reason,
it'll call back onFullWalletLoaded.
We'll get the success, and then it'll hit the process
payment again.
Processing the payment is as easy as grabbing the full
wallet, pulling the info out here.
You can see some of the info in here that
we're pulling out.
At that point, we build a simple name-value pair
document and post that payment out to our servers.
So you see here's our simple async task that takes in that
list of params.
We're going to use HTTPPost to post that out, receive the
result that we get back from Braintree--
that's our payment processor--
and then the subsequent order processing on our end, set the
transaction status based on that response, and then send
it up to notify Google Wallet what the status was, and then
alert the user.
So you'll see here there's a utility method in the Wallet
client to post back to Google Wallet.
We send the transaction ID and the status we got back from
our server.
And then we start the OrderCompleteActivity to show
the user either their order data, or if there was an
error, we push the error to there.
And that's the whole flow.
NASIR KAHN: Very nice.
JOSHUA KROHN: Their order's been placed.
It's in our system.
And it's already been dispatched to our fulfillment
at that point.
So they should get an email very quickly.
And it will be fulfilled same business day usually.
NASIR KAHN: This is awesome.
This is awesome.
So, Josh, you just walked through the entire Instant Buy
flow in what, about five minutes or so?
NAGESH SUSARTA: Yeah.
NASIR KAHN: That's pretty much it.
So this is--
NAGESH SUSARTA: You've condensed it very, very---
NASIR KAHN: Nicely.
NAGESH SUSARTA: And I should ask you this question.
Which other APIs in Google Play services are you using?
Because I saw a task, which was like create a Geofence.
And I was very excited to use it.
And I would love to know what other APIs are you using from
Google Play Services.
JOSHUA KROHN: We really like Google Play Services, because
it lets us use new APIs on all the devices we target.
We target from API level 10 and up.
And I think Google Play Services goes back to API
level eight.
So effectively every one of our users can use all of the
new features that gets introduced.
So at this point, we are using Google+ sign-in.
We use that for cloud backups and restores.
And we're looking at it enhancing that pretty soon to
add +1 support and shared app activities.
We're also using the new location-based APIs--
the Fused Location Provider that was demo'ed at I/O this
year, the Activity Recognition client, and then the Geofences
themselves.
The Geofences is something that's been really popular
with people, because it lets them go hands off.
NAGESH SUSARTA: So what can I do with it exactly?
Can you give an example?
JOSHUA KROHN: Yeah.
So we let you select a location, either via search or
selecting it on the map, and then define a radius for that,
obviously, to create your fence.
Then you can set your conditions so that when you go
into or leave that place, a defined series of actions is
run for you.
So you can use it to say, when you get to work, you can make
sure Wi-Fi's on.
Maybe you're using Bluetooth in your car.
You can turn it off.
And you can send a text to your wife to let her know you
got there safely.
NAGESH SUSARTA: Nice.
JOSHUA KROHN: These things all happen automatically.
And that's something that we're really excited about.
And we use quite a bit.
And we've got a lot of really good feedback from users on.
NASIR KAHN: Fantastic.
All right, great.
Thank you so much, Josh.
Thanks for a nice demo and walk through of the code.
For our viewers, I would recommend them to go ahead and
check the NFC Task Launcher app from Play.
Play around with it and see how it looks.
If you are a developer or a merchant who is selling
physical goods or services on Android, then this
is the API for you.
I would recommend you go to a URL,
getInstantBuy.withgoogle.com.
One more time, getInstantBuy.withgoogle.com.
It's actually an interest form.
This is a closed beta as yet.
So just fill out this form and somebody from Google will get
in touch with you.
And you can start out from there.
And you might as well have an app, just like Josh's app.
And we'll be more than happy to show it to our viewers.
Thank you so much for listening to us.
NAGESH SUSARTA: Thank you.
NASIR KAHN: Bye.
NAGESH SUSARTA: Bye.