Droidcon Paris: The new Android SDK
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Droidcon Paris: The new Android SDK

  • 1,683 views
Uploaded on

This speech was held by Tim Messerschmidt at Droidcon Paris 2013.

This speech was held by Tim Messerschmidt at Droidcon Paris 2013.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,683
On Slideshare
1,394
From Embeds
289
Number of Embeds
7

Actions

Shares
Downloads
6
Comments
0
Likes
2

Embeds 289

https://twitter.com 104
http://timmesserschmidt.com 75
http://fr.droidcon.com 74
http://localhost 19
http://www.wipconnector.com 9
http://eventifier.co 7
http://eventifier.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. PayPal’s New Android SDK:Kicking Ass With PaymentsTim MesserschmidtDroidcon Paris 2013
  • 2. This talk will be about-  What is PayPal?-  Log In with PayPal-  PayPal Android SDK
  • 3. Who Am I?Tim Messerschmidt,Developer Evangelistworking for PayPal.Android Developerliving in Berlin.I ♥ Java, Ruby, CSS3,HTML5 & JavaScript!
  • 4. What is PayPal?
  • 5. Enablemerchants tosell onlineWhat is PayPal?
  • 6. Enablecustomers tobuy onlineWhat is PayPal?
  • 7. Payment ScenarioSender ReceiverTransaction
  • 8. eCommerceSender ReceiverTransactionItem /Service
  • 9. SecureEasyFastRequirements
  • 10. 128mactive usersWhat is PayPal?
  • 11. 193countries & regionsWhat is PayPal?
  • 12. 25supported currenciesWhat is PayPal?
  • 13. 80localized websitesWhat is PayPal?
  • 14. Francefully supportedWhat is PayPal?
  • 15. Local MerchantsBig Mac Menu:-  Fries-  Ketchup-  Water... keeping it healthy
  • 16. Painless Payments for DroidsTim MesserschmidtIdentity
  • 17. Login with...Google Facebook Twitter
  • 18. ... or PayPal.Login with...
  • 19. NameEmailDate of BirthLocaleTime ZoneAddressGenderLanguagePhone NumberVerified AccountCreation DateYour Identity
  • 20. Log In viaPayPal in thebrowser or aWebView.
  • 21. Log In with PayPalAuthorization &Authentication
  • 22. Log In with PayPalOAuth 2.0 &OpenID Connect
  • 23. No need to (re-)enteryour password afterlogging inSeamless Checkout
  • 24. Painless Payments for DroidsTim MesserschmidtSummarizing Identity
  • 25. Painless Payments for DroidsTim MesserschmidtMoney
  • 26. Lots Of Money
  • 27. Painless Payments for DroidsTim MesserschmidtDigital Goods
  • 28. Physical Goods
  • 29. Physical Goods
  • 30. 2 waysBackend or via SDKUsing PayPal
  • 31. Android SDKSample App:•  Sell a football jersey•  Fast Checkout•  Nice Interface
  • 32. Present theproduct & allowto purchase itAndroid SDK
  • 33. Allow to pay viaPayPal or CardAndroid SDK
  • 34. The user entershis credentials:•  Email•  PasswordAndroid SDK
  • 35. The user needsto confirm hispayment...Android SDK
  • 36. ... and will bepresented aconfirmation ofhis purchaseafterwards.Android SDK
  • 37. That’s nice... BUT:What if the userdoesn’t want to usePayPal or doesn’thave an account?
  • 38. Accept creditcards in yourapplicationmanually or...Android SDK
  • 39. ... via imagerecognitiontechnology inyour app!Android SDK
  • 40. ImplementationIn 10 minutesHow-to
  • 41. <!-- Hardware features --><uses-featureandroid:name="android.hardware.camera”android:required="false" /><uses-featureandroid:name="android.hardware.camera.autofocus”android:required="false" /><!–- Permissions --><uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE" /><uses-permissionandroid:name="android.permission.INTERNET" /><!-- card.io scanning --><uses-permissionandroid:name="android.permission.CAMERA" /><uses-permissionandroid:name="android.permission.VIBRATE" />How-toAndroidManifest.xml:
  • 42. <!-- Hardware features --><uses-featureandroid:name="android.hardware.camera”android:required="false" /><uses-featureandroid:name="android.hardware.camera.autofocus”android:required="false" /><!–- Permissions --><uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE" /><uses-permissionandroid:name="android.permission.INTERNET" /><!-- card.io scanning --><uses-permissionandroid:name="android.permission.CAMERA" /><uses-permissionandroid:name="android.permission.VIBRATE" />How-toAndroidManifest.xml:
  • 43. <!-- Hardware features --><uses-featureandroid:name="android.hardware.camera”android:required="false" /><uses-featureandroid:name="android.hardware.camera.autofocus”android:required="false" /><!–- Permissions --><uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE" /><uses-permissionandroid:name="android.permission.INTERNET" /><!-- card.io scanning --><uses-permissionandroid:name="android.permission.CAMERA" /><uses-permissionandroid:name="android.permission.VIBRATE" />How-toAndroidManifest.xml:
  • 44. <!-- Hardware features --><uses-featureandroid:name="android.hardware.camera”android:required="false" /><uses-featureandroid:name="android.hardware.camera.autofocus”android:required="false" /><!–- Permissions --><uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE" /><uses-permissionandroid:name="android.permission.INTERNET" /><!-- card.io scanning --><uses-permissionandroid:name="android.permission.CAMERA" /><uses-permissionandroid:name="android.permission.VIBRATE" />How-toAndroidManifest.xml:
  • 45. <serviceandroid:name="com.paypal.android.sdk.payments.PayPalService"android:exported="false"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentActivity"/><activityandroid:name="com.paypal.android.sdk.payments.LoginActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentMethodActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentCompletedActivity"/><activityandroid:name="io.card.payment.CardIOActivity"android:configChanges="keyboardHidden|orientation"/><activityandroid:name="io.card.payment.DataEntryActivity"/>How-toAndroidManifest.xml:
  • 46. <serviceandroid:name="com.paypal.android.sdk.payments.PayPalService"android:exported="false"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentActivity"/><activityandroid:name="com.paypal.android.sdk.payments.LoginActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentMethodActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentCompletedActivity"/><activityandroid:name="io.card.payment.CardIOActivity"android:configChanges="keyboardHidden|orientation"/><activityandroid:name="io.card.payment.DataEntryActivity"/>How-toAndroidManifest.xml:
  • 47. <serviceandroid:name="com.paypal.android.sdk.payments.PayPalService"android:exported="false"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentActivity"/><activityandroid:name="com.paypal.android.sdk.payments.LoginActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentMethodActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"/><activityandroid:name="com.paypal.android.sdk.payments.PaymentCompletedActivity"/><activityandroid:name="io.card.payment.CardIOActivity"android:configChanges="keyboardHidden|orientation"/><activityandroid:name="io.card.payment.DataEntryActivity"/>How-toAndroidManifest.xml:
  • 48. // Can be NO_NETWORK for OFFLINE, SANDBOX for TESTING and LIVE for PRODUCTIONprivate static final String CONFIG_ENVIRONMENT =PaymentActivity.ENVIRONMENT_NO_NETWORK;// note that these credentials will differ between live & sandbox environments.private static final String CONFIG_CLIENT_ID ="credential from developer.paypal.com";// when testing in sandbox, this is likely the -facilitator email address.private static final String CONFIG_RECEIVER_EMAIL ="your@email.com";How-toYour Activity:Define your credentials and Environment first.
  • 49. // Can be NO_NETWORK for OFFLINE, SANDBOX for TESTING and LIVE for PRODUCTIONprivate static final String CONFIG_ENVIRONMENT =PaymentActivity.ENVIRONMENT_NO_NETWORK;// note that these credentials will differ between live & sandbox environments.private static final String CONFIG_CLIENT_ID ="credential from developer.paypal.com";// when testing in sandbox, this is likely the -facilitator email address.private static final String CONFIG_RECEIVER_EMAIL ="your@email.com";How-toYour Activity:Define your credentials and Environment first.
  • 50. // Can be NO_NETWORK for OFFLINE, SANDBOX for TESTING and LIVE for PRODUCTIONprivate static final String CONFIG_ENVIRONMENT =PaymentActivity.ENVIRONMENT_NO_NETWORK;// note that these credentials will differ between live & sandbox environments.private static final String CONFIG_CLIENT_ID ="credential from developer.paypal.com";// when testing in sandbox, this is likely the -facilitator email address.private static final String CONFIG_RECEIVER_EMAIL ="your@email.com";How-toYour Activity:Define your credentials and Environment first.
  • 51. // Can be NO_NETWORK for OFFLINE, SANDBOX for TESTING and LIVE for PRODUCTIONprivate static final String CONFIG_ENVIRONMENT =PaymentActivity.ENVIRONMENT_NO_NETWORK;// note that these credentials will differ between live & sandbox environments.private static final String CONFIG_CLIENT_ID ="credential from developer.paypal.com";// when testing in sandbox, this is likely the -facilitator email address.private static final String CONFIG_RECEIVER_EMAIL ="your@email.com";How-toYour Activity:Define your credentials and Environment first.
  • 52. @Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);// your code hereIntent intent = new Intent(this, PayPalService.class);intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);startService(intent);}How-toYour Activity:Start the PayPal-Service in your onCreate( ) method
  • 53. @Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);// your code hereIntent intent = new Intent(this, PayPalService.class);intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);startService(intent);}How-toYour Activity:Start the PayPal-Service in your onCreate( ) method
  • 54. PayPalPayment thingToBuy =new PayPalPayment(new BigDecimal(“59.99"), "USD", "Paris SG Jersey");Intent intent = new Intent(this, PaymentActivity.class);intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "myPayer");// Repeat passing the credentialsintent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);startActivityForResult(intent, PAYMENT_REQUEST);How-toYour Activity:Start the payment itself via a button or something similar
  • 55. PayPalPayment thingToBuy =new PayPalPayment(new BigDecimal(“59.99"), "USD", "Paris SG Jersey");Intent intent = new Intent(this, PaymentActivity.class);intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "myPayer");// Repeat passing the credentialsintent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);startActivityForResult(intent, PAYMENT_REQUEST);How-toYour Activity:Start the payment itself via a button or something similar
  • 56. PayPalPayment thingToBuy =new PayPalPayment(new BigDecimal(“59.99"), "USD", "Paris SG Jersey");Intent intent = new Intent(this, PaymentActivity.class);intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "myPayer");// Repeat passing the credentialsintent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);startActivityForResult(intent, PAYMENT_REQUEST);How-toYour Activity:Start the payment itself via a button or something similar
  • 57. PayPalPayment thingToBuy =new PayPalPayment(new BigDecimal(“59.99"), "USD", "Paris SG Jersey");Intent intent = new Intent(this, PaymentActivity.class);intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "myPayer");// Repeat passing the credentialsintent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);startActivityForResult(intent, PAYMENT_REQUEST);How-toYour Activity:Start the payment itself via a button or something similar
  • 58. PayPalPayment thingToBuy =new PayPalPayment(new BigDecimal(“59.99"), "USD", "Paris SG Jersey");Intent intent = new Intent(this, PaymentActivity.class);intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "myPayer");// Repeat passing the credentialsintent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);startActivityForResult(intent, PAYMENT_REQUEST);How-toYour Activity:Start the payment itself via a button or something similar
  • 59. @Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {if (resultCode == Activity.RESULT_OK) {PaymentConfirmation confirm =data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);if (confirm != null) {verifyPayment(confirm);}} else if (resultCode == Activity.RESULT_CANCELED) {// Show the user that this got canceled} else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {// Check the docs ;)}}How-toYour Activity:Check the result after the user used PayPal
  • 60. @Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {if (resultCode == Activity.RESULT_OK) {PaymentConfirmation confirm =data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);if (confirm != null) {verifyPayment(confirm);}} else if (resultCode == Activity.RESULT_CANCELED) {// Show the user that this got canceled} else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {// Check the docs ;)}}How-toYour Activity:Check the result after the user used PayPal
  • 61. @Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {if (resultCode == Activity.RESULT_OK) {PaymentConfirmation confirm =data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);if (confirm != null) {verifyPayment(confirm);}} else if (resultCode == Activity.RESULT_CANCELED) {// Show the user that this got canceled} else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {// Check the docs ;)}}How-toYour Activity:Check the result after the user used PayPal
  • 62. @Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {if (resultCode == Activity.RESULT_OK) {PaymentConfirmation confirm =data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);if (confirm != null) {verifyPayment(confirm);}} else if (resultCode == Activity.RESULT_CANCELED) {// Show the user that this got canceled} else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {// Check the docs ;)}}How-toYour Activity:Check the result after the user used PayPal
  • 63. @Overridepublic void onDestroy() {stopService(new Intent(this, PayPalService.class));super.onDestroy();}How-toYour Activity:Stop your service in the lifecycle’s onDestroy( ) method to make sure it ends nicelyand doesn’t use unneeded resources.
  • 64. Your app needs tocommunicate witha server to verifypaymentsVerifying Payments
  • 65. Criteria to use toverify payments:bit.ly/19FIis6Verifying Payments
  • 66. {"proof_of_payment": {"rest_api": {"state": "approved","payment_id": "API-PAYMENT-ID-1843"}},"payment": {"short_description": "Paris SG Jersey","amount": ”59.99","currency_code": "USD"},"client": {"platform": "Android","paypal_sdk_version": "1.0.2","environment": "live","product_name": "PayPal Android SDK"}}Verifying PaymentsREST-API proof of payment: Adaptive Payments proof of payment:{"proof_of_payment": {"adaptive_payment": {"pay_key": "AP-70M68096ML426802W","payment_exec_status": "COMPLETED","timestamp": "2013-02-20T00:26:25Z","app_id": "APP-91B933855X481767M"}},"payment": {"short_description": "Paris SG Shirt","amount": "59.99","currency_code": "USD"},"client": {"platform": "Android","paypal_sdk_version": "1.0.2","environment": "live","product_name": "PayPal Android SDK"}}
  • 67. {"proof_of_payment": {"rest_api": {"state": "approved","payment_id": "API-PAYMENT-ID-1843"}},"payment": {"short_description": "Paris SG Jersey","amount": ”59.99","currency_code": "USD"},"client": {"platform": "Android","paypal_sdk_version": "1.0.2","environment": "live","product_name": "PayPal Android SDK"}}Verifying PaymentsREST-API proof of payment: Adaptive Payments proof of payment:{"proof_of_payment": {"adaptive_payment": {"pay_key": "AP-70M68096ML426802W","payment_exec_status": "COMPLETED","timestamp": "2013-02-20T00:26:25Z","app_id": "APP-91B933855X481767M"}},"payment": {"short_description": "Paris SG Shirt","amount": "59.99","currency_code": "USD"},"client": {"platform": "Android","paypal_sdk_version": "1.0.2","environment": "live","product_name": "PayPal Android SDK"}}
  • 68. Somebody did thatwork for you:bit.ly/19FHQdeVerifying Payments
  • 69. Android StudioGradle doesn’tsupportbundling .sofiles with yourapk yet
  • 70. US onlyEurope coming soon!Important
  • 71. Documentationdeveloper.paypal.comInformation
  • 72. Open SourceGitHub.com/paypalInformation
  • 73. Questions?
  • 74. Thanks!Tim Messerschmidt@SeraAndroidtmesserschmidt@paypal.comSlideShare.com/paypal