title
20. Ecommerce Website Tutorial : PayPal IPN PHP Instant Payment Notification Script

description
In this 20th and final video we program the PayPal IPN Script in order to receive variables behind the scenes from paypal. The E - Commerce Web Site we will be assembling is one in which all of the inventory is in a MySQL database and we offer a custom PHP cart for a unique shopping experience.

detail
{'title': '20. Ecommerce Website Tutorial : PayPal IPN PHP Instant Payment Notification Script', 'heatmap': [{'end': 264.791, 'start': 246.535, 'weight': 0.709}, {'end': 313.628, 'start': 273.424, 'weight': 1}], 'summary': 'This tutorial series covers implementing paypal ipn script for accurate payment verification in e-commerce, setting up custom variables, handling paypal responses, transaction checks, cart total calculation, and programming for database management in php, emphasizing untested functionality and the need for user verification, and explaining the importance of ipn script checks and various verification techniques.', 'chapters': [{'end': 332.031, 'segs': [{'end': 39.698, 'src': 'embed', 'start': 0.404, 'weight': 1, 'content': [{'end': 6.413, 'text': 'Hello and welcome to part 20 and the final part of the e-commerce website building lesson series.', 'start': 0.404, 'duration': 6.009}, {'end': 14.704, 'text': 'Part 20 leaves you with an IPN script that I will supply you with that I wrote using my blood and sweat and tears.', 'start': 7.033, 'duration': 7.671}, {'end': 20.506, 'text': "Alright, so for you to have a cool little system, there's one more thing I have to put in cart.php.", 'start': 15.583, 'duration': 4.923}, {'end': 30.672, 'text': 'This variable is going to let your IPN script know what the person checked out for which product ID and how many of that product ID they checked out for.', 'start': 20.886, 'duration': 9.786}, {'end': 39.698, 'text': 'This way we can cross-reference the amounts in the database to make sure that they paid the right amount for what they had supposedly checked out for.', 'start': 31.553, 'duration': 8.145}], 'summary': 'Final part of e-commerce lesson series provides ipn script for cross-referencing purchases.', 'duration': 39.294, 'max_score': 0.404, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA404.jpg'}, {'end': 115.823, 'src': 'embed', 'start': 85.585, 'weight': 0, 'content': [{'end': 86.546, 'text': "So let's get that one in.", 'start': 85.585, 'duration': 0.961}, {'end': 90.835, 'text': 'Now to assemble that variable is pretty simple.', 'start': 88.874, 'duration': 1.961}, {'end': 98.2, 'text': "You go into the foreach loop and let's put it right here under dynamic checkout button assembly.", 'start': 90.855, 'duration': 7.345}, {'end': 100.281, 'text': 'There we go.', 'start': 99.761, 'duration': 0.52}, {'end': 102.983, 'text': "Let's create the product array variable.", 'start': 100.301, 'duration': 2.682}, {'end': 107.86, 'text': 'So the product array variable is going to be.', 'start': 104.639, 'duration': 3.221}, {'end': 109.501, 'text': "I'll show you what it'll look like.", 'start': 107.86, 'duration': 1.641}, {'end': 110.621, 'text': "It's going to look something like this.", 'start': 109.561, 'duration': 1.06}, {'end': 113.722, 'text': 'So the first product they buy is id of 6.', 'start': 110.781, 'duration': 2.941}, {'end': 115.823, 'text': 'The second product they bought is id of 8.', 'start': 113.722, 'duration': 2.101}], 'summary': 'Assembling variable in foreach loop for product array with ids 6 and 8.', 'duration': 30.238, 'max_score': 85.585, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA85585.jpg'}, {'end': 313.628, 'src': 'heatmap', 'start': 246.535, 'weight': 3, 'content': [{'end': 251.237, 'text': 'so say you wanted to do things like give people instant downloads Or things like that.', 'start': 246.535, 'duration': 4.702}, {'end': 254.24, 'text': "You'll be open to do those sort of things with the IPN script.", 'start': 251.437, 'duration': 2.803}, {'end': 258.084, 'text': "Alright, so now let's discuss the PayPal IPN script.", 'start': 254.821, 'duration': 3.263}, {'end': 264.791, 'text': 'Now before I explain this IPN script, you should now be able to download it along with all of the other files.', 'start': 259.065, 'duration': 5.726}, {'end': 268.395, 'text': 'I placed the source code link in the description of this video.', 'start': 265.192, 'duration': 3.203}, {'end': 273.06, 'text': 'You can get all of my code now from the entire tutorial series if you need it.', 'start': 268.896, 'duration': 4.164}, {'end': 277.249, 'text': 'Now this is not the first PHP IPN script ever written.', 'start': 273.424, 'duration': 3.825}, {'end': 289.87, 'text': "In fact, if you just go to Google and you type into the search bar, PayPal PHP IPN example, the first result, It's paypalx.cms.paypal.com.", 'start': 277.449, 'duration': 12.421}, {'end': 294.834, 'text': "And you see here's the PayPal APIs, IPN, PDT.", 'start': 290.25, 'duration': 4.584}, {'end': 303.8, 'text': 'And this is the payment data transfer variables that I was talking to you about for the return URL if you ever want to implement those.', 'start': 295.314, 'duration': 8.486}, {'end': 306.662, 'text': 'But instant payment notification is the one we want.', 'start': 304.241, 'duration': 2.421}, {'end': 311.446, 'text': 'We want to see an example of ASP, ColdFusion, Java, Perl, PHP.', 'start': 306.682, 'duration': 4.764}, {'end': 313.628, 'text': 'We want to see the PHP example.', 'start': 312.086, 'duration': 1.542}], 'summary': 'The transcript discusses using the paypal ipn script to enable instant downloads and provides a source code link for it.', 'duration': 30.714, 'max_score': 246.535, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA246535.jpg'}], 'start': 0.404, 'title': 'Implementing paypal ipn script', 'summary': 'Focuses on implementing an ipn script to cross-reference product ids and quantities during checkout for accurate payment verification in e-commerce, and explains setting up the paypal ipn script, including creating custom variables, setting up pdt variables, and obtaining the script from the provided source code link.', 'chapters': [{'end': 159.627, 'start': 0.404, 'title': 'E-commerce part 20: implementing ipn script', 'summary': 'Discusses the final part of the e-commerce website building lesson series, focusing on implementing an ipn script to cross-reference product ids and quantities during checkout for accurate payment verification.', 'duration': 159.223, 'highlights': ['The chapter concludes the e-commerce website building lesson series with the implementation of an IPN script for accurate payment verification.', 'The IPN script is designed to cross-reference the product IDs and quantities during checkout, ensuring the correct payment amounts are verified.', 'The tutorial provides step-by-step instructions for adding variables to the cart.php file and initializing the product ID array for accurate tracking of purchased products and quantities.']}, {'end': 332.031, 'start': 160.905, 'title': 'Paypal ipn script', 'summary': 'Explains how to set up the paypal ipn script, including creating custom variables, setting up pdt variables, and obtaining the script from the provided source code link.', 'duration': 171.126, 'highlights': ['The chapter explains how to set up the PayPal IPN script, including creating custom variables, setting up PDT variables, and obtaining the script from the provided source code link.', 'PayPal IPN script is used to receive variables back from PayPal to the back-end system for each transaction, enabling actions such as providing instant downloads.', 'The RM variable can be set to 2 to automatically receive PDT variables from PayPal posted to the page where the customer lands after returning from the transaction.', "The chapter provides a source code link for the PHP IPN script example from PayPal's official documentation, offering a comprehensive resource for setting up the script."]}], 'duration': 331.627, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA404.jpg', 'highlights': ['The tutorial provides step-by-step instructions for adding variables to the cart.php file and initializing the product ID array for accurate tracking of purchased products and quantities.', 'The IPN script is designed to cross-reference the product IDs and quantities during checkout, ensuring the correct payment amounts are verified.', 'The chapter concludes the e-commerce website building lesson series with the implementation of an IPN script for accurate payment verification.', 'The chapter explains how to set up the PayPal IPN script, including creating custom variables, setting up PDT variables, and obtaining the script from the provided source code link.', 'The RM variable can be set to 2 to automatically receive PDT variables from PayPal posted to the page where the customer lands after returning from the transaction.', 'PayPal IPN script is used to receive variables back from PayPal to the back-end system for each transaction, enabling actions such as providing instant downloads.', "The chapter provides a source code link for the PHP IPN script example from PayPal's official documentation, offering a comprehensive resource for setting up the script."]}, {'end': 556.854, 'segs': [{'end': 374.478, 'src': 'embed', 'start': 332.471, 'weight': 3, 'content': [{'end': 336.733, 'text': "The one I'm showing you here, I just happened to custom write for our tutorial series.", 'start': 332.471, 'duration': 4.262}, {'end': 340.274, 'text': 'So it might benefit you to look this one over and use this one.', 'start': 336.933, 'duration': 3.341}, {'end': 343.836, 'text': "And I'll also have you note that I have not tested this.", 'start': 340.934, 'duration': 2.902}, {'end': 348.619, 'text': 'I just kind of wrote it out from what I think it should do with our little custom system.', 'start': 343.956, 'duration': 4.663}, {'end': 352.562, 'text': 'So this script works with our system here in a custom fashion.', 'start': 349.16, 'duration': 3.402}, {'end': 360.347, 'text': "But I coded it without testing it, so if it fails, it's up to you to make the programming meet the logic for what is intended to happen in it.", 'start': 353.042, 'duration': 7.305}, {'end': 365.07, 'text': "Because after this video, I'm moving on to other material and not looking back at this series.", 'start': 360.567, 'duration': 4.503}, {'end': 367.232, 'text': "We've gone good and deep here.", 'start': 365.871, 'duration': 1.361}, {'end': 370.955, 'text': "So if this script doesn't work, like I said, I haven't tested it.", 'start': 368.273, 'duration': 2.682}, {'end': 374.478, 'text': 'I just wrote it out for how I think it should work.', 'start': 371.015, 'duration': 3.463}], 'summary': 'Custom-written script for tutorial series, untested, may need adjustments.', 'duration': 42.007, 'max_score': 332.471, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA332471.jpg'}, {'end': 422.943, 'src': 'embed', 'start': 394.054, 'weight': 0, 'content': [{'end': 401.413, 'text': 'Right when they check out and make the payment, PayPal is going to send variables behind the scenes to this IPN script waiting on your server.', 'start': 394.054, 'duration': 7.359}, {'end': 407.116, 'text': "When those variables come and hit this script, we're going to gather them all up and we're going to send them back to PayPal.", 'start': 401.693, 'duration': 5.423}, {'end': 409.557, 'text': "We're going to kind of bounce them right back to PayPal.", 'start': 407.456, 'duration': 2.101}, {'end': 414.559, 'text': 'PayPal is going to gather them up there again, verify everything, and bounce it back to us.', 'start': 410.177, 'duration': 4.382}, {'end': 416.52, 'text': 'Now let me explain the code.', 'start': 415.44, 'duration': 1.08}, {'end': 422.943, 'text': 'This first section is if the server request method is not equal to post, then we make the script die.', 'start': 416.9, 'duration': 6.043}], 'summary': 'Paypal sends variables to ipn script for verification and processing.', 'duration': 28.889, 'max_score': 394.054, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA394054.jpg'}, {'end': 540.049, 'src': 'embed', 'start': 514.708, 'weight': 1, 'content': [{'end': 522.678, 'text': 'fsocopen and other functions that may not be available to the person programming the store and using IPNScript on certain servers.', 'start': 514.708, 'duration': 7.97}, {'end': 527.001, 'text': "And for those of you interested, you might want to know about PayPal's Sandbox.", 'start': 523.578, 'duration': 3.423}, {'end': 534.206, 'text': 'PayPal also has a testing environment called the Sandbox where you can run your IPN scripts, test everything.', 'start': 527.441, 'duration': 6.765}, {'end': 540.049, 'text': 'Just like it was a real operating store, you can do the real checkout process there.', 'start': 535.386, 'duration': 4.663}], 'summary': 'Paypal offers a sandbox for testing ipn scripts and checkout process.', 'duration': 25.341, 'max_score': 514.708, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA514707.jpg'}], 'start': 332.471, 'title': 'Custom script for tutorial series and implementing paypal ipn with php', 'summary': "Introduces a custom script for a tutorial series, emphasizing untested functionality and the need for user verification. it also explains the process of implementing paypal ipn with php, covering variable reception, verification, curl usage, and testing in paypal's sandbox environment.", 'chapters': [{'end': 374.478, 'start': 332.471, 'title': 'Custom script for tutorial series', 'summary': 'Introduces a custom script for a tutorial series, cautioning that it has not been tested and urging the user to ensure its functionality, as the presenter will not revisit the material.', 'duration': 42.007, 'highlights': ['The custom script is presented for a tutorial series, but it has not been tested, and the presenter will not revisit the material after this video.', 'The presenter urges caution and responsibility, stating that if the script fails, it is up to the user to make the programming meet the intended logic.', 'The presenter acknowledges coding the script without testing it and emphasizes that the user needs to ensure its functionality, as they will not be looking back at this series.']}, {'end': 556.854, 'start': 375.138, 'title': 'Implementing paypal ipn with php', 'summary': "Explains the process of implementing paypal ipn with php, including receiving variables from paypal, formatting them for verification, and using curl for posting back to paypal, while also mentioning the option of testing in paypal's sandbox environment.", 'duration': 181.716, 'highlights': ['The process of implementing PayPal IPN with PHP involves receiving variables from PayPal, formatting them for verification, and using curl for posting back to PayPal. The chapter describes the process of receiving variables from PayPal, formatting them for verification, and using curl for posting back to PayPal.', "Mentioning the option of testing in PayPal's Sandbox environment. The chapter mentions the availability of PayPal's Sandbox environment for testing IPN scripts and the real checkout process.", 'Using PHP to handle all the programming necessary for implementing PayPal IPN. The chapter emphasizes the capability of PHP to handle all the necessary programming for implementing PayPal IPN.']}], 'duration': 224.383, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA332471.jpg', 'highlights': ['The process of implementing PayPal IPN with PHP involves receiving variables from PayPal, formatting them for verification, and using curl for posting back to PayPal.', "The chapter mentions the availability of PayPal's Sandbox environment for testing IPN scripts and the real checkout process.", 'Using PHP to handle all the programming necessary for implementing PayPal IPN.', 'The custom script is presented for a tutorial series, but it has not been tested, and the presenter will not revisit the material after this video.', 'The presenter urges caution and responsibility, stating that if the script fails, it is up to the user to make the programming meet the intended logic.', 'The presenter acknowledges coding the script without testing it and emphasizes that the user needs to ensure its functionality, as they will not be looking back at this series.']}, {'end': 810.342, 'segs': [{'end': 659.537, 'src': 'embed', 'start': 557.414, 'weight': 0, 'content': [{'end': 560.595, 'text': 'Posting to PayPal and Curl gets a result back.', 'start': 557.414, 'duration': 3.181}, {'end': 565.617, 'text': 'So once that result is back, we can check that the result verifies right here.', 'start': 561.115, 'duration': 4.502}, {'end': 569.418, 'text': "Now what I'm doing here in this line of code is not very important at all.", 'start': 565.997, 'duration': 3.421}, {'end': 575.601, 'text': "I'm just taking the and symbol out of each key value pair and replacing it with a line break.", 'start': 569.438, 'duration': 6.163}, {'end': 577.881, 'text': "That way it'll be rendered more like a list.", 'start': 575.861, 'duration': 2.02}, {'end': 581.543, 'text': "Since we're done sending that to PayPal, we can do anything we want with this.", 'start': 578.302, 'duration': 3.241}, {'end': 588.545, 'text': 'request variable, which is stacked with all the variables that are being posted to the script, which are a whole bunch.', 'start': 582.203, 'duration': 6.342}, {'end': 591.166, 'text': 'So here we check that the result verifies.', 'start': 588.986, 'duration': 2.18}, {'end': 592.687, 'text': 'Let me expand that so you can see it.', 'start': 591.206, 'duration': 1.481}, {'end': 596.068, 'text': "So you're checking to see if the curl result is verified or not.", 'start': 593.067, 'duration': 3.001}, {'end': 600.79, 'text': 'If it is verified, you can put in the request variable list at the very bottom.', 'start': 596.168, 'duration': 4.622}, {'end': 603.191, 'text': "It'll render in this PayPal verified OK.", 'start': 601.11, 'duration': 2.081}, {'end': 605.192, 'text': "If it's not verified,", 'start': 604.051, 'duration': 1.141}, {'end': 613.375, 'text': 'you put in the bottom of the request variable list data not verified from PayPal and you mail yourself all that information along with the request list.', 'start': 605.192, 'duration': 8.183}, {'end': 617.997, 'text': 'So the request list and this little message here will arrive in your email inbox.', 'start': 613.675, 'duration': 4.322}, {'end': 626.913, 'text': "You have to make sure, it's very important that you change all of these you at your email dot com to your PayPal business email address.", 'start': 618.53, 'duration': 8.383}, {'end': 634.415, 'text': 'So anywhere in this IPN script where you might see you at your email dot com, change that to your PayPal business email address.', 'start': 627.213, 'duration': 7.202}, {'end': 635.576, 'text': "It's very important.", 'start': 634.796, 'duration': 0.78}, {'end': 638.237, 'text': "And you'll get this message if something goes wrong.", 'start': 635.796, 'duration': 2.441}, {'end': 646.259, 'text': "If everything's okay, the script will continue to execute if things are verified in PayPal, which they should be if things are operating normally.", 'start': 638.537, 'duration': 7.722}, {'end': 648.04, 'text': "Okay, let's collapse that back up.", 'start': 646.279, 'duration': 1.761}, {'end': 652.794, 'text': 'Now we check these four things before processing the transaction.', 'start': 648.973, 'duration': 3.821}, {'end': 655.255, 'text': 'And you can handle them any way you wish.', 'start': 653.255, 'duration': 2}, {'end': 659.537, 'text': 'The first thing is make sure the business email returned is your business email.', 'start': 655.655, 'duration': 3.882}], 'summary': 'Processing paypal transactions, verifying results, and handling email notifications for successful and failed transactions.', 'duration': 102.123, 'max_score': 557.414, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA557414.jpg'}], 'start': 557.414, 'title': 'Handling paypal responses and ipn script checks', 'summary': 'Covers handling paypal response using curl, modifying the result, sending email notifications, and explains the importance of ipn script checks including four verification checks.', 'chapters': [{'end': 617.997, 'start': 557.414, 'title': 'Handling paypal response in curl', 'summary': 'Explains how to handle the response from a paypal posting using curl, including modifying the result and sending notifications via email, based on whether the result is verified or not.', 'duration': 60.583, 'highlights': ['Using Curl and PayPal to handle posting, and then checking the result for verification', 'Modifying the request variable to render as a list by replacing the symbols with line breaks', 'Sending notifications via email with the request list and a message based on the verification result']}, {'end': 810.342, 'start': 618.53, 'title': 'Paypal ipn script checks', 'summary': "Explains the importance of changing 'you at your email dot com' to the paypal business email address in the ipn script, and outlines four checks to ensure transaction verification, including ensuring the business email, payment status, and transaction amount match the expected values.", 'duration': 191.812, 'highlights': ["Changing 'you at your email dot com' to the PayPal business email address is crucial for the proper execution of the IPN script. ", 'The chapter outlines four checks to ensure transaction verification, including ensuring the business email, payment status, and transaction amount match the expected values. 4 checks for transaction verification', "Ensuring the business email returned is the correct business email is the first check, followed by verifying the transaction's payment status, avoiding duplicate transaction IDs, and ensuring the payment amount matches the charged amount. Sequence of checks: 1. Business email, 2. Payment status, 3. Duplicate transaction IDs, 4. Payment amount matching"]}], 'duration': 252.928, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA557414.jpg', 'highlights': ['Using Curl and PayPal to handle posting, and then checking the result for verification', 'Modifying the request variable to render as a list by replacing the symbols with line breaks', 'Sending notifications via email with the request list and a message based on the verification result', 'The chapter outlines four checks to ensure transaction verification, including ensuring the business email, payment status, and transaction amount match the expected values. 4 checks for transaction verification', "Ensuring the business email returned is the correct business email is the first check, followed by verifying the transaction's payment status, avoiding duplicate transaction IDs, and ensuring the payment amount matches the charged amount. Sequence of checks: 1. Business email, 2. Payment status, 3. Duplicate transaction IDs, 4. Payment amount matching", "Changing 'you at your email dot com' to the PayPal business email address is crucial for the proper execution of the IPN script."]}, {'end': 1084.587, 'segs': [{'end': 897.056, 'src': 'embed', 'start': 857.291, 'weight': 0, 'content': [{'end': 865.858, 'text': 'So check number three, you grab the posted transaction ID from this transaction for this IPN message, and you query the database.', 'start': 857.291, 'duration': 8.567}, {'end': 873.071, 'text': 'You select ID transactions, where transaction ID equals this transaction, limit 1.', 'start': 866.465, 'duration': 6.606}, {'end': 877.415, 'text': "So you're just checking to see if this transaction ID already exists in the database.", 'start': 873.071, 'duration': 4.344}, {'end': 884.462, 'text': "If it does, then you want to mail yourself that there's something wrong because there's a duplicate transaction ID trying to get posted to the system.", 'start': 877.435, 'duration': 7.027}, {'end': 886.424, 'text': "And it's not supposed to.", 'start': 885.503, 'duration': 0.921}, {'end': 897.056, 'text': 'Okay, so the last check before we sync this transaction information into our database is you have to check to make sure the price matches and you defeat price jacking.', 'start': 887.594, 'duration': 9.462}], 'summary': 'Check for duplicate transaction id and match price to prevent errors.', 'duration': 39.765, 'max_score': 857.291, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA857291.jpg'}, {'end': 967.232, 'src': 'embed', 'start': 940.28, 'weight': 3, 'content': [{'end': 944.821, 'text': "because it's going to have one extra trailing comma on the end and you really don't want that there.", 'start': 940.28, 'duration': 4.541}, {'end': 948.402, 'text': 'So we remove that last comma off the end of the string.', 'start': 944.861, 'duration': 3.541}, {'end': 955.964, 'text': 'Then we explode the string and make it an array, query all the prices out, add them up and make sure they match up the payment gross amount.', 'start': 948.622, 'duration': 7.342}, {'end': 965.731, 'text': "So we make a new variable called IDStringArray, and it's going to be an array that is made up of the explosion, the product IDString,", 'start': 956.184, 'duration': 9.547}, {'end': 967.232, 'text': 'using comma as delimiter.', 'start': 965.731, 'duration': 1.501}], 'summary': 'Remove trailing comma, explode string to array, query prices, match payment amount.', 'duration': 26.952, 'max_score': 940.28, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA940280.jpg'}, {'end': 1012.939, 'src': 'embed', 'start': 980.142, 'weight': 4, 'content': [{'end': 984.485, 'text': 'In the for each loop is when that full amount variable is going to get compounded.', 'start': 980.142, 'duration': 4.343}, {'end': 988.181, 'text': 'to get the full amount of what the whole cart purchase should be.', 'start': 984.898, 'duration': 3.283}, {'end': 990.142, 'text': 'So here is the for each loop.', 'start': 988.561, 'duration': 1.581}, {'end': 998.168, 'text': "So what you're doing is you're taking that ID string array that we set up here, taking that array and you're busting it down as key value pairs.", 'start': 990.803, 'duration': 7.365}, {'end': 1004.053, 'text': "So for each key value pair within the array, it's going to run one pass through this for each loop.", 'start': 998.528, 'duration': 5.525}, {'end': 1012.939, 'text': "Now here we're going to use another explode function to break the hyphen Remember each item ID has a hyphen next to it and then the quantity number.", 'start': 1004.413, 'duration': 8.526}], 'summary': 'Compounding the full amount variable in a for each loop for each key value pair in the array.', 'duration': 32.797, 'max_score': 980.142, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA980142.jpg'}, {'end': 1052.758, 'src': 'embed', 'start': 1022.012, 'weight': 5, 'content': [{'end': 1025.613, 'text': "So we're using the hyphen as a delimiter here to break those two things apart.", 'start': 1022.012, 'duration': 3.601}, {'end': 1035.818, 'text': 'And then you have product ID separate and product quantity separate by accessing the index number of that little array for the first item.', 'start': 1026.294, 'duration': 9.524}, {'end': 1041.06, 'text': 'And the first item would definitely have an index of zero, and that would be your product ID.', 'start': 1036.018, 'duration': 5.042}, {'end': 1047.943, 'text': 'The second item in that array would definitely be the quantity, and that would have an index of one in that array.', 'start': 1041.319, 'duration': 6.624}, {'end': 1052.758, 'text': 'So once you get the product ID, you can query the database for that product ID here.', 'start': 1048.336, 'duration': 4.422}], 'summary': 'Using hyphen as delimiter to separate product id and quantity, accessing them by index number in an array.', 'duration': 30.746, 'max_score': 1022.012, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA1022012.jpg'}], 'start': 810.342, 'title': 'Transaction checks and cart total calculation', 'summary': 'Covers techniques for checking duplicate transaction ids and matching payment amounts to prevent price jacking, and also explains a script for processing product ids and quantities from the cart, including the calculation of the total cart purchase amount using a for each loop and sql query.', 'chapters': [{'end': 897.056, 'start': 810.342, 'title': 'Checking and connecting transactions', 'summary': 'Focuses on performing checks for duplicate transaction ids and matching payment amounts to prevent price jacking, emphasizing the importance of connecting to the database before executing the checks.', 'duration': 86.714, 'highlights': ['Performing checks for duplicate transaction IDs and matching payment amounts to prevent price jacking.', 'Emphasizing the importance of connecting to the database before executing the checks.', 'Describing the process of querying the database for existing transaction IDs and sending a notification in case of duplicates.', 'Stressing the significance of ensuring the price matches to prevent price jacking.']}, {'end': 1084.587, 'start': 897.696, 'title': 'Script for calculating cart purchase total', 'summary': 'Explains a script for processing the product id and quantities from the cart, trimming the comma off the end, exploding the string to an array, and calculating the total cart purchase amount using a for each loop and sql query.', 'duration': 186.891, 'highlights': ['Exploding the string and making it an array, querying all the prices out, adding them up, and ensuring they match the payment gross amount. The script processes the product ID string by exploding it into an array, querying the prices, adding them up, and confirming their match with the payment gross amount.', 'Using a for each loop to compound the full amount and calculate the total cart purchase. A for each loop is used to calculate the full amount of the cart purchase by compounding the values from the array.', 'Breaking the item ID and the quantity number by using the hyphen as a delimiter and querying the database for the product ID and its price. The script breaks down the item ID and quantity number using a hyphen as a delimiter, then queries the database for the product ID and its price.']}], 'duration': 274.245, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA810342.jpg', 'highlights': ['Performing checks for duplicate transaction IDs and matching payment amounts to prevent price jacking.', 'Describing the process of querying the database for existing transaction IDs and sending a notification in case of duplicates.', 'Stressing the significance of ensuring the price matches to prevent price jacking.', 'Exploding the string and making it an array, querying all the prices out, adding them up, and ensuring they match the payment gross amount.', 'Using a for each loop to compound the full amount and calculate the total cart purchase.', 'Breaking the item ID and the quantity number by using the hyphen as a delimiter and querying the database for the product ID and its price.']}, {'end': 1304.989, 'segs': [{'end': 1133.58, 'src': 'embed', 'start': 1085.083, 'weight': 0, 'content': [{'end': 1091.867, 'text': 'So if they bought two black hats, it would take it and multiply the $10 that the hat cost times two.', 'start': 1085.083, 'duration': 6.784}, {'end': 1098.652, 'text': 'And each product price would be compounded and added to this full amount variable using this line here.', 'start': 1092.268, 'duration': 6.384}, {'end': 1102.614, 'text': 'Full amount is equal to full amount plus product price.', 'start': 1098.912, 'duration': 3.702}, {'end': 1108.398, 'text': "So each product that's in the array is going to compound in this full amount variable.", 'start': 1102.974, 'duration': 5.424}, {'end': 1117.069, 'text': 'Then you can finally run number format on the full amount variable to make sure it has all the zeros it should have after the decimal point.', 'start': 1108.998, 'duration': 8.071}, {'end': 1123.434, 'text': "Then you grab the MC gross or the payment gross that's coming from posted PayPal variables.", 'start': 1117.449, 'duration': 5.985}, {'end': 1129.438, 'text': "So, after all that's over, you have a full amount variable and a gross amount variable.", 'start': 1123.794, 'duration': 5.644}, {'end': 1133.58, 'text': "this is the one gross amounts, the one that's being posted from PayPal.", 'start': 1129.438, 'duration': 4.142}], 'summary': 'Program calculates total cost and payment gross from product prices.', 'duration': 48.497, 'max_score': 1085.083, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA1085083.jpg'}, {'end': 1235.568, 'src': 'embed', 'start': 1154.434, 'weight': 3, 'content': [{'end': 1156.656, 'text': 'You want to do whatever you want, any way you want to handle that.', 'start': 1154.434, 'duration': 2.222}, {'end': 1162.521, 'text': "But just make sure before you go crazy that this programming is correct and you're getting the full amount correctly.", 'start': 1156.856, 'duration': 5.665}, {'end': 1166.825, 'text': 'So when you test a checkout on your site, those should definitely match.', 'start': 1162.581, 'duration': 4.244}, {'end': 1172.31, 'text': "If they don't match and you've done a normal checkout yourself on your site and those don't match,", 'start': 1166.885, 'duration': 5.425}, {'end': 1177.417, 'text': "then you know it's something wrong with my programming And somebody's got to fix it because I'm not fixing it.", 'start': 1172.31, 'duration': 5.107}, {'end': 1178.477, 'text': "Part 20, I'm done.", 'start': 1177.657, 'duration': 0.82}, {'end': 1180.038, 'text': "Even if it doesn't work, I don't care.", 'start': 1178.838, 'duration': 1.2}, {'end': 1182.339, 'text': "I haven't tested it, and I'm not going to test it.", 'start': 1180.358, 'duration': 1.981}, {'end': 1188.002, 'text': 'And you can code that 10, 12 different ways, but the logic is very stiff.', 'start': 1182.639, 'duration': 5.363}, {'end': 1191.883, 'text': 'You want to get the full amount of what the checkout should be.', 'start': 1188.502, 'duration': 3.381}, {'end': 1199.947, 'text': 'You want to gather that information from your database and compare that to what PayPal is saying the person checked out for.', 'start': 1192.464, 'duration': 7.483}, {'end': 1201.408, 'text': "It's very simple.", 'start': 1199.967, 'duration': 1.441}, {'end': 1206.761, 'text': "No matter if my code fails for you or not, That's the logic to approach with your programming.", 'start': 1201.988, 'duration': 4.773}, {'end': 1212.403, 'text': 'All right, so if they make it past all four checks, finally put things into the database.', 'start': 1207.141, 'duration': 5.262}, {'end': 1219.425, 'text': "Now here's some homework for you where I put examples of assigning local variables from the posted variables.", 'start': 1213.263, 'duration': 6.162}, {'end': 1224.166, 'text': 'So you can put the posted variables into local PHP variables.', 'start': 1220.065, 'duration': 4.101}, {'end': 1228.988, 'text': 'That way you can more easily insert things into your database using this query here.', 'start': 1225.027, 'duration': 3.961}, {'end': 1231.609, 'text': "And I've set up this query to match exact.", 'start': 1229.108, 'duration': 2.501}, {'end': 1235.568, 'text': 'for your table if your table matches my table.', 'start': 1232.185, 'duration': 3.383}], 'summary': 'Ensure correct programming for matching checkout amounts to avoid errors and database inconsistencies.', 'duration': 81.134, 'max_score': 1154.434, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA1154434.jpg'}, {'end': 1304.989, 'src': 'embed', 'start': 1279.334, 'weight': 7, 'content': [{'end': 1284.236, 'text': 'Now you got to ship somebody something or let them download some software or whatever.', 'start': 1279.334, 'duration': 4.902}, {'end': 1287.817, 'text': "Okay, so I've enjoyed my time with you guys.", 'start': 1284.716, 'duration': 3.101}, {'end': 1290.757, 'text': 'You have your hands on the source code now if you happen to need it.', 'start': 1287.897, 'duration': 2.86}, {'end': 1292.638, 'text': "And we're all done.", 'start': 1291.497, 'duration': 1.141}, {'end': 1299.188, 'text': 'Remember, if things go wrong, if you find bugs in the system at all, Tackle them.', 'start': 1294.058, 'duration': 5.13}, {'end': 1301.557, 'text': "I'm not going to look at this anymore.", 'start': 1299.951, 'duration': 1.606}, {'end': 1301.978, 'text': "I'm done.", 'start': 1301.617, 'duration': 0.361}, {'end': 1303.162, 'text': 'My hands are clean.', 'start': 1302.299, 'duration': 0.863}, {'end': 1304.989, 'text': 'Bye bye.', 'start': 1304.688, 'duration': 0.301}], 'summary': 'Completion of software handover, urging for bug resolution and sign-off', 'duration': 25.655, 'max_score': 1279.334, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA1279334.jpg'}], 'start': 1085.083, 'title': 'Programming and database management', 'summary': 'Covers calculating gross amount, ensuring correct checkout programming, and php variables, emphasizing accuracy, matching checkout amounts, and addressing system bugs independently.', 'chapters': [{'end': 1154.074, 'start': 1085.083, 'title': 'Calculating gross amount from product prices', 'summary': 'Explains the process of calculating the gross amount from product prices using a loop and conditional evaluation, ensuring accuracy and identifying discrepancies.', 'duration': 68.991, 'highlights': ['The process involves multiplying the cost of each product by the quantity and compounding the product prices to obtain the full amount.', 'The full amount is then compared to the gross amount obtained from PayPal to identify any discrepancies and potential errors.', 'Using the number format function to ensure the accuracy of the full amount after the decimal point is crucial for financial integrity.']}, {'end': 1212.403, 'start': 1154.434, 'title': 'Ensuring correct checkout programming', 'summary': 'Emphasizes the importance of ensuring correct programming for checkout, highlighting the need for matching checkout amounts and the importance of comparing database information with paypal records.', 'duration': 57.969, 'highlights': ['The chapter stresses the importance of matching checkout amounts and ensuring the correctness of programming, emphasizing the need for full amount accuracy and indicating that any mismatch indicates a programming issue.', 'It highlights the significance of comparing database information with PayPal records, outlining a simple logic to approach programming and underlining the importance of this comparison regardless of potential code failures.', 'The chapter mentions the need to test a checkout on the site and the importance of rectifying any programming issues, indicating a firm stance on the responsibility for fixing programming errors.']}, {'end': 1304.989, 'start': 1213.263, 'title': 'Php variables and database query', 'summary': 'Explains how to assign posted variables to local php variables for inserting data into a database query, and concludes with a reminder to address any system bugs independently.', 'duration': 91.726, 'highlights': ['The chapter emphasizes the process of assigning posted variables to local PHP variables to facilitate database query insertion, serving as homework for the audience.', 'It concludes with a reminder to independently tackle any system bugs or issues that may arise, as the presenter will not be involved in further troubleshooting.']}], 'duration': 219.906, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XxlLIHodXBA/pics/XxlLIHodXBA1085083.jpg', 'highlights': ['The process involves multiplying the cost of each product by the quantity and compounding the product prices to obtain the full amount.', 'The full amount is then compared to the gross amount obtained from PayPal to identify any discrepancies and potential errors.', 'Using the number format function to ensure the accuracy of the full amount after the decimal point is crucial for financial integrity.', 'The chapter stresses the importance of matching checkout amounts and ensuring the correctness of programming, emphasizing the need for full amount accuracy and indicating that any mismatch indicates a programming issue.', 'It highlights the significance of comparing database information with PayPal records, outlining a simple logic to approach programming and underlining the importance of this comparison regardless of potential code failures.', 'The chapter mentions the need to test a checkout on the site and the importance of rectifying any programming issues, indicating a firm stance on the responsibility for fixing programming errors.', 'The chapter emphasizes the process of assigning posted variables to local PHP variables to facilitate database query insertion, serving as homework for the audience.', 'It concludes with a reminder to independently tackle any system bugs or issues that may arise, as the presenter will not be involved in further troubleshooting.']}], 'highlights': ['The chapter outlines four checks to ensure transaction verification, including ensuring the business email, payment status, and transaction amount match the expected values. 4 checks for transaction verification', 'The process involves multiplying the cost of each product by the quantity and compounding the product prices to obtain the full amount.', 'The full amount is then compared to the gross amount obtained from PayPal to identify any discrepancies and potential errors.', 'The chapter stresses the importance of matching checkout amounts and ensuring the correctness of programming, emphasizing the need for full amount accuracy and indicating that any mismatch indicates a programming issue.', 'The chapter explains how to set up the PayPal IPN script, including creating custom variables, setting up PDT variables, and obtaining the script from the provided source code link.']}