SlideShare ist ein Scribd-Unternehmen logo
1 von 39
In-App Payments with HTML5
  Building Scalable Game Payment Systems




                             Jonathan LeBlanc
                  Developer Evangelist (PayPal)
                          jleblanc@paypal.com
                             Twitter: @jcleblanc
                   Github: github.com/jcleblanc
Background

             Developer Evangelist with
             PayPal and eBay


             Author of Programming
             Social Applications


             Emmy award winner for
             Outstanding Achievement in
             Advanced Media Technology
What are we going to talk about




   HTML5 Toolkit     Payments
What are we not going to talk about




           Physical Goods
Demo - JSWars

      http://29a.ch/jswars/
Session Breakdown

        The Architecture


        The Implementation


        The Product Webhooks
Session Breakdown

        The Architecture


        The Implementation


        The Product Webhooks
The Players in our Little Game

    Client & Server-Side Components

    PayPal Digital Goods (Express Checkout)

    HTML5 LocalStorage

    jQuery
Client / Server Side Components

  Client Components




  Server-Side Components
How Digital Goods Work

          Fetch the token

          Display login lightbox

          Commit the payment

          Verify the payment
Fetching Identity Information




    Client Identity    PayPal
        Server         Identity
                       Server
Getting the Token and Lightbox

                   Client Requests
                   Payment Token


                   PayPal Returns
                   Token


                   Payment Lightbox
                   Displayed to User
Fetching Inventory Information

                       Within the
                       Application




                       From Client
                       Inventory Store
Committing the Payment

                   Client Approves
                   Transaction


                   PayPal Returns
                   Transaction Data


                   Client Activates
                   Success State
Storing Data

               Store Identity
               Information




               Store Transaction
               Information
Verifying the Purchase


              Client Makes Verification
              Call to PayPal




              PayPal Returns
              Purchase Data for User
Fetching LocalStorage Purchases


                     Local Storage




                     Client Inventory
                     System
Session Breakdown

        The Architecture


        The Implementation


        The Product Webhooks
The Project Code Base

 https://github.com/paypal/html5-dg
File Architecture
index.html: Sample integration

client/pptransact.js: Core front-end

server/[LANG]/cancel.[EXT]: Display when user cancels

server/[LANG]/common.[EXT]: Common functions and
variables.

server/[LANG]/identity.[EXT]: Client identity hooks

server/[LANG]/inventory.[EXT]: Client inventory hooks

server/[LANG]/success.[EXT]: Display on payment success

server/[LANG]/pptransact.[EXT]: Server-side controller
Setup Sandbox User Accounts

   https://developer.paypal.com/
Library & Toolkit Setup

               Attach the script includes


<script src="https://www.paypalobjects.com/js/
   external/dg.js"></script>

<script src="client/jquery-min.js"
   type="text/javascript"></script>

<script src="client/pptransact.js"></script>
Picking the Server-Side Language

       Pick Language and Mobile Support



 pptransact.init('py', true);   //mobile
 pptransact.init('java');          //non-mobile
Creating a Billing Handler

    pptransact.bill({
        userId:'[USER ID]',
        itemId:'[ITEM ID]',
        itemQty:'[ITEM QUANTITY]',
        successCallback: function(data){
           //bill success
        },
        failCallback: function(data){
           //bill cancelled
        }
    });
How the Billing Flow Works
                    Bill
                                  Digital
                                  Goods
               Success / Fail

     Billing
                                 Product
    Request
               Store Details     Storage

                                  User
                Notify User
                                Notification
Creating a Verification Handler

    pptransact.verify({
        userId:'[USER ID]',
        itemId:'[ITEM ID]',
        successCallback: function(data){
           //verify success
        },
        failCallback: function(data){
           //verify failed
        }
    });
How the Verification Flow Works
                  Get Data
                                        Product
                                        Storage
                      Success / Fail

                  Verify Purchase
   Verification                          Digital
    Request                              Goods
                      Success / Fail



                                         User
                  Notify User
                                       Notification
Session Breakdown

        The Architecture


        The Implementation


        The Product Webhooks
Identity and Payment Hooks




 Client Identity        PayPal Identity
     Server                Server
Identity: verifyUser


 function verifyUser($userId = 0){
   $YourSessionUserId = '888888';

     $returnVal =
       ($userId == $YourSessionUserId)
       ? true : false;

     return $returnVal;
 }
Identity: getUserId



       function getUserId(){
         $result = "888888";
         return $result;
       }
Payment: recordPayment


 function recordPayment($paymentObj = ""){
   $userId = $paymentObj["userId"];
   $itemId = $paymentObj["itemId"];
   $transactionId = $paymentObj["transactionId"];
   $paymentStatus = $paymentObj["paymentStatus"];
   $orderTime = $paymentObj["orderTime"];

     //INSERT YOUR CODE TO SAVE THE PAYMENT DATA
 }
Payment: verifyPayment



 function verifyPayment($userId = 0, $itemId = 0){
   $result = false;

     //INSERT YOUR CODE TO QUERY PAYMENT DATA AND
     //RETURN TRUE if MATCH FOUND

     return $result;
 }
Payment: getPayment

function getPayment($userId = 0, $itemId = 0){
  //INSERT CODE TO QUERY AND RETURN PAYMENT STRUCTURE

    $returnObj = array("success" => true,
               "error" => "",
               "transactionId" => "12345678",
               "orderTime" => "2011-09-29T04:47:51Z",
               "paymentStatus" => "Pending",
               "itemId" => "123",
               "userId" => "888888");

    return $returnObj;
}
Inventory Management Hooks




 Client Inventory     PayPal Digital
      Server             Goods
                        Payment
Inventory: getItem
     function getItem($itemId){
       $items = array(
          array(name => "Mega Shields",
                number => "123",
                qty => "1",
                taxamt => "0",
                amt => "1.00",
                desc => "Unlock the power!",
                category => "Digital"),
          ...);

         $returnObj = array();
         for ($i = 0; $i < count($items); $i++){
           if ($items[$i]['number'] == $itemId){
               $returnObj = $items[$i];
           }
         }

         return $returnObj;
     }
Is the Toolkit Right for You?

            HTML5 Support?



            Need to Accept Payments?



            Accepting Digital Goods?
A Few Links

   The HTML5 Toolkit
   https://github.com/paypal/html5-dg

   The PayPal Sandbox (Create Test Users)
   https://developer.paypal.com/

   JSWars Code and Demo
   http://29a.ch/jswars/
Thank You! Any Questions?
        http://www.slideshare.net/jcleblanc




                             Jonathan LeBlanc
                  Developer Evangelist (PayPal)
                          jleblanc@paypal.com
                             Twitter: @jcleblanc
                   Github: github.com/jcleblanc

Weitere ähnliche Inhalte

Was ist angesagt?

Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesMichael Galpin
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...tdc-globalcode
 
Create a res tful services api in php.
Create a res tful services api in php.Create a res tful services api in php.
Create a res tful services api in php.Adeoye Akintola
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Joao Lucas Santana
 
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsRobert Nyman
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchJames Pearce
 
Error Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingError Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingSteve Maraspin
 
SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsScott Gardner
 
Implementing access control with zend framework
Implementing access control with zend frameworkImplementing access control with zend framework
Implementing access control with zend frameworkGeorge Mihailov
 
Tealeaf: Creating Smarter Systems using Tealeaf 8 Advanced Eventing
Tealeaf: Creating Smarter Systems using Tealeaf 8 Advanced EventingTealeaf: Creating Smarter Systems using Tealeaf 8 Advanced Eventing
Tealeaf: Creating Smarter Systems using Tealeaf 8 Advanced Eventingvernonwyatt
 
A Journey with React
A Journey with ReactA Journey with React
A Journey with ReactFITC
 
A mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesA mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesJames Pearce
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 

Was ist angesagt? (20)

Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and Smartphones
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
 
Create a res tful services api in php.
Create a res tful services api in php.Create a res tful services api in php.
Create a res tful services api in php.
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)
 
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.js
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
 
FuncUnit
FuncUnitFuncUnit
FuncUnit
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
 
Error Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingError Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, logging
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the Things
 
Implementing access control with zend framework
Implementing access control with zend frameworkImplementing access control with zend framework
Implementing access control with zend framework
 
Tealeaf: Creating Smarter Systems using Tealeaf 8 Advanced Eventing
Tealeaf: Creating Smarter Systems using Tealeaf 8 Advanced EventingTealeaf: Creating Smarter Systems using Tealeaf 8 Advanced Eventing
Tealeaf: Creating Smarter Systems using Tealeaf 8 Advanced Eventing
 
A Journey with React
A Journey with ReactA Journey with React
A Journey with React
 
Pyramid REST
Pyramid RESTPyramid REST
Pyramid REST
 
A mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesA mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutes
 
前端概述
前端概述前端概述
前端概述
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
 

Ähnlich wie 2012 SVCodeCamp: In App Payments with HTML5

HTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsHTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsJonathan LeBlanc
 
Barcelona Developers Conference 2011
Barcelona Developers Conference 2011Barcelona Developers Conference 2011
Barcelona Developers Conference 2011PayPal
 
java and javascript api dev guide
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guideZenita Smythe
 
Droidcon DE 2013
Droidcon DE 2013Droidcon DE 2013
Droidcon DE 2013PayPal
 
"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita GalkinFwdays
 
Social Gold In-Flash Payments Webinar
Social Gold In-Flash Payments WebinarSocial Gold In-Flash Payments Webinar
Social Gold In-Flash Payments WebinarSocial Gold
 
Social Gold in-Flash Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010Social Gold in-Flash Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010Social Gold
 
Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Yoshi Sakai
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsMichelangelo van Dam
 
PayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving BusinessPayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving BusinessAduci
 
AdVenture Capitalist Post-Mortem
AdVenture Capitalist Post-MortemAdVenture Capitalist Post-Mortem
AdVenture Capitalist Post-MortemPlayFab, Inc.
 
One Gateway for All Kinds of Payments—the Payflow Integration
One Gateway for All Kinds of Payments—the Payflow IntegrationOne Gateway for All Kinds of Payments—the Payflow Integration
One Gateway for All Kinds of Payments—the Payflow IntegrationPayPalX Developer Network
 
Authentication
AuthenticationAuthentication
Authenticationsoon
 
Dont call me cache java version
Dont call me cache java versionDont call me cache java version
Dont call me cache java versionAvisi B.V.
 
Active Merchant
Active MerchantActive Merchant
Active MerchantJohn Ward
 
Long running processes in DDD
Long running processes in DDDLong running processes in DDD
Long running processes in DDDBernd Ruecker
 
Monetize with PayPal X Payments Platform
Monetize with PayPal X Payments PlatformMonetize with PayPal X Payments Platform
Monetize with PayPal X Payments Platformguest72b121
 
How to Build an Indivo X Personal Health App
How to Build an Indivo X Personal Health AppHow to Build an Indivo X Personal Health App
How to Build an Indivo X Personal Health AppBen Adida
 

Ähnlich wie 2012 SVCodeCamp: In App Payments with HTML5 (20)

HTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsHTML5 Gaming Payment Platforms
HTML5 Gaming Payment Platforms
 
Hacking with PayPal
Hacking with PayPalHacking with PayPal
Hacking with PayPal
 
Barcelona Developers Conference 2011
Barcelona Developers Conference 2011Barcelona Developers Conference 2011
Barcelona Developers Conference 2011
 
java and javascript api dev guide
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guide
 
Droidcon DE 2013
Droidcon DE 2013Droidcon DE 2013
Droidcon DE 2013
 
"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin
 
Social Gold In-Flash Payments Webinar
Social Gold In-Flash Payments WebinarSocial Gold In-Flash Payments Webinar
Social Gold In-Flash Payments Webinar
 
Social Gold in-Flash Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010Social Gold in-Flash Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010
 
Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
 
PayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving BusinessPayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving Business
 
AdVenture Capitalist Post-Mortem
AdVenture Capitalist Post-MortemAdVenture Capitalist Post-Mortem
AdVenture Capitalist Post-Mortem
 
One Gateway for All Kinds of Payments—the Payflow Integration
One Gateway for All Kinds of Payments—the Payflow IntegrationOne Gateway for All Kinds of Payments—the Payflow Integration
One Gateway for All Kinds of Payments—the Payflow Integration
 
Authentication
AuthenticationAuthentication
Authentication
 
Dont call me cache java version
Dont call me cache java versionDont call me cache java version
Dont call me cache java version
 
Active Merchant
Active MerchantActive Merchant
Active Merchant
 
Long running processes in DDD
Long running processes in DDDLong running processes in DDD
Long running processes in DDD
 
Monetize with PayPal X Payments Platform
Monetize with PayPal X Payments PlatformMonetize with PayPal X Payments Platform
Monetize with PayPal X Payments Platform
 
Payment Gateway
Payment GatewayPayment Gateway
Payment Gateway
 
How to Build an Indivo X Personal Health App
How to Build an Indivo X Personal Health AppHow to Build an Indivo X Personal Health App
How to Build an Indivo X Personal Health App
 

Mehr von Jonathan LeBlanc

JavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the ClientJavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the ClientJonathan LeBlanc
 
Improving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data InsightsImproving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data InsightsJonathan LeBlanc
 
Better Data with Machine Learning and Serverless
Better Data with Machine Learning and ServerlessBetter Data with Machine Learning and Serverless
Better Data with Machine Learning and ServerlessJonathan LeBlanc
 
Best Practices for Application Development with Box
Best Practices for Application Development with BoxBest Practices for Application Development with Box
Best Practices for Application Development with BoxJonathan LeBlanc
 
Box Platform Developer Workshop
Box Platform Developer WorkshopBox Platform Developer Workshop
Box Platform Developer WorkshopJonathan LeBlanc
 
Modern Cloud Data Security Practices
Modern Cloud Data Security PracticesModern Cloud Data Security Practices
Modern Cloud Data Security PracticesJonathan LeBlanc
 
Understanding Box UI Elements
Understanding Box UI ElementsUnderstanding Box UI Elements
Understanding Box UI ElementsJonathan LeBlanc
 
Understanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scopingUnderstanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scopingJonathan LeBlanc
 
The Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments GloballyThe Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments GloballyJonathan LeBlanc
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensJonathan LeBlanc
 
Creating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from ScratchCreating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from ScratchJonathan LeBlanc
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaJonathan LeBlanc
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsJonathan LeBlanc
 
Node.js Authentication and Data Security
Node.js Authentication and Data SecurityNode.js Authentication and Data Security
Node.js Authentication and Data SecurityJonathan LeBlanc
 
PHP Identity and Data Security
PHP Identity and Data SecurityPHP Identity and Data Security
PHP Identity and Data SecurityJonathan LeBlanc
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaJonathan LeBlanc
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsJonathan LeBlanc
 
Future of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable SecurityFuture of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable SecurityJonathan LeBlanc
 

Mehr von Jonathan LeBlanc (20)

JavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the ClientJavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the Client
 
Improving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data InsightsImproving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data Insights
 
Better Data with Machine Learning and Serverless
Better Data with Machine Learning and ServerlessBetter Data with Machine Learning and Serverless
Better Data with Machine Learning and Serverless
 
Best Practices for Application Development with Box
Best Practices for Application Development with BoxBest Practices for Application Development with Box
Best Practices for Application Development with Box
 
Box Platform Overview
Box Platform OverviewBox Platform Overview
Box Platform Overview
 
Box Platform Developer Workshop
Box Platform Developer WorkshopBox Platform Developer Workshop
Box Platform Developer Workshop
 
Modern Cloud Data Security Practices
Modern Cloud Data Security PracticesModern Cloud Data Security Practices
Modern Cloud Data Security Practices
 
Box Authentication Types
Box Authentication TypesBox Authentication Types
Box Authentication Types
 
Understanding Box UI Elements
Understanding Box UI ElementsUnderstanding Box UI Elements
Understanding Box UI Elements
 
Understanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scopingUnderstanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scoping
 
The Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments GloballyThe Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments Globally
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web Tokens
 
Creating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from ScratchCreating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from Scratch
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication Media
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile Payments
 
Node.js Authentication and Data Security
Node.js Authentication and Data SecurityNode.js Authentication and Data Security
Node.js Authentication and Data Security
 
PHP Identity and Data Security
PHP Identity and Data SecurityPHP Identity and Data Security
PHP Identity and Data Security
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication Media
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile Payments
 
Future of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable SecurityFuture of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable Security
 

Kürzlich hochgeladen

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 

Kürzlich hochgeladen (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 

2012 SVCodeCamp: In App Payments with HTML5

  • 1. In-App Payments with HTML5 Building Scalable Game Payment Systems Jonathan LeBlanc Developer Evangelist (PayPal) jleblanc@paypal.com Twitter: @jcleblanc Github: github.com/jcleblanc
  • 2. Background Developer Evangelist with PayPal and eBay Author of Programming Social Applications Emmy award winner for Outstanding Achievement in Advanced Media Technology
  • 3. What are we going to talk about HTML5 Toolkit Payments
  • 4. What are we not going to talk about Physical Goods
  • 5. Demo - JSWars http://29a.ch/jswars/
  • 6. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 7. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 8. The Players in our Little Game Client & Server-Side Components PayPal Digital Goods (Express Checkout) HTML5 LocalStorage jQuery
  • 9. Client / Server Side Components Client Components Server-Side Components
  • 10. How Digital Goods Work Fetch the token Display login lightbox Commit the payment Verify the payment
  • 11. Fetching Identity Information Client Identity PayPal Server Identity Server
  • 12. Getting the Token and Lightbox Client Requests Payment Token PayPal Returns Token Payment Lightbox Displayed to User
  • 13. Fetching Inventory Information Within the Application From Client Inventory Store
  • 14. Committing the Payment Client Approves Transaction PayPal Returns Transaction Data Client Activates Success State
  • 15. Storing Data Store Identity Information Store Transaction Information
  • 16. Verifying the Purchase Client Makes Verification Call to PayPal PayPal Returns Purchase Data for User
  • 17. Fetching LocalStorage Purchases Local Storage Client Inventory System
  • 18. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 19. The Project Code Base https://github.com/paypal/html5-dg
  • 20. File Architecture index.html: Sample integration client/pptransact.js: Core front-end server/[LANG]/cancel.[EXT]: Display when user cancels server/[LANG]/common.[EXT]: Common functions and variables. server/[LANG]/identity.[EXT]: Client identity hooks server/[LANG]/inventory.[EXT]: Client inventory hooks server/[LANG]/success.[EXT]: Display on payment success server/[LANG]/pptransact.[EXT]: Server-side controller
  • 21. Setup Sandbox User Accounts https://developer.paypal.com/
  • 22. Library & Toolkit Setup Attach the script includes <script src="https://www.paypalobjects.com/js/ external/dg.js"></script> <script src="client/jquery-min.js" type="text/javascript"></script> <script src="client/pptransact.js"></script>
  • 23. Picking the Server-Side Language Pick Language and Mobile Support pptransact.init('py', true); //mobile pptransact.init('java'); //non-mobile
  • 24. Creating a Billing Handler pptransact.bill({ userId:'[USER ID]', itemId:'[ITEM ID]', itemQty:'[ITEM QUANTITY]', successCallback: function(data){ //bill success }, failCallback: function(data){ //bill cancelled } });
  • 25. How the Billing Flow Works Bill Digital Goods Success / Fail Billing Product Request Store Details Storage User Notify User Notification
  • 26. Creating a Verification Handler pptransact.verify({ userId:'[USER ID]', itemId:'[ITEM ID]', successCallback: function(data){ //verify success }, failCallback: function(data){ //verify failed } });
  • 27. How the Verification Flow Works Get Data Product Storage Success / Fail Verify Purchase Verification Digital Request Goods Success / Fail User Notify User Notification
  • 28. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 29. Identity and Payment Hooks Client Identity PayPal Identity Server Server
  • 30. Identity: verifyUser function verifyUser($userId = 0){ $YourSessionUserId = '888888'; $returnVal = ($userId == $YourSessionUserId) ? true : false; return $returnVal; }
  • 31. Identity: getUserId function getUserId(){ $result = "888888"; return $result; }
  • 32. Payment: recordPayment function recordPayment($paymentObj = ""){ $userId = $paymentObj["userId"]; $itemId = $paymentObj["itemId"]; $transactionId = $paymentObj["transactionId"]; $paymentStatus = $paymentObj["paymentStatus"]; $orderTime = $paymentObj["orderTime"]; //INSERT YOUR CODE TO SAVE THE PAYMENT DATA }
  • 33. Payment: verifyPayment function verifyPayment($userId = 0, $itemId = 0){ $result = false; //INSERT YOUR CODE TO QUERY PAYMENT DATA AND //RETURN TRUE if MATCH FOUND return $result; }
  • 34. Payment: getPayment function getPayment($userId = 0, $itemId = 0){ //INSERT CODE TO QUERY AND RETURN PAYMENT STRUCTURE $returnObj = array("success" => true, "error" => "", "transactionId" => "12345678", "orderTime" => "2011-09-29T04:47:51Z", "paymentStatus" => "Pending", "itemId" => "123", "userId" => "888888"); return $returnObj; }
  • 35. Inventory Management Hooks Client Inventory PayPal Digital Server Goods Payment
  • 36. Inventory: getItem function getItem($itemId){ $items = array( array(name => "Mega Shields", number => "123", qty => "1", taxamt => "0", amt => "1.00", desc => "Unlock the power!", category => "Digital"), ...); $returnObj = array(); for ($i = 0; $i < count($items); $i++){ if ($items[$i]['number'] == $itemId){ $returnObj = $items[$i]; } } return $returnObj; }
  • 37. Is the Toolkit Right for You? HTML5 Support? Need to Accept Payments? Accepting Digital Goods?
  • 38. A Few Links The HTML5 Toolkit https://github.com/paypal/html5-dg The PayPal Sandbox (Create Test Users) https://developer.paypal.com/ JSWars Code and Demo http://29a.ch/jswars/
  • 39. Thank You! Any Questions? http://www.slideshare.net/jcleblanc Jonathan LeBlanc Developer Evangelist (PayPal) jleblanc@paypal.com Twitter: @jcleblanc Github: github.com/jcleblanc

Hinweis der Redaktion

  1. $0.01 USD - $3,000.00 USD2.9% + $0.30 USD (Standard Pricing)5% + $0.05 USD (MicropaymentsPricing)
  2. Identitywill come from one of two places, either as a hookinto the client ID server or fromPayPalitself
  3. If the user binding is not currently done, we store the information back to the client inventory storeStore inventory information into local storage