Driving Business with PayPal Extending Implementations To Increase Sales & Improve Customer Relationships
Agenda <ul><li>Taking PayPal Beyond Payments </li></ul><ul><li>Promotional Campaigns </li></ul><ul><li>Intelligence in IPN...
Introduction <ul><li>Leverage beyond the standard payment </li></ul><ul><li>Real opportunity to: </li></ul><ul><ul><li>Inc...
Promotional Campaigns
Promotion Through Discounts <ul><li>Common business requirements </li></ul><ul><ul><li>Pricing </li></ul></ul><ul><ul><ul>...
Technical Structure for Promotion <ul><li>Use case flow </li></ul><ul><ul><li>Entry and validation of the code </li></ul><...
Sample User Interfaces <ul><li>Entry point for code </li></ul>
Administration of Promotion Codes <ul><li>Use simple database table for storage of the code properties </li></ul>
Intelligence in IPN
IPN Business Use Cases <ul><li>Fulfillment (packing, shipping, receipts)  </li></ul><ul><li>Accounting system processing a...
Setting Up A Simple IPN Listener <ul><li>Typical steps </li></ul><ul><ul><li>Verify IPN  txn_type  and variables passed </...
Testing your IPN Listener <ul><li>Good practice to test handling logic prior to hooking in IPN </li></ul><ul><li>Use PayPa...
IPN Simulator <ul><li>Enter your URL for the IPN listener </li></ul><ul><li>Select the transaction type </li></ul><ul><li>...
Code :: Process IPN <ul><li>Authenticate IPN request through post back </li></ul><ul><li>Example uses fsockopen, could use...
Code :: IPN Part 2 <ul><li>Assign posted variables to local scope </li></ul><ul><li>Variables posted depend on transaction...
Code :: IPN :: Perform Checks and Process <ul><li>Process Transaction: </li></ul>if (!$fp) { // HTTP ERROR - log and notif...
IPN Transaction Types Source:  see Instant Payment Notification Guide pdf PayPal for complete list. Sample types for speci...
Multiple IPN Listeners <ul><li>Uses </li></ul><ul><ul><li>Separate product processing </li></ul></ul><ul><ul><li>Different...
Test & Retrieve Variables // loop variables add body foreach($_POST as $name => $value) { $mail_Body .= &quot;$name : $val...
Back Up Transaction Retrieval <ul><li>Typically for financial and business needs </li></ul><ul><li>Mitigates risk of commu...
Recurring Payments
Leveraging Recurring Payments <ul><li>Through Website Payments Pro or Express Checkout </li></ul><ul><li>Most common uses:...
Good Practices <ul><li>Have consent to bill in place </li></ul><ul><li>Use authorization or an initial transaction in the ...
Technical Notes <ul><li>Must have either token or credit card info </li></ul><ul><ul><li>If express checkout then token </...
CreateRecurringPaymentsProfile NVP <ul><li>Minimum CreateRecurringPaymentsProfile </li></ul>
CreateRecurringPaymentsProfile SOAP <ul><li>Execute SOAP request </li></ul>$response =  $caller->CreateRecurringPaymentsPr...
CreateRecurringPaymentsProfile Return <ul><li>Successful </li></ul><ul><ul><li>PROFILEID </li></ul></ul><ul><li>Failure </...
Testing Recurring Payments <ul><li>Sandbox Testing </li></ul><ul><ul><li>Create a test personal account (for payment) </li...
<ul><li>Automate processes based on </li></ul><ul><ul><li>Payment number / remaining </li></ul></ul><ul><ul><li>Individual...
Sandbox IPN Recurring Payment Testing <ul><li>Override txn_type on the IPN simulator </li></ul><ul><li>Limited testing of ...
Testing Recurring Payments <ul><li>Enable message delivery in the Profile settings for IPN </li></ul><ul><li>Send real rec...
IPN Message Variables <ul><li>Use variable email IPN catch page </li></ul><ul><ul><li>IPN will contain “test_ipn” variable...
Conclusion
Conclusion <ul><li>Describe business processes up front </li></ul><ul><li>Create integration and functionality so that it ...
Q&A Chuck Hudson www.aduci.com [email_address]
Thank you! Questions? To learn more, visit   www.ebay.com/devcon
From Payment to Life Cycle Payment Marketing Back-End  Integration Back-End  Integration
Upcoming SlideShare
Loading in …5
×

PayPal Dev Con 2009 Driving Business

4,168 views

Published on

From the 2009 PayPal Developer's Conference (http://ebay.com/devcon/).

Driving Business with PayPal

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 examples.

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,168
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
48
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • 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 (&apos;www.sandbox.paypal.com&apos;, 80, $errno, $errstr, 30); Sandbox and ssl $fp = fsockopen (’ssl://www.sandbox.paypal.com&apos;, 443, $errno, $errstr, 30); Production and http $fp = fsockopen (&apos;www.paypal.com&apos;, 80, $errno, $errstr, 30); Production and ssl $fp = fsockopen (&apos;ssl://www.paypal.com&apos;, 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&amp;thread.id=12752&amp;view=by_date_ascending&amp;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&amp;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&amp;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&amp;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
  • PayPal Dev Con 2009 Driving Business

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

    ×