ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Driving Business with PayPal Extending Implementations To Increase Sales & Improve Customer Relationships
Agenda Taking PayPal Beyond Payments Promotional Campaigns Intelligence in IPN Leveraging Recurring Payments Conclusion
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
Promotional Campaigns
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
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
Sample User Interfaces Entry point for code
Administration of Promotion Codes Use simple database table for storage of the code properties
Intelligence in IPN
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
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
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
IPN Simulator Enter your URL for the IPN listener Select the transaction type Fill in the fields to be sent with the IPN
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\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n¡± $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
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']; }
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); }
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
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
Test & Retrieve Variables // loop variables add body foreach($_POST as $name => $value) { $mail_Body .= &quot;$name : $value\r\n&quot;; } Create test IPN catch page Loop through all posted vars Send mail or log with vars
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
Recurring Payments
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
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
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
CreateRecurringPaymentsProfile NVP Minimum CreateRecurringPaymentsProfile
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)); }
CreateRecurringPaymentsProfile Return Successful PROFILEID Failure L_ERRORCODE0, L_SHORTMESSAGE0, L_LONGMESSAGE0, L_SEVERITYCODE0
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
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
Testing Recurring Payments Enable message delivery in the Profile settings for IPN Send real recurring payments profile creation calls
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
Conclusion
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
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

More Related Content

Similar to PayPal Dev Con 2009 Driving Business (20)

Introducing safexpay smart NBFC solution
Introducing safexpay smart NBFC solutionIntroducing safexpay smart NBFC solution
Introducing safexpay smart NBFC solution
Neha Sahay
?
Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )
Yoshi Sakai
?
https://uii.io/ref/hmaadi
https://uii.io/ref/hmaadihttps://uii.io/ref/hmaadi
https://uii.io/ref/hmaadi
hmaadi96
?
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
?
Monetizing your Applications with PayPal X Payments Platform
Monetizing your Applications withPayPal X Payments PlatformMonetizing your Applications withPayPal X Payments Platform
Monetizing your Applications with PayPal X Payments Platform
guest72b121
?
Monetizing your Applications with PayPal X Payments Platform
Monetizing your Applications withPayPal X Payments PlatformMonetizing your Applications withPayPal X Payments Platform
Monetizing your Applications with PayPal X Payments Platform
PayPalX Developer Network
?
Monetizing your apps with PayPal API:s
Monetizing your apps with PayPal API:sMonetizing your apps with PayPal API:s
Monetizing your apps with PayPal API:s
Disruptive Code
?
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
Jonathan LeBlanc
?
AAD B2C custom policies
AAD B2C custom policiesAAD B2C custom policies
AAD B2C custom policies
Rory Braybrook
?
Frapp¨¦ Open Day Presentations - April 2016
Frapp¨¦ Open Day Presentations - April 2016Frapp¨¦ Open Day Presentations - April 2016
Frapp¨¦ Open Day Presentations - April 2016
Neil Lasrado
?
HTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsHTML5 Gaming Payment Platforms
HTML5 Gaming Payment Platforms
Jonathan LeBlanc
?
PHP-04-Forms.ppt
PHP-04-Forms.pptPHP-04-Forms.ppt
PHP-04-Forms.ppt
NatureLifearabhi
?
4 Benefits of a Digitized and Automated AP System
4 Benefits of a Digitized and Automated AP System4 Benefits of a Digitized and Automated AP System
4 Benefits of a Digitized and Automated AP System
Flatirons Solutions?
?
Payment Gateway
Payment GatewayPayment Gateway
Payment Gateway
Nyros Technologies
?
Pr¨¦vention et d¨¦tection des mouvements lat¨¦raux
Pr¨¦vention et d¨¦tection des mouvements lat¨¦rauxPr¨¦vention et d¨¦tection des mouvements lat¨¦raux
Pr¨¦vention et d¨¦tection des mouvements lat¨¦raux
ColloqueRISQ
?
Claims Based Identity In Share Point 2010
Claims  Based  Identity In  Share Point 2010Claims  Based  Identity In  Share Point 2010
Claims Based Identity In Share Point 2010
Steve Sofian
?
PayPal Account Authentication Service
PayPal Account Authentication ServicePayPal Account Authentication Service
PayPal Account Authentication Service
Sherief Razzaque
?
Pay Book Guide User En
Pay Book Guide User EnPay Book Guide User En
Pay Book Guide User En
Yann GEFFROTIN
?
Winter 2003
Winter 2003 Winter 2003
Winter 2003
webhostingguy
?
Active Merchant
Active MerchantActive Merchant
Active Merchant
John Ward
?
Introducing safexpay smart NBFC solution
Introducing safexpay smart NBFC solutionIntroducing safexpay smart NBFC solution
Introducing safexpay smart NBFC solution
Neha Sahay
?
Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )
Yoshi Sakai
?
https://uii.io/ref/hmaadi
https://uii.io/ref/hmaadihttps://uii.io/ref/hmaadi
https://uii.io/ref/hmaadi
hmaadi96
?
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
?
Monetizing your Applications with PayPal X Payments Platform
Monetizing your Applications withPayPal X Payments PlatformMonetizing your Applications withPayPal X Payments Platform
Monetizing your Applications with PayPal X Payments Platform
guest72b121
?
Monetizing your Applications with PayPal X Payments Platform
Monetizing your Applications withPayPal X Payments PlatformMonetizing your Applications withPayPal X Payments Platform
Monetizing your Applications with PayPal X Payments Platform
PayPalX Developer Network
?
Monetizing your apps with PayPal API:s
Monetizing your apps with PayPal API:sMonetizing your apps with PayPal API:s
Monetizing your apps with PayPal API:s
Disruptive Code
?
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
Jonathan LeBlanc
?
Frapp¨¦ Open Day Presentations - April 2016
Frapp¨¦ Open Day Presentations - April 2016Frapp¨¦ Open Day Presentations - April 2016
Frapp¨¦ Open Day Presentations - April 2016
Neil Lasrado
?
HTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsHTML5 Gaming Payment Platforms
HTML5 Gaming Payment Platforms
Jonathan LeBlanc
?
4 Benefits of a Digitized and Automated AP System
4 Benefits of a Digitized and Automated AP System4 Benefits of a Digitized and Automated AP System
4 Benefits of a Digitized and Automated AP System
Flatirons Solutions?
?
Pr¨¦vention et d¨¦tection des mouvements lat¨¦raux
Pr¨¦vention et d¨¦tection des mouvements lat¨¦rauxPr¨¦vention et d¨¦tection des mouvements lat¨¦raux
Pr¨¦vention et d¨¦tection des mouvements lat¨¦raux
ColloqueRISQ
?
Claims Based Identity In Share Point 2010
Claims  Based  Identity In  Share Point 2010Claims  Based  Identity In  Share Point 2010
Claims Based Identity In Share Point 2010
Steve Sofian
?
PayPal Account Authentication Service
PayPal Account Authentication ServicePayPal Account Authentication Service
PayPal Account Authentication Service
Sherief Razzaque
?
Active Merchant
Active MerchantActive Merchant
Active Merchant
John Ward
?

Recently uploaded (20)

Transform Your Future with Front-End Development Training
Transform Your Future with Front-End Development TrainingTransform Your Future with Front-End Development Training
Transform Your Future with Front-End Development Training
Vtechlabs
?
Stronger Together: Combining Data Quality and Governance for Confident AI & A...
Stronger Together: Combining Data Quality and Governance for Confident AI & A...Stronger Together: Combining Data Quality and Governance for Confident AI & A...
Stronger Together: Combining Data Quality and Governance for Confident AI & A...
Precisely
?
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-StoryRevolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
ssuser52ad5e
?
DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)
DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)
DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)
Tsuyoshi Hirayama
?
UiPath Document Understanding - Generative AI and Active learning capabilities
UiPath Document Understanding - Generative AI and Active learning capabilitiesUiPath Document Understanding - Generative AI and Active learning capabilities
UiPath Document Understanding - Generative AI and Active learning capabilities
DianaGray10
?
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
?
Wondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 LatestWondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 Latest
udkg888
?
Integrated Operating Window - A Gateway to PM
Integrated Operating Window - A Gateway to PMIntegrated Operating Window - A Gateway to PM
Integrated Operating Window - A Gateway to PM
Farhan Tariq
?
Technology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptxTechnology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptx
kaylagaze
?
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
?
UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1
DianaGray10
?
Gojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptxGojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptx
V3cube
?
BoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is DynamicBoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is Dynamic
Ortus Solutions, Corp
?
Computational Photography: How Technology is Changing Way We Capture the World
Computational Photography: How Technology is Changing Way We Capture the WorldComputational Photography: How Technology is Changing Way We Capture the World
Computational Photography: How Technology is Changing Way We Capture the World
HusseinMalikMammadli
?
Q4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor PresentationQ4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor Presentation
Dropbox
?
UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2
DianaGray10
?
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarterQ4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
MariaBarbaraPaglinaw
?
Cloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in AviationCloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in Aviation
Assem mousa
?
What Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI AgentsWhat Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI Agents
Zilliz
?
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
ScyllaDB
?
Transform Your Future with Front-End Development Training
Transform Your Future with Front-End Development TrainingTransform Your Future with Front-End Development Training
Transform Your Future with Front-End Development Training
Vtechlabs
?
Stronger Together: Combining Data Quality and Governance for Confident AI & A...
Stronger Together: Combining Data Quality and Governance for Confident AI & A...Stronger Together: Combining Data Quality and Governance for Confident AI & A...
Stronger Together: Combining Data Quality and Governance for Confident AI & A...
Precisely
?
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-StoryRevolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
ssuser52ad5e
?
DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)
DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)
DAO UTokyo 2025 DLT mass adoption case studies IBM Tsuyoshi Hirayama (ƽɽÒã)
Tsuyoshi Hirayama
?
UiPath Document Understanding - Generative AI and Active learning capabilities
UiPath Document Understanding - Generative AI and Active learning capabilitiesUiPath Document Understanding - Generative AI and Active learning capabilities
UiPath Document Understanding - Generative AI and Active learning capabilities
DianaGray10
?
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
?
Wondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 LatestWondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 Latest
udkg888
?
Integrated Operating Window - A Gateway to PM
Integrated Operating Window - A Gateway to PMIntegrated Operating Window - A Gateway to PM
Integrated Operating Window - A Gateway to PM
Farhan Tariq
?
Technology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptxTechnology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptx
kaylagaze
?
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
?
UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1
DianaGray10
?
Gojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptxGojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptx
V3cube
?
BoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is DynamicBoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is Dynamic
Ortus Solutions, Corp
?
Computational Photography: How Technology is Changing Way We Capture the World
Computational Photography: How Technology is Changing Way We Capture the WorldComputational Photography: How Technology is Changing Way We Capture the World
Computational Photography: How Technology is Changing Way We Capture the World
HusseinMalikMammadli
?
Q4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor PresentationQ4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor Presentation
Dropbox
?
UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2
DianaGray10
?
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarterQ4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
MariaBarbaraPaglinaw
?
Cloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in AviationCloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in Aviation
Assem mousa
?
What Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI AgentsWhat Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI Agents
Zilliz
?
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
ScyllaDB
?

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
  • 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
  • 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 .= &quot;&$key=$value&quot;; } // post back to PayPal system to validate $header = &quot;POST /cgi-bin/webscr HTTP/1.0\r\n&quot;; $header .= &quot;Content-Type: application/x-www-form-urlencoded\r\n¡± $header .= &quot;Content-Length: &quot; . strlen($req) . &quot;\r\n\r\n&quot;; $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\r\n&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
  • 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
  • 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-End Integration Back-End Integration

Editor's Notes

  • #2: 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.
  • #6: 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
  • #7: Recalculation of order needs to happen if items updated or code changed
  • #11: https://cms.paypal.com/cms_content/US/en_US/files/developer/IPNGuide.pdf
  • #12: 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
  • #15: 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
  • #16: See the Instant Payment Notification Guide pdf (Document Number: 10087.en_US-200903) for the complete set of information.
  • #18: Based on the transaction type different processing rules can be created to handle the information passed via IPN based on the business processes.
  • #19: 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
  • #20: We use this to troubleshoot both production issues and validate the set of variables returned by a specific transaction type.
  • #21: 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.
  • #24: DoDirectPayment call and authorize $1, then void it if successful
  • #26: Showing direct method here. Just as easily this can be put into an Express Checkout flow using a token based validation.
  • #27: 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.
  • #28: 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
  • #30: 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.
  • #31: 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.
  • #33: 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.
  • #36: 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