SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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 Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010Social Gold in-Flash Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010Social Gold
 
Social Gold In-Flash Payments Webinar
Social Gold In-Flash Payments WebinarSocial Gold In-Flash Payments Webinar
Social Gold In-Flash Payments WebinarSocial 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
 

Similaire à 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 Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010Social Gold in-Flash Webinar Jan 2010
Social Gold in-Flash Webinar Jan 2010
 
Social Gold In-Flash Payments Webinar
Social Gold In-Flash Payments WebinarSocial Gold In-Flash Payments Webinar
Social Gold In-Flash Payments Webinar
 
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
 

Plus de 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
 

Plus de 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
 

Dernier

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
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
 
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
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Dernier (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
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
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

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

Notes de l'éditeur

  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