SlideShare a Scribd company logo
1 of 33
HTML5 Gaming Payment Platforms
     Building Scalable Game Payment Systems




                                Jonathan LeBlanc
                     Developer Evangelist (PayPal)
                             jleblanc@paypal.com
                                Twitter: @jcleblanc
                      Github: github.com/jcleblanc
What are we going to talk about




   Cross Platform   Digital Payments
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
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
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>
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
Opening and Closing the Flow

Opening the Modal Window

   var dgflow = dg.startFlow(
     'https://www.sandbox.paypal.com/
     webscr?&useraction=commit&token=###');


Closing the Modal Window

   dgflow.closeFlow();
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;
     }
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

More Related Content

What's hot

Simplify AJAX using jQuery
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuery
Siva Arunachalam
 

What's hot (20)

Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application Development
 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015
 
AtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and Server
 
Going Offline with Gears And GWT
Going Offline with Gears And GWTGoing Offline with Gears And GWT
Going Offline with Gears And GWT
 
Agile and rails
Agile and railsAgile and rails
Agile and rails
 
Simplify AJAX using jQuery
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuery
 
Rego Deep Dive
Rego Deep DiveRego Deep Dive
Rego Deep Dive
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
 
Rohit&kunjan
Rohit&kunjanRohit&kunjan
Rohit&kunjan
 
An Overview of Models in Django
An Overview of Models in DjangoAn Overview of Models in Django
An Overview of Models in Django
 
Webdevelopment
WebdevelopmentWebdevelopment
Webdevelopment
 
Xml http request
Xml http requestXml http request
Xml http request
 
Everything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the WebEverything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the Web
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
Google App Engine with Gaelyk
Google App Engine with GaelykGoogle App Engine with Gaelyk
Google App Engine with Gaelyk
 
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDK
 
Ajax
AjaxAjax
Ajax
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 

Similar to HTML5 Gaming Payment Platforms

Barcelona Developers Conference 2011
Barcelona Developers Conference 2011Barcelona Developers Conference 2011
Barcelona Developers Conference 2011
PayPal
 
java and javascript api dev guide
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guide
Zenita Smythe
 
Authentication
AuthenticationAuthentication
Authentication
soon
 
7 client-state manipulation
7   client-state manipulation7   client-state manipulation
7 client-state manipulation
drewz lin
 

Similar to HTML5 Gaming Payment Platforms (20)

2012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML52012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML5
 
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
 
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
 
"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
 
Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )
 
Authentication
AuthenticationAuthentication
Authentication
 
Droidcon DE 2013
Droidcon DE 2013Droidcon DE 2013
Droidcon DE 2013
 
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
 
Dont call me cache java version
Dont call me cache java versionDont call me cache java version
Dont call me cache java version
 
AdVenture Capitalist Post-Mortem
AdVenture Capitalist Post-MortemAdVenture Capitalist Post-Mortem
AdVenture Capitalist Post-Mortem
 
Smart Lock for Password @ Game DevFest Bangkok 2015
Smart Lock for Password @ Game DevFest Bangkok 2015Smart Lock for Password @ Game DevFest Bangkok 2015
Smart Lock for Password @ Game DevFest Bangkok 2015
 
PayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving BusinessPayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving Business
 
Long running processes in DDD
Long running processes in DDDLong running processes in DDD
Long running processes in DDD
 
Active Merchant
Active MerchantActive Merchant
Active Merchant
 
Payments On Rails
Payments On RailsPayments On Rails
Payments On Rails
 
7 client-state manipulation
7   client-state manipulation7   client-state manipulation
7 client-state manipulation
 
Webauthn Tutorial
Webauthn TutorialWebauthn Tutorial
Webauthn Tutorial
 

More from Jonathan LeBlanc

More from 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
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

HTML5 Gaming Payment Platforms

  • 1. HTML5 Gaming Payment Platforms Building Scalable Game Payment Systems Jonathan LeBlanc Developer Evangelist (PayPal) jleblanc@paypal.com Twitter: @jcleblanc Github: github.com/jcleblanc
  • 2. What are we going to talk about Cross Platform Digital Payments
  • 3. Demo - JSWars http://29a.ch/jswars/
  • 4. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 5. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 6. The Players in our Little Game Client & Server-Side Components PayPal Digital Goods (Express Checkout) HTML5 LocalStorage jQuery
  • 7. How Digital Goods Work Fetch the token Display login lightbox Commit the payment Verify the payment
  • 8. Fetching Identity Information Client Identity PayPal Server Identity Server
  • 9. Getting the Token and Lightbox Client Requests Payment Token PayPal Returns Token Payment Lightbox Displayed to User
  • 10. Fetching Inventory Information Within the Application From Client Inventory Store
  • 11. Committing the Payment Client Approves Transaction PayPal Returns Transaction Data Client Activates Success State
  • 12. Storing Data Store Identity Information Store Transaction Information
  • 13. Verifying the Purchase Client Makes Verification Call to PayPal PayPal Returns Purchase Data for User
  • 14. Fetching LocalStorage Purchases Local Storage Client Inventory System
  • 15. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 16. Setup Sandbox User Accounts https://developer.paypal.com/
  • 17. 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>
  • 18. 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 } });
  • 19. How the Billing Flow Works Bill Digital Goods Success / Fail Billing Product Request Store Details Storage User Notify User Notification
  • 20. Creating a Verification Handler pptransact.verify({ userId:'[USER ID]', itemId:'[ITEM ID]', successCallback: function(data){ //verify success }, failCallback: function(data){ //verify failed } });
  • 21. How the Verification Flow Works Get Data Product Storage Success / Fail Verify Purchase Verification Digital Request Goods Success / Fail User Notify User Notification
  • 22. Opening and Closing the Flow Opening the Modal Window var dgflow = dg.startFlow( 'https://www.sandbox.paypal.com/ webscr?&useraction=commit&token=###'); Closing the Modal Window dgflow.closeFlow();
  • 23. Session Breakdown The Architecture The Implementation The Product Webhooks
  • 24. Identity and Payment Hooks Client Identity PayPal Identity Server Server
  • 25. Identity: verifyUser function verifyUser($userId = 0){ $YourSessionUserId = '888888'; $returnVal = ($userId == $YourSessionUserId) ? true : false; return $returnVal; }
  • 26. Identity: getUserId function getUserId(){ $result = "888888"; return $result; }
  • 27. 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 }
  • 28. 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; }
  • 29. 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; }
  • 30. Inventory Management Hooks Client Inventory PayPal Digital Server Goods Payment
  • 31. 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; }
  • 32. 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/
  • 33. Thank You! Any Questions? http://www.slideshare.net/jcleblanc Jonathan LeBlanc Developer Evangelist (PayPal) jleblanc@paypal.com Twitter: @jcleblanc Github: github.com/jcleblanc

Editor's Notes

  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
  4. The URI for startFlow is comprised of static values (Sandbox / live URI &amp; useraction parameter) and a dynamic token. The token is generated by making a server side request, then a setExpressCheckout call. This server side call sets the value of the item, currency, success / fail URIs, etc. and generates a token to pop up the modal window.