Payments made easy on Force.com

3,642 views

Published on

Presentation from the Salesforce Developers meetup at Salesforce campus on April 1st - this presentation shows how the new PayPalX Toolkit makes payments easy in Salesforce. Force.com for PayPal X Payments Platform is a set of Apex classes for accessing the PayPal Adaptive Platform APIs. The toolkit is open source and available as a Code Share Project.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,642
On SlideShare
0
From Embeds
0
Number of Embeds
41
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Like what force.com is for Salesforce !
  • As a developer, the sender and receiver may have many different names, depending on their role and objective. PayPal X Open Payments Platform enables almost any of them.
  • The API Caller also needs a PayPal Business Account as the application is moving money between multiple parties and could possibly take it’s own cut/commission.
  • Before we talk more about the toolkit, classes and objects it provides, let’s first take a look at the APIs it supports.
  • Payments made easy on Force.com

    1. 1. Payments made Easy On Force.com<br />Praveen Alavilli<br />Developer Evangelist, PayPal<br />@ppalavilli<br />Salesforce Developer Meetup<br />4/1/2010<br />
    2. 2. What ?<br />A natural language processor that generates payments processing code based on human language<br />What languages we support ?<br />English<br />Spanish<br />French<br />Hindi<br />
    3. 3. Alright let’s get serious <br />
    4. 4. Agenda<br /><ul><li>What is PayPal X ?
    5. 5. Adaptive Payments API
    6. 6. Adaptive Accounts API
    7. 7. New APEX Toolkit
    8. 8. Installing and Using Toolkit
    9. 9. Code Samples
    10. 10. Going Live
    11. 11. Q & A</li></li></ul><li>PayPal X<br />Open Global Payments Platform for developers<br />(what Force.com is for Salesforce)<br />Enables various Monetization Models<br />Subscriptions<br />Pay as you use<br />Free to use, pay to services<br />Freemium<br />eCommerce<br />
    12. 12. The PayPal X Platform<br /><ul><li>Facilitates Payments</li></ul> - Pay anyone, receive from anyone !<br /><ul><li>Provides Account Management </li></ul> - Identity, Permissions, Accounts<br /><ul><li>Tools for Information and Reporting</li></ul> - Notifications, Reporting, Search<br />
    13. 13. Different kinds of Payments between<br />
    14. 14. PayPal<br />The Sender<br />A person or business whose PayPal account is being credited<br />A person or business whose PayPal account is being debited<br />C<br />The Receiver<br />The API CALLER<br />The API access account who makes the Adaptive Payments service calls: usually owned by the developer<br />Actors Involved<br />
    15. 15. APEX toolkit<br /><ul><li>A set of Apex classes for using APIs more easily
    16. 16. Supported APIs:
    17. 17. Adaptive Payments API
    18. 18. Adaptive Accounts API</li></li></ul><li>Adaptive Payments - API<br />USE CASES<br /><ul><li>Send money
    19. 19. Split payments
    20. 20. Bill payments
    21. 21. Payroll payments
    22. 22. B2B payments
    23. 23. Remittances
    24. 24. Marketplace payments
    25. 25. Virtual currencies
    26. 26. Points and miles
    27. 27. Mass payments
    28. 28. Invoice payments
    29. 29. Recurring payments
    30. 30. Scheduled payments
    31. 31. Money transfers
    32. 32. Mobile/device payments
    33. 33. Government travel
    34. 34. Future payment scenarios…
    35. 35. Payment APIs
    36. 36. Pay: Transfer funds between parties. Supports simple, chained, parallel, preapproved payments, etc.
    37. 37. PaymentDetails: Get details of a payment
    38. 38. Preapproval APIs
    39. 39. Preapproval: Preapproval agreement signup
    40. 40. PreapprovalDetails: Get details of a preapproval
    41. 41. CancelPreapproval: Cancel an existing preapproval
    42. 42. Refund: Refund a payment (complete, partial, etc.)
    43. 43. ConvertCurrency: Get currency conversion (foreign exchange) rates for a list of amounts and currencies (PayPal-supported currencies).</li></li></ul><li>Simple Send Money<br />Basic building block allows merchants to transfer money from one entity to another<br />Sample Use Cases: P2P payments, Social Networks, Gaming applications<br />
    44. 44. Preapproved Payments<br /><ul><li>Pre-authorization of money transfer from customer (sender) to API caller
    45. 45. Allows an API caller to make payments on behalf of a sender within the constraints specified
    46. 46. PIN optional for future payments made within the authorized amount
    47. 47. Useful for single/multi use, and subscription payments</li></ul>C<br />Pre Approval<br />Sample Use Cases: Pay as you use, Micropayments for Digital goods, Subscriptions<br />
    48. 48. Parallel Payments<br /><ul><li>Pay multiple recipients at once
    49. 49. Future interactions with each transaction can be separate
    50. 50. Enable partnership opportunities
    51. 51. Facilitates multiple use cases: marketplace payments, service fees, multi-merchant checkout, and so on</li></ul>$10<br />$100<br />Sender Visibility<br />$40<br />$50<br />Sample Use Cases: Payouts, Disbursements, Affiliate fees, MarketPlaces<br />
    52. 52. Chained Payments<br /><ul><li>Instant payment and disbursements</li></ul>Sender sees one payment to primary receiver<br />In one motion, money to secondary receivers sent<br /><ul><li>Supports commission-based payments
    53. 53. Facilitates multiple use cases: marketplace payments, service fees, multi-merchant checkout, and so on</li></ul>$100<br />$10<br />$40<br />Sender Visibility<br />Primary<br />$50<br />Sample Use Cases: Multi-Merchant Marketplaces, Gaming platform, Referral programs, Property Management (Rent Payments)<br />
    54. 54. Combine Parallel and Preapprovals<br />C<br />Primary<br />AND<br />Pre Approval<br />
    55. 55. Combine chained and Preapprovals<br />C<br />AND<br />Pre Approval<br />
    56. 56. Sample Interaction Flow<br />A Rental App that allows tenants to pay rent to a property management that splits the payment to the actual owner and the HOA.<br />
    57. 57. API<br />WEB<br />Sender<br />Rental App<br />Pay API<br />Pay Key<br />Redirect User to PayPal<br />Return URL<br />User Name = Rental_admin.api Secondary Receiver [2] = Sec Receiver_2@mail.com<br />Password = keep$secret Amount = 50.00<br />Signature = 23KJHO5AS09I32SDROR Tracking ID = 234235986<br />Sender Email = john_m@mail.com Cancel URL = www.PayRent.com/home<br />Currency = USD Return URL = www.PayRent.com/apstore<br />Primary Receiver [0] = Prim Receiver@mail.com<br />Amount = 1000.00<br />Secondary Receiver [1] = Sec Receiver_1@mail.com<br />Amount = 40.00 <br />Request<br />IPN= https://www.Rental.com/IPN<br />Sender Email: john_m@mail.com<br />Receiver Email: PrimReceiver@paypal.com<br />Pay Key = PA-84HK2A57FCOP3RW <br />Response<br />Notification<br />Confidential and Proprietary<br />18<br />Confidential and Proprietary<br />18<br />
    58. 58. Adaptive Accounts API<br /><ul><li>Programmatic interface to PayPal account creation
    59. 59. Account created can be used with any PayPal APIs, including Adaptive Payment APIs
    60. 60. Currently supports creation of Personal and Premier accounts. Business account creation to come soon.
    61. 61. Benefits:
    62. 62. Streamline user experience
    63. 63. Increase conversion</li></ul>19<br />
    64. 64. Create Account API Flow<br />Web<br />API<br />Application Caller<br />User<br />Offer<br />Account Creation Request<br />Consent<br />Creates an <br />inactive<br />account<br />URL Redirect<br /><ul><li>Choose password
    65. 65. Answer security questions</li></ul>Return URL<br />20<br />
    66. 66. Use cases for Adaptive Accounts<br />As part of new employee enrollment, business collects information used to create a PayPal account<br />Small Business<br />As part of the onboarding for a buyer and seller, a PayPal account can be created so that the user experience can be localized and personalized<br />Marketplace<br />Create PayPal accounts to enable payments for games, social networking widgets and more<br />Social Media<br />21<br />
    67. 67. PayPal Development Process<br />Submit for application review<br />Get API credentials<br />Go Live<br />Design and build application<br />Create Sandbox account<br />Get APP ID<br />Signup on<br />x.com<br />
    68. 68. APEX toolkit<br /><ul><li>A set of Apex classes for accessing APIs more easily
    69. 69. Takes care of transport and protocol bindings
    70. 70. Provides easy way to securely manage API Credentials and common request parameters
    71. 71. Supports both Adaptive Payments and Adaptive Accounts API
    72. 72. Supports PayPal Sandbox, Beta and Live environments
    73. 73. Test pages/Scratch Pad to play with all APIs</li></li></ul><li>Getting Started With Toolkit<br /><ul><li>Create PayPal Developer Account
    74. 74. Sign-up on X.com
    75. 75. Obtain ApplicationID from MyApps page
    76. 76. Create PayPal Sandbox Test Accounts
    77. 77. Sign-up on developer.paypal.com
    78. 78. Create test accounts (buyer/seller) for Sandbox
    79. 79. Obtain API Credentials
    80. 80. Install Toolkit
    81. 81. From CodeShare (package or source code)
    82. 82. Configure Toolkit
    83. 83. API Credentials (Certificate or Signature)
    84. 84. Common request parameters
    85. 85. Remote Site
    86. 86. Play with Test Tools</li></li></ul><li>API Credential Object<br />
    87. 87. Common Request Parameters<br />
    88. 88. Test Tools<br />
    89. 89. Using The Toolkit<br /><ul><li>Initialize Toolkit
    90. 90. PPAdaptiveToolkit object with the required API Credentials
    91. 91. PPAdaptiveToolkittoolkit = new PPAdaptiveToolkit('SandboxCert');
    92. 92. Create Request object
    93. 93. PPPayRequestpayRequest= new PPPayRequest('REQ-PARAMS1', SenderEmail);
    94. 94. payRequest.CancelUrl = 'https://' + host + '/PayApiTest?MainMessage=cancel';
    95. 95. payRequest.ReturnUrl = 'https://' + host + '/PayDetailTest?payKey=${payKey}';
    96. 96. Execute the API call
    97. 97. PPPayResponsepayResponse= toolkit.Pay(payRequest);
    98. 98. Handle the response object</li></ul>if(payResponse.PaymentExecStatus.equalsIgnoreCase('Created') ) { <br />// send user to paypal for confirmation<br /> } else if(payResponse.PaymentExecStatus.equalsIgnoreCase('Completed') ) {<br />// success<br /> } else { /*handle error */ }<br />
    99. 99. Code Samples – Simple Payment<br /> // create request envelope and set the common request parameters object name<br />PPPayRequest request = newPPPayRequest('MyRequestParams', paypalSenderId); <br /> // set success and cancel urls<br />request.CancelUrl = 'https://' + host + '/StoreFront?status=cancel';<br />request.ReturnUrl = 'https://' + host + '/StoreFront?status=success';<br /> // set a note associated with the payment <br />request.Memo = message; <br /> // set Receiver info<br /> List<PPReceiver> receiverList = new List<PPReceiver>();<br />PPReceiver receiver1 = newPPReceiver();<br /> // set the receiver email (receiver's PayPal Id)<br /> receiver1.email = paypalReceiverId;<br /> // set amount to be credited to the receiver's account<br /> receiver1.amount = amount;<br /> receiverList.Add(receiver1);<br /> // set receiver info in the request<br />request.receiverList = receiverList;<br /> // create the Adaptive Toolkit object instance w/ API Credentials<br />PPAdaptiveToolkit toolkit = newPPAdaptiveToolkit('SandboxCert');<br />try {<br /> // send the PayRequest using the Adaptive toolkit object<br />PPPayResponse response = toolkit.pay(request);<br /> // check the response payment status<br />if ( response.PaymentExecStatus.equalsIgnoreCase('Created') ) {<br />// payment status is 'Created' - send the user to approval page<br />returnPage= toolkit.commitpayment(response.payKey);<br /> } elseif( response.PaymentExecStatus.equalsIgnoreCase('Completed') ) {<br /> // the payment is 'Completed' (when no approval is required <br /> // - returned in case of pre-approvals or implicit approvals)<br /> // send the user to the return url<br />returnPage = newpagereference(request.returnUrl);<br /> }<br />returnreturnPage;<br /> } catch(PPFaultMessageExceptionfaultMsg) { /* handle errors */}<br />
    100. 100. Code Sample – Chained/Parallel Payment<br />PPReceiverreceiver1 = newPPReceiver();<br /> // set the receiver email (receiver's PayPal Id)<br /> receiver1.email = paypalReceiverId1;<br /> // set amount to be credited to the receiver's account<br /> receiver1.amount = amount1;<br /> // set the primary flag to indicate if it’s a chained (true) or parallel (false) payment<br /> receiver1.Primary = true;<br /> receiverList.Add(receiver1);<br /> <br />PPReceiverreceiver2 = newPPReceiver();<br /> // set the receiver email (receiver's PayPal Id)<br /> receiver1.email = paypalReceiverId2;<br /> // set amount to be credited to the receiver's account<br /> receiver1.amount = amount2;<br /> receiverList.Add(receiver2);<br />  <br /> // set receiver info in the request<br />request.receiverList = receiverList;<br />
    101. 101. Code Sample – Preapprovals<br />// create request envelope and set the common request parameters object name<br />PPPreapprovalRequestrequest = newPPPreapprovalRequest ('MyRequestParams', paypalSenderId);<br />// set success and cancel urls<br />request.CancelUrl = 'https://' + host + '/StoreFront?status=cancel';<br />request.ReturnUrl = 'https://' + host + '/StoreFront?status=success';<br />// set a note associated with the payment <br />request.Memo = message; <br />// set Date of Month when the payment can be made using this preapproval <br />request.DateOfMonth = 1; <br />// set Day of week when the payment can be made using this preapproval<br />request.DayOfWeek = 'WEDNESDAY'; <br />// set the end date<br />request.EndingDate = DateTime.newInstance(2010, 12, 31); <br />// set the max amount per payment<br />request.MaxAmountPerPayment = 10;<br />// set max number of payment made using this preapproval <br />request.MaxNumberOfPayments = 5; <br />// set max number of payments made using this preapproval per period<br />request.MaxNumberOfPaymentsPerPeriod = 1; <br />// set max total payments using this preapproval<br />request.maxTotalAmountOfAllPayment = 100; <br />// set the payment period<br />request.PaymentPeriod = 'DAILY';<br />// set a request pin to be associated with the preapproval <br />request.PinType = ‘REQUIRED'; // or NOT_REQUIRED <br />request.StartingDate = DateTime.newInstance(2009, 11, 8); <br /> // create the Adaptive Toolkit object instance w/ API Credentials<br />PPAdaptiveToolkit toolkit = newPPAdaptiveToolkit('SandboxCert');<br />try {<br /> // send the PayRequest using the Adaptive toolkit object<br />PPPayResponse response = toolkit.preapproval(request);<br /> // check the response payment status<br />if ( response.PaymentExecStatus.equalsIgnoreCase('Created') ) {<br /> // if the payment status is 'Created' - send the user to approval page<br />returnPage= toolkit.commitpreapproval(response.payKey);<br /> } elseif( response.PaymentExecStatus.equalsIgnoreCase('Completed') ) {<br /> // if the payment is 'Completed' (when no approval is required <br /> // - returned in case of pre-approvals or implicit approvals)<br />// send the user to the return url<br />returnPage = newpagereference(request.returnUrl);<br /> }<br />returnreturnPage;<br /> } catch(PPFaultMessageExceptionfaultMsg) {<br />/* handle exceptions */<br /> }<br />
    102. 102. Going Live<br />Upgrade to a PayPal Business Account<br />Get Verified<br />Obtain Live API Credentials<br />Submit App on X.com for review<br />Follow the Salesforce “How to Publish” guide.<br />
    103. 103. Upcoming Changes (Q2)<br /><ul><li>Support for new methods in Adaptive Payments
    104. 104. Support for creating Business Accounts
    105. 105. Support for obtaining Account Verification Status
    106. 106. Support for adding Bank funding source</li></li></ul><li>Q & A<br />Let us know what you need!<br />(30% of our roadmap is based on your feedback)<br />www.x.com<br />Twitter: @paypalx, @ppalavilli<br />www.facebook.com/paypalx<br />

    ×