1. Go to this page and download the library: Download dalpras/payment-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/ */
dalpras / payment-paypal example snippets
use DalPraS\Payment\PayPal\Config\PayPalConfig;
use DalPraS\Payment\PayPal\Http\PayPalHttpClient;
use DalPraS\Payment\PayPal\Mapper\PayPalOrderMapper;
use DalPraS\Payment\PayPal\Provider\PayPalProvider;
$config = new PayPalConfig(
clientId: 'sandbox-client-id',
clientSecret: 'sandbox-client-secret',
sandbox: true,
webhookId: null,
brandName: 'My Store',
);
$httpClient = new PayPalHttpClient(
config: $config,
httpClient: $psr18Client,
requestFactory: $requestFactory,
streamFactory: $streamFactory,
);
$provider = new PayPalProvider(
config: $config,
httpClient: $httpClient,
mapper: new PayPalOrderMapper(),
);