PayPal, Credit Card Payment API (means PayPal PHP merchant SDK) deals to process a credit card payment or DoDirect Payment on your website.
PayPal Credit Card Payment works in a few steps in the merchant’s website rather than going to the actual PayPal page and then logging in and returning back to the same.
The key thing is, using PayPal Credit Card, the payment process is done on your web page only. As the name also depicts it is a direct payment.
In our previous blog post, we have covered the PayPal Express Checkout for
Digital Goods and
Single Product using PayPal PHP SDK in which the payment process takes place in a different manner.
In this blog post, we are going to explain how we can use PayPal credit card payment in PHP for Direct payment.
Learn php - php tutorial - paypal-credit-card-payment - php examples - php programs
For configuration of PayPal PHP merchant SDK, add your account credentials in the configuration.php.
You can find this file in downloaded project “root folder”.
Then you will be ready to run the project. You can also refer the install.txt file given in the download code folder.
Note: In demo we have used Sandbox and demo VISA card for testing, for making it live you have to edit configuration.php config array mode, sandbox to live as shown below.
Tutorial Scripts in detail
Below are the details of the code used in this tutorial with proper explanation.
In index.php contain code for showing product details. Here we demonstrate simple Bag seller site. When buyers click on the Buy now button it posts product information data to getcreditcard.php page.
Getcreditcard.php page get credit card details and billing address and post all information to DoDirectPayment.php.
DoDirectPayment.php take all posted data and process to PayPal for payment.
Includes basic styling of HTML elements.