PayPal Dev Con 2009 Driving Business

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Notes on slide 1

    Best Practices for Integrating Payments Pro Session Title: Driving Business with PayPal Session Abstract: Many SMB customers are looking for a higher level of integration out of their ecommerce system to drive stronger end customer relationships. Some of the more common additional pieces of functionality above standard checkout processing includes marketing campaigns connected into their product purchasing (special promos, discount coupons, etc.), tie-ins of transactional information into their online administration, and the acceptance of online invoice payments tied into their financial system. In this session we will look at taking PayPal integration to the next level through technologies such as Payments Pro, Instant Payment Notification, and Recurring Payment. In the process not only will we look at lessons learned and recommendations based on the experience of developing several of these end solutions for small and medium businesses. We will use live site case studies but also walk through the design and code of the following examples: Implementing promo/discount codes in the checkout process through Payments Pro Keeping transaction records in back end systems using Instant Payment Notification (IPN) Leveraging recurring billing for long term customer relationships and overall customer retention These examples will be shown in a hypothetical invoice payment system that we will walk through during the talk. We will look at the customer flow, business benefits, and implementation best practices of each of the above pieces functionalities into a site. This session should provide multiple ideas for incorporating advanced features into your own site or customer web projects, along with some best practices to guide you to a successful integration. Note: Most examples, for ease of demonstration in the session will be provided in PHP and mySql, however the functionality and design could be leveraged across a variety programming languages and the underlying PayPal technologies remain the same.

    Promotion, discount, coupon codes Security of server side, prevent the user from manipulating a cookie or client side JS or the order in paypal Watch out for client side code validation as it exposes the codes available to users Store codes in database for easy maintenance and tracking Also need to be aware if more than one coupon code can be used per order

    Recalculation of order needs to happen if items updated or code changed

    https://cms.paypal.com/cms_content/US/en_US/files/developer/IPNGuide.pdf

    SSL is not required for IPN because no banking or credit card information is transmitted in the posting of information from paypal to your IPN catch page Remember to put the IPN temporarily on hold if processing IPN catch page under maintenance Typically use either “custom” or “invoice” fields for matching up database records, only real difference is length 255 versus 127 and custom is not presented to the customer

    The address for opening the connection and doing the post back varies on two conditionals: ssl encryption and production or sandbox selection. Here are the possible values. Sandbox and http $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30); Sandbox and ssl $fp = fsockopen (’ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); Production and http $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); Production and ssl $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); For cURL examples see the following link in the PayPal developer forums: http://developer.paypal-portal.com/pdn/board/message?board.id=ipn&thread.id=12752&view=by_date_ascending&page=1

    See the Instant Payment Notification Guide pdf (Document Number: 10087.en_US-200903) for the complete set of information.

    Based on the transaction type different processing rules can be created to handle the information passed via IPN based on the business processes.

    Website Payments Standard button notify_url HTML form variable NVP API operation NOTIFYURL field of the DoDirectPayment, DoExpressCheckoutPayment, or DoReferenceTransaction request SOAP API operation NotifyURL field of the DoDirectPayment, DoExpressCheckoutPayment, or DoReferenceTransaction request

    We use this to troubleshoot both production issues and validate the set of variables returned by a specific transaction type.

    This method is used as a back up for the IPN notifications when the business must have all transactions integrated for accounting, packing and shipping processes and the like. Set the STARTDATE and ENDDATE values for the window of time for the TransactionSearch call. If a transaction is found that an IPN has not been received for then call GetTransactionDetails for retrieving the same type of information as what would have been found in the IPN. Make sure to use a flag of last successful poll time as the new start time so that do not miss a window based on communication issues. PayPal source code examples can be found at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code.

    DoDirectPayment call and authorize $1, then void it if successful

    Showing direct method here. Just as easily this can be put into an Express Checkout flow using a token based validation.

    The $recurring_payments_request variable holds the parameters for the new profile. See the SOAP example for a breakdown of building the parameters into the profile.

    Profile ID can then be used to query the profile and perform other API calls on the recurring payments so store this with the client information. Error messages follow standard style including error code number and messages. Here is another sample: TIMESTAMP: 2009-05-11T15:15:23Z CORRELATIONID: 66130dd934ffb ACK: Failure VERSION: 51.0 BUILD: 904483 L_ERRORCODE0: 10527 L_SHORTMESSAGE0: Invalid Data L_LONGMESSAGE0: This transaction cannot be processed. Please enter a valid credit card number and type. L_SEVERITYCODE0: Error

    Recurring payments instant payment notifications and email Event IPN Buyer Email Profile successfully created Yes Yes Profile creation failed Yes Yes Profile canceled from paypal.com interface Yes Yes Profile status changed using API No Yes Profile update using API No Yes Initial payment either succeeded or failed Yes Yes Payment either succeeded or failed (during either trial period or regular payment period) Yes Yes Outstanding payment either succeeded or failed Yes Yes Maximum number of failed payments reached Yes No NOTE: API transactions such as ManangeRecurringPaymentsProfileStatus do not trigger IPN notification because the success or failure of the call is immediately provided by the API response.

    Even with performing recurring payments in the sandbox you will still not be able to create all the actions that trigger IPNs. Some will only be available in production.

    It is also beneficial to add a catch all in your IPN processing page so that if an unhandled IPN txn_type is caught that you can then be notified either by logging of the variables or email of the variables.

    Code Samples Sample Code https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code IPN https://www.paypal.com/us/cgi-bin/?cmd=p/xcl/rec/ipn-code-outside CreateRecurringPaymentsProfile API https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_CreateRecurringPayments Documentation IPNGuide.pdf https://cms.paypal.com/cms_content/US/en_US/files/developer/IPNGuide.pdf

    1 Favorite

    PayPal Dev Con 2009 Driving Business - Presentation Transcript

    1. Driving Business with PayPal Extending Implementations To Increase Sales & Improve Customer Relationships
    2. Agenda
      • Taking PayPal Beyond Payments
      • Promotional Campaigns
      • Intelligence in IPN
      • Leveraging Recurring Payments
      • Conclusion
    3. Introduction
      • Leverage beyond the standard payment
      • Real opportunity to:
        • Increase new customer sales
        • Improve cash flows
        • Measure business success
        • Automate back end business processes
        • Develop more long term customer relationships
      • Create a full cycle with the customer
    4. Promotional Campaigns
    5. Promotion Through Discounts
      • Common business requirements
        • Pricing
          • % or amount off total order
          • Specific price for item
          • Free Shipping
        • Optional minimum amounts of order
        • Time window for usage of code
        • Limited use per order and account for code
        • Tracking and reporting of code usage
    6. Technical Structure for Promotion
      • Use case flow
        • Entry and validation of the code
        • Recalculation of the order
        • Payment for the order
        • Storing and tracking of the code usage
      • For standard PayPal can use “custom” or “item” fields to track code usage
      • Watch for zero order totals as these will throw an error if trying to process
    7. Sample User Interfaces
      • Entry point for code
    8. Administration of Promotion Codes
      • Use simple database table for storage of the code properties
    9. Intelligence in IPN
    10. IPN Business Use Cases
      • Fulfillment (packing, shipping, receipts)
      • Accounting system processing and tracking
      • CRM incorporation (such as salesforce.com)
      • Up-sell and marketing kick off
        • Email of coupons codes based on purchase profile and metadata of items
      • Extended payments to third parties
        • Commissions to affiliates (Mass Payments API)
      • Fraud Management
    11. Setting Up A Simple IPN Listener
      • Typical steps
        • Verify IPN txn_type and variables passed
        • Create logic for handling IPN
        • Connect in IPN validation in listener
        • Set up IPN URL account or in code
      • IPN Simulator in Sandbox
      • Executing with a test harness
    12. Testing your IPN Listener
      • Good practice to test handling logic prior to hooking in IPN
      • Use PayPal Sandbox to create dynamic IPN calls with a wide range of variables
        • Log in to PayPal Sandbox
        • Click on Test Tools
        • Click on Instant Payment Notification (IPN) simulator
    13. IPN Simulator
      • Enter your URL for the IPN listener
      • Select the transaction type
      • Fill in the fields to be sent with the IPN
    14. Code :: Process IPN
      • Authenticate IPN request through post back
      • Example uses fsockopen, could use cURL
      // read the post from PayPal system and add 'cmd’ $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0 "; $header .= "Content-Type: application/x-www-form-urlencoded ” $header .= "Content-Length: " . strlen($req) . " "; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
    15. Code :: IPN Part 2
      • Assign posted variables to local scope
      • Variables posted depend on transaction type
      $txn_type = $_POST['txn_type']; $txn_id = $_POST['txn_id']; $payment_status = $_POST['payment_status']; … <other posted variabels> … If (isset($_POST[‘custom’])) { $custom = $_POST['custom']; }
    16. Code :: IPN :: Perform Checks and Process
      • Process Transaction:
      if (!$fp) { // HTTP ERROR - log and notify } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, &quot;VERIFIED&quot;) == 0) { // check txn_type for case processing // check the payment_status is Completed // check txn_id has not been previously processed // check receiver_email is Primary PayPal email // check payment_amount/payment_currency are correct // perform action } else if (strcmp ($res, &quot;INVALID&quot;) == 0) { // log for manual investigation and notify } } fclose ($fp); }
    17. IPN Transaction Types Source: see Instant Payment Notification Guide pdf PayPal for complete list. Sample types for special processing cart recurring_payment web_accept recurring_payment_profile_created express_checkout subscr_signup mass_pay subscr_payment subscr_failed
    18. Multiple IPN Listeners
      • Uses
        • Separate product processing
        • Different site processing through one account
      • Two methods:
        • Centralized triage
        • Dynamic IPN addressing with
          • HTML notify_url
          • NVP API NOTIFYURL
          • SOAP API NotifyURL
    19. Test & Retrieve Variables // loop variables add body foreach($_POST as $name => $value) { $mail_Body .= &quot;$name : $value &quot;; }
      • Create test IPN catch page
      • Loop through all posted vars
      • Send mail or log with vars
    20. Back Up Transaction Retrieval
      • Typically for financial and business needs
      • Mitigates risk of communications issues
      • Use the following API calls (Payments Pro)
        • TransactionSearch
        • GetTransactionDetails
      • Periodic transaction search to verify all IPN messages have been received
    21. Recurring Payments
    22. Leveraging Recurring Payments
      • Through Website Payments Pro or Express Checkout
      • Most common uses:
        • Membership fees
        • Payment plans
      • Business effects
        • Smoothing of revenue
        • Longer customer relationships
    23. Good Practices
      • Have consent to bill in place
      • Use authorization or an initial transaction in the recurring profile to validate account
      • Save profile id so can be used to match IPN notifications
    24. Technical Notes
      • Must have either token or credit card info
        • If express checkout then token
        • If direct then credit card info
      • Minimum required fields
        • Payment information or token
        • Billing terms
        • Description
    25. CreateRecurringPaymentsProfile NVP
      • Minimum CreateRecurringPaymentsProfile
    26. CreateRecurringPaymentsProfile SOAP
      • Execute SOAP request
      $response = $caller->CreateRecurringPaymentsProfile($recurring_payments_request); switch($response->getAck()) { case 'Success': case 'SuccessWithWarning': // Extract the response details. $recurring_payments_response_details = $response->getCreateRecurringPaymentsProfileResponseDetails(); $profileID = $recurring_payments_response_details->getProfileID(); exit('CreateRecurringPaymentsProfile Completed Successfully:' . print_r($response, true)); default: exit('CreateRecurringPaymentsProfile failed: ' . print_r($response, true)); }
    27. CreateRecurringPaymentsProfile Return
      • Successful
        • PROFILEID
      • Failure
        • L_ERRORCODE0, L_SHORTMESSAGE0, L_LONGMESSAGE0, L_SEVERITYCODE0
    28. Testing Recurring Payments
      • Sandbox Testing
        • Create a test personal account (for payment)
        • Create API credentials
        • Switch code to use sandbox and API credentials
      • Production Testing
        • Refund and cancel recurring payment
      • Automate processes based on
        • Payment number / remaining
        • Individual payment information
      • Transaction Types
      IPN Integration recurring_payment recurring_payment_profile_created recurring_payment_failed recurring_payment_skipped recurring_payment_suspended_due_to_max_failed_payment recurring_payment_profile_cancel
    29. Sandbox IPN Recurring Payment Testing
      • Override txn_type on the IPN simulator
      • Limited testing of transaction type handling
      • Better to hook up IPN URL in account
    30. Testing Recurring Payments
      • Enable message delivery in the Profile settings for IPN
      • Send real recurring payments profile creation calls
    31. IPN Message Variables
      • Use variable email IPN catch page
        • IPN will contain “test_ipn” variable with value of 1 to designate sandbox
        • recurring_payment_id is profile id
    32. Conclusion
    33. Conclusion
      • Describe business processes up front
      • Create integration and functionality so that it can scale and change easily
      • With these tools a business can create a full customer relationship cycle
        • Feeding the funnel in the beginning
        • Managing customers after the sale
        • Automating processes for repeat sales
    34. Q&A Chuck Hudson www.aduci.com [email_address]
    35. Thank you! Questions? To learn more, visit www.ebay.com/devcon
    36. From Payment to Life Cycle Payment Marketing Back-End Integration Back-End Integration
    SlideShare Zeitgeist 2009

    + AduciAduci Nominate

    custom

    344 views, 1 favs, 0 embeds more stats

    From the 2009 PayPal Developer's Conference (http:/ more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 344
      • 344 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 8
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories