6.4 Adding Products
First of all, go to the '06Demo', open the folder 'products' and load the productHX0001.php file on notepad++.Now go to https://developer.paypal.com and log in
Now just go to https://www.sandbox.paypal.com/ and log in using your virtual seller username and password. Click on 'Merchant services' and then on the 'Buy Now Button'.
Fill the 'Buy Now' form with the exact same values that the productHX0001.php has
- Same Product (Item) Name
- Same Item ID Number (it its the filename of the product in this case : productHX0001)
- Same Price
- Same Currency
fig:30 Adding Products Step1
Now control your 'Successful Payment Url' and make sure that the 'Cancel Payment Url' is the same. Set Quantity settings to 'No' and make sure to choose 'No shipping needed' (since the digital products does not need any shipping) and press the 'Create Button Now'. Figure fig:31
fig:31 Adding Products Step2
Your button code will be generated. Just press the 'Select All' button and copy that code. Figure fig:32
fig:32 Adding Products Step3
Paste the button code at the productHX0001.php file (in the $Product['ButtonLink'] attribute). Now your product file should look something like the listing "Product file productHX0001.php" The given button code as you can see is encrypted and this improves the security of our site (Remember that at the step 1 of the generation of the code we selected the encrypted method).
Attention: Sometimes the copied code contains the single quotation character please remove that symbol.
Make payments with PayPal - it's fast, free and secure!
Remove the single quotation like done below :
Make payments with PayPal - it s fast, free and secure!
<?php //1. MODIFY PRODUCT INFORMATIONS $Product['Name']='First Book'; $Product['Price']='5'; $Product['Currency']='USD'; //Possible values: USD , EUR , AUD , GBP , CAD , HKD , JPY $Product['Filename']='ebook.zip'; //2. MODIFY YOUR 'BUY NOW' BUTTON FOR THIS PRODUCT. Copy it from PayPal.com 'Add a Buy Now button'. $Product['ButtonLink'] = ' <form action= "https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="image" src="https://www.sandbox.paypal.com/btn_bnow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.sandbox.paypal.com/pixel.gif" width="1" height="1"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7----- MIIIKwYJKoZIhvcNAQcEoIIIHDCCCBgCAQExggE6MIIBNgAVCAVF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YWxpZm9ybmlhMR EwDwYDVQQHEwhTYW4gSm9zZTEVMBMGA1UEChMMUGF5UGFsLCBJbm MuMRYwFAYDVQQLFA1zYW5kYm94X2NlcnRzMRQwEgYDVQQDFAtzYW 5kYm94X2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQ IBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQ EHATAcBgkqhkiG9w0BCQUxDxcNMDgwNTI2MjM1ODMyWjAjBgkqhk iG9w0BCQQxFgQUrX11wt6WjxnejiNS8FmpKQ8wjlcwDQYJKoZIhv NAQEBBQAEgYAClomnQHECKaULDloLuL9pOl5WQKVJkLEwefaiN17 I+m43iI9ihW7qRx3LaPm+VD0eOizjYFtjJOC9yeQe7OwXJZM1N+1 VHGJ/WhggjBSWlbhCOCvFt57TylcgNEzwx6Aprdxec1z6TZ2Ewjg JJbKhrHsZ5wgu4GJJbdgFIAA==-----END PKCS7----- "> </form> '; //3. MODIFY RESPONCE MESSAGES $Product['DownloadMessage'] = 'Download this product from here. (Max two attempts)'; $Product['ThanksMessage'] = 'Thanks for your purchase.<br>If you have download problems contact with us at company@email.com'; $Product['ErrorMessage'] = 'Your data does not match with the selected product.<br>Please contact with us at company@email.com'; $Product['ReturnToHomepage'] = '<a href="http://www.mysite.com"> Return to Mysite.com </a>'; //DO NOT MODIFY $Product['id']=basename(__FILE__ , ".php"); ?>