Date post: | 22-Jan-2015 |
Category: |
Technology |
Upload: | aduci |
View: | 3,580 times |
Download: | 0 times |
2. Agenda
3. Introduction
4. Promotional Campaigns 5. Promotion Through Discounts
6. Technical Structure for Promotion
7. Sample User Interfaces
8. Administration of Promotion Codes
9. Intelligence in IPN 10. IPN Business Use Cases
11. Setting Up A Simple IPN Listener
12. Testing your IPN Listener
13. IPN Simulator
14. Code :: Process IPN
// 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
$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
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
19. Test & Retrieve Variables // loop variables add body foreach($_POST as $name => $value) { $mail_Body .= "$name : $value"; }
20. Back Up Transaction Retrieval
21. Recurring Payments 22. Leveraging Recurring Payments
23. Good Practices
24. Technical Notes
25. CreateRecurringPaymentsProfile NVP
26. CreateRecurringPaymentsProfile SOAP
$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
28. Testing Recurring Payments
29.
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
31. Testing Recurring Payments
32. IPN Message Variables
33. Conclusion 34. Conclusion
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