1. Go to this page and download the library: Download teknoo/paypal-exprss 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/ */
teknoo / paypal-exprss example snippets
declare(strict_types=1);
overy;
use Http\Discovery\Psr17FactoryDiscovery;
use Teknoo\Paypal\Express\Service\ExpressCheckout;
use Teknoo\Paypal\Express\Transport\PsrTransport;
//Initialize Paypal library
//Transport object to communicate with curl
$transport = new PsrTransport(
HttpClientDiscovery::find(),
Psr17FactoryDiscovery::findUrlFactory(),
Psr17FactoryDiscovery::findRequestFactory(),
Psr17FactoryDiscovery::findStreamFactory(),
'https://api-3t.sandbox.paypal.com/nvp',
'93',
'user id',
'password',
'paypal signature',
'PP-ECWizard'
);
//Paypal service
$service = new ExpressCheckout(
$transport,
'https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token={token}'
);
//Prepare demo purchase
$purchase = new class implementing Teknoo\Paypal\Express\Entity\PurchaseInterface {
// ...
};
//In your html, purchase is an custom object implementing the interface PurchaseInterface
<a href=" echo $service->prepareTransaction($purchase);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.