PayPal Dev Con 2009 Driving Business
-
Upload
aduci -
Category
Technology
-
view
3.581 -
download
0
description
Transcript of PayPal Dev Con 2009 Driving Business
- 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 IPNtxn_typeand 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']; 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, "VERIFIED") == 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, "INVALID") == 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 .= "$name : $value"; }
- 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
29.
- 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 30. 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
31. Testing Recurring Payments
- Enable message delivery in the Profile settings for IPN
- Send real recurring payments profile creation calls
32. 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
33. Conclusion 34. 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
35. Q&A Chuck Hudson www.aduci.com [email_address] 36. Thank you! Questions? To learn more, visit www.ebay.com/devcon 37. From Payment to Life Cycle Payment Marketing Back-EndIntegration Back-EndIntegration