The Hitch Hiker's Guide to Android Pay

860bf040d996601213e05747dd661c23?s=47 Tomoaki Imai
November 22, 2016

The Hitch Hiker's Guide to Android Pay

[Japanese] This slide is a guide for implementing Android Pay

860bf040d996601213e05747dd661c23?s=128

Tomoaki Imai

November 22, 2016
Tweet

Transcript

  1. The Hitch Hiker’s Guide to Android Pay @Shibuya.apk 11/22/2016 Tomoaki

    Imai
  2. twitter: @tomoaki_imai github: tomoima525 ࠓҪ ஐষ Android Engineer http://mercan.mercari.com/entry/2016/11/18/110000

  3. ࠷ۙHotͳ࿩୊

  4. None
  5. || Pay Apple Pay & Android Pay

  6. Mercari supports and

  7. Android Pay ֓ཁ • Google Accountʹܾࡁ৘ใΛඥ෇͚ • ొ࿥ޙ͸جຊతʹϫϯλοϓͰߪೖ ׬ྃͰ͖Δ •

    ܾࡁ৘ใΛ୺຤ʹอ࣋͠ͳ͍(Apple Pay͸ϩʔΧϧʹ҉߸Խͯ͠อଘ) • (ݱঢ়USͷΈ) ళฮܾࡁ΍Ϋʔϙϯػ ೳ౳΋ରԠ • Android OS 4.4Ҏ্
  8. Coming Japan 2017?

  9. “ͪΐͪΐͬͱೖΕͯΑ” ͱݴΘΕͨ࣌ʹࠔΒͳ͍ͨΊʹ!

  10. Agenda • Android Payಋೖཁ݅/ಋೖεέδϡʔϧ • Android Payͷ࢓૊Έ • ͸·ͬͨ͜ͱ

  11. Agenda • Android Payಋೖཁ݅/ಋೖεέδϡʔϧ • Android Payͷ࢓૊Έ • ͸·ͬͨ͜ͱ

  12. ಋೖཁ݅ • Processor(ܾࡁ୅ߦձࣾ)͕ରԠ͍ͯ͠Δ • Mercariͷ৔߹͸Braintreeͱ͍͏Processorͱఏܞ͍ͯ͠Δ • play service SDK 9.0.0Ҏ্(9.0.0ҎԼͰ΋ରԠ͍ͯ͠Δ͕ɺProcessor͕ఏڙͯ͠

    ͍ΔSDKͱ੔߹ੑ͕औΕͳ͘ͳΔՄೳੑ͕͋Δ) compile “com.google.android.gms:play-services-base:9.0.0"
 compile "com.google.android.gms:play-services-wallet:9.0.0"
  13. Android Pay ಋೖεέδϡʔϧ • ։ൃ։࢝~ϩʔϯν·Ͱ໿3िؒ • ࣮૷ΑΓ΋UIݕ౼, ϑΟʔυόοΫରԠ͕͔͔࣌ؒͬͨ • αʔόʔαΠυʹ͍ͭͯ͸ɺApple

    Pay ͷ࢓૊Έ͕ྲྀ༻Ͱ͖ͨͷͰରԠͳ͠ "OESPJE1BZ"1*Λ࢖ͬͯ ࣮ࡍʹΞϓϦΛ࡞Δ%BZ )BDLBUIPO ͜͜ͰϓϩτλΠϓ࡞੒ Android Pay Hackathon week1 week2 Launch ࣮૷࣌ͷෆ໌఺͸(PPHMFࣾ ʹ໰͍߹Θͤ  "QLΛૹ෇  σβΠϯ͕ΨΠυϥΠϯʹ Ԋ͍ͬͯΔ͔  ڍಈʹ໰୊͸ͳ͍͔ ϓϩτλΠϓ ࢓༷σβΠϯ ࣮૷ςετ (PPHMFϨϏϡʔϑΟʔυόοΫରԠ ঎༻؀ڥͰͷ ར༻ͷղআ
  14. Agenda • Android Payಋೖཁ݅/ಋೖεέδϡʔϧ • Android Payͷ࢓૊Έ • ͸·ͬͨ͜ͱ

  15. Android Pay ͷ࢓૊Έ ୺຤͕"OESPJE1BZʹରԠ͍ͯ͠Δ͔νΣοΫ 8BMMFU1BZNFOUTJT3FBEZ5P1BZ ܾࡁΛ͢Δͷʹඞཁͳ5PLFOΛ1SPDFTTPSʹϦΫΤετ AndroidPay.getTokenizationParameters(braintreeFragment, (parameters, allowedCardNetworks) ->

    {…}); 5PLFOΛݩʹ.BTLFE8BMMFUΛੜ੒ ॅॴ৘ใɺӅṭ͞ΕͨΫϨΧ৘ใ౳ؚ͕·ΕΔ Wallet.Payments.loadMaskedWallet(googleApiClient, maskedWalletRequest, requestCode); .BTLFE8BMMFU͔Β'VMM8BMMFUΛੜ੒ ΫϨΧܾࡁͷͨΊʹඞཁͳτʔΫϯ৘ใ͕͋Δ Wallet.Payments.loadFullWallet(googleApiClient, fullWalletRequest, REQUEST_FULL_WALLET); τʔΫϯ৘ใΛݩʹܾࡁΛߦ͏ AndroidPay.tokenize(braintreeFragment, fullWallet); Processor Google Server Client
  16. Agenda • Android Payಋೖཁ݅/ಋೖεέδϡʔϧ • Android Payͷ࢓૊Έ • ͸·ͬͨ͜ͱ

  17. Masked Wallet? Full Wallet? • MaskedWallet, Full Walletͷ໾ׂ • MaskedWallet͸ܾࡁલʹϢʔβʔఏࣔʹඞཁͳ৘ใ(ActivityؒͰ࢖͍·Θ͠OK)

    • FullWallet͸ܾࡁ࣌ʹඞཁͳ৘ใ(Ұ౓͖Γɺຖ౓MaskedWallet͔Βੜ੒) public MaskedWalletRequest createMaskedWalletRequest(PaymentMethodTokenizationParameters parameters,
 Collection<Integer> allowedCardNetworks, int finalPaymentPrice){
 Cart cart = Cart.newBuilder().setCurrencyCode(Const.CURRENCY_USD)
 .setTotalPrice(finalPaymentPrice).build(); /
 return MaskedWalletRequest.newBuilder()
 .setPaymentMethodTokenizationParameters(parameters)
 .addAllowedCardNetworks(allowedCardNetworks)
 .setMerchantName(Const.MERCHANT_NAME)
 .setCurrencyCode(Const.CURRENCY_USD)
 .setEstimatedTotalPrice(cart.getTotalPrice())
 .setCart(cart)
 .setShippingAddressRequired(true)
 .build();
 } • Ͳ͏͍͏৘ใΛͦΕͧΕͷλΠϛϯάͰGoogleଆʹૹΕ͹ྑ͍͔Θ͔Βͳ͍ • ౎౓ૹΕ͹ྑ͍৘ใΛ֬ೝ
  18. ຬͨ͢΂͖ཁ͕݅৭ʑ • Branding Requirements • https://developers.google.com/android-pay/ui-branding • https://android-pay-toolkit.withgoogle.com/overview/in-android-applications • ࢖༻ՄೳͳϩΰɺαΠζɺจݴ

    • ϑϩʔͷ؍఺Ͱͷཁ݅ • ඇରԠ୺຤Ͱ͸දࣔ͠ͳ͍ etc
  19. ݕূ͕େม • ରԠ͢ΔΫϨδοτΧʔυ͕खݩʹඞཁ ‣ ProcessorʹΑͬͯ͸ςετΧʔυ͕ར༻Ͱ͖ͳ͍ ‣ ࣗલͷΧʔυ࢖͏ -> ొ࿥੍ݶʹҾ͔͔ͬͬͯΧʔυఀࢭ •

    ঎༻؀ڥͰͷݕূ͸GoogleͷApproveΛड͚͔ͯΒ(ͭ·Γϩʔϯν௚લ) • PreAuthorize(Ұ౓ར༻ͨ͠৔߹ʹͦͷೝূΛ࠶ར༻ग़དྷΔػೳ)Λoffʹ͢Δ৔ ߹ʹ͸ app ͷstorekeyΛม͑Δඞཁ͕͋Δ
  20. ProcessorʹΑ࣮ͬͯ૷ҟͳΔ • Processor֤ࣾʹΑ࣮ͬͯ૷ͷํ๏͕ҟͳΔ • Processor͕มΘΔͱશͯมΘΔՄೳੑ͕͋Δ mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) .enableAutoManage(fragmentActivity,

    this /* onConnectionFailedListener */) .setAccountName(accountName) // optional .addApi(Wallet.API, new Wallet.WalletOptions.Builder() .setEnvironment(Constants.WALLET_ENVIRONMENT) .setTheme(WalletConstants.THEME_LIGHT) .build()) .build(); Wallet.Payments.loadFullWallet(mGoogleApiClient, fullWalletRequest, REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET); braintreeFragment.getGoogleApiClient(googleApiClient ->
 Wallet.Payments.loadFullWallet(googleApiClient, fullWalletRequest, REQUEST_FULL_WALLET)); Braintree Stripe
  21. ·ͱΊ • ಋೖཁ݅Λຬ͍ͨͯ͠Δ͔֬ೝ! • ޻਺͸ϨϏϡʔ΋ؚΊ3िؒΛݟ͓ͯ͘ͷ͕٢(αʔόαΠυ͸ผ) • ಋೖલʹΨΠυϥΠϯਫ਼ಡ/ αϯϓϧΞϓϦ৮Δ • https://github.com/android-pay/androidpay-quickstart

    • https://codelabs.developers.google.com/codelabs/android- pay