1. Go to this page and download the library: Download rixafy/paypal library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rixafy / paypal example snippets
$paypalBuilder = new PaypalLinkBuilder();
$paypalBuilder->setIsShoppingCart(true);
$paypalBuilder->setAccount('[email protected]');
$paypalBuilder->setCurrencyCode('EUR');
$paypalBuilder->setCallBack('https://api.yoursite.com/ipn-receiver');
$paypalBuilder->setLanguage('en_US');
$paypalBuilder->setCustom('customValue'); // should be payment id
$paypalBuilder->setImage('https://example.com/image.png');
$paypalBuilder->setStoreInfo('YourBusinessName', 'BuyNow', 'WPS', 'US');
$paypalBuilder->addItem("Product 1", 5, 10); // qty 5, price 10
$paypalBuilder->addItem("Product 2", 1, 15); // qty 1, price 15
$paypalBuilder->setCustomParameter(0, 'Order ID:', 1885); // up to 6 custom parameters
echo 'Paypal URL is ' . $paypalBuilder; // redirect user to this URL
$paypal = new Paypal($debug = false);
try {
$paypalData = $paypal->verifyRequest($postData);
} catch (PaypalValidationException $e) {
// payment error, invalid payment or some problem with transaction
} catch (PaypalRequestException $e) {
// request is not from paypal domain, probably fake
}
$paymentId = $paypalData->getCustom(); // customValue
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.