Wallogit.com
2017 © Pedro Peláez
PHP class to verify Paypal SDK payments, it verifies both credit card and paypal account transactions using the REST API and Adaptive Payments.
VerifyPaypal is a PHP class to verify Paypal SDK payments, it verifies both credit card and paypal account transactions using the REST API and Adaptive Payments., (*1)
Paypal is currently having an issue with the Rest API in sandbox mode. Testing a credit card will result in an Invalid Resourse ID error. Hopefully this gets fixed soon., (*2)
git clone https://github.com/redfro/VerifyPaypal.git
$ php composer.phar install
require 'VerifyPaypal/vendor/autoload.php';
use the PaypalPayment class, so add this directly under the autoloader.use VerifyPaypal\Classes\PaypalPayment;
(src/VerifyPaypal/Config/VerifyPaypalConfig.php) with your paypal information:/*========== Live Credentials ==========*/
define('CLIENT_ID', '');
define('SECRET_KEY', '');
define('PAYPAL_ID', '');
define('PAYPAL_PW', '');
define('PAYPAL_SIG', '');
define('RECEIVER_EMAIL', '');
/*========== Sandbox Credentials ==========*/
define('CLIENT_ID_SANDBOX', '');
define('SECRET_KEY_SANDBOX', '');
define('PAYPAL_ID_SANDBOX', '');
define('PAYPAL_PW_SANDBOX', '');
define('PAYPAL_SIG_SANDBOX', '');
define('RECEIVER_EMAIL_SANDBOX', '');
"sandbox" or "live":$payment = new PaypalPayment("sandbox");
$payment->verify($json);
The verify() method returns true if the payment is valid, false if not., (*3)
$payment->getStatus();
require 'vendor/autoload.php';
use VerifyPaypal\Classes\PaypalPayment;
$payment = new PaypalPayment("sandbox");
$validPayment = $payment->verify($json);
if ($validPayment)
{
// do something with valid payment
}
echo $payment->getStatus(); // check status message from paypal
You can test if VerifyPaypal is installed correctly by running the following command., (*4)
$ php tests/test.php
This should return "VerifyPaypal was installed correctly!"., (*5)
VerifyPaypal is licensed under the MIT license. See the LICENSE file for more details., (*6)