You will notice that the account was created successfully, although it failed to add a bank and credit card. To correct this issue, click "Enter Sandbox Test site." Use the login email and password generated earlier.
1. Go to "Profile" -> "Add or Edit Bank account" -> Select "Checking." PayPal Sandbox will auto-populate the routing and account number fields, except for the "Bank name."
2. Enter a fictitious bank name, for example "Codex Bank." Then click "Continue."
3. You will be asked to confirm deposits. Just enter a small amount, like 0.55 and 0.75, and then click "Submit."
4. If you see the message "Bank account confirmed," click "Continue."
5. Now to add a fictitious credit card. Click "Back to Profile Summary," and then go to "Profile" -> "Add or Edit Credit Card."
6. Some fields are populated automatically (like the credit card number and the billing address). Others, such as the expiration date, aren't. For the "Expiration Date" field, you need to set a valid date which will expire in the future -- December 2016, for example. Also, with the "card verification number" field, you might need to change the default 000 to something else, such as 123.
7. Finally, click "Add Card."
8. Log out of your Test buyer account in Sandbox. When you go back to "Test Account," you will notice that the personal account is now "Verified" because you have added a bank account and a credit card number.
9. To add a "seller" account type (which you will use to represent yourself as the merchant), click "Preconfigured," and then, under "Create a Sandbox Test account," make sure you have selected "Seller" under "Account Type."
10. Follow the rest of the instructions, which will be very similar to creating a "Buyer" account type. Take note of the generated passwords and email address, because you will be using this to log in to the seller PayPal Sandbox test site.
Finally, you should have at least one test seller (business) and one test buyer (personal) account in your PayPal Sandbox.
To use these accounts when testing an IPN PHP web application in Sandbox mode:
Integrating PayPal IPN into Your Website Checkout Flow
Suppose you have a website that sells ebooks. You decided to let customers use PayPal to pay you. You can use IPN to validate downloading of ebooks by customers that have completed their payments to you in PayPal.
Details on the PayPal IPN standard can be read here: https://cms.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro
Below is the typical implementation flowchart showing the integration of PayPal IPN into a website:
As you can see, it all starts when a visitor to your website is shopping for items you are offering for sale. When the visitor wants to buy a certain item, they click on the PayPal Buy Now buttons, which will take the visitor to PayPal for payment.
As usual, using website payments standard allows customers to pay you using a credit card or their remaining PayPal balance.
Running in the transaction's background simultaneously (indicated by yellow arrows), the PayPal transaction triggers PayPal's servers to send an IPN message targeted to the IPN PHP script you have added to your PayPal account.
Once your script receives the message from PayPal, it is required to reply, to confirm receipt of IPN communication.
Once your PHP script can provide a reply to PayPal, it will reply with the status of the IPN transaction, which is either VERIFIED or INVALID.
The information posted to your PHP script from PayPal contains a lot of data pertaining to your customer and the transaction. That includes your email address, the payment amount, payment currency, payment status, item number, etc.
Your script should validate all of this information to make sure none of it is spoofed. Once validated, the PHP script will save all of the information to a MySQL database on your website.
This payment receipt email contains the transaction ID as well as other important details, such as the invoice number. The customer will be diverted to a download page on your website after successful payment, and click the "Click here to download your ebook" button in PayPal.
To make sure only verified and paid customers can download the ebook, the customer will enter the invoice number of the transaction, which will be used by the PHP script to fetch the corresponding IPN information saved in the MySQL database.
If the invoice number, as well as other information, is valid, PHP will stream the ebook to the customer for downloading. The PHP script should then update the customer information in the database, indicating that the transaction is complete and the customer has already downloaded the material. This will prevent duplicate transactions.
blog comments powered by Disqus