1. Go to this page and download the library: Download clippings/omnipay-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/ */
$purchase = $gateway->purchase(array(
'currency' => 'GBP',
'amount' => '15.00',
'description' => 'This is a purchase',
));
$purchase = $gateway->purchase(array(
'currency' => 'GBP',
'amount' => '15.00',
'description' => 'This is a purchase',
'redirectUrl' => 'http://example.com/completed',
'cancelUrl' => 'http://example.com/cancel',
));
$response = $purchase->send();
// redirect to $response->getRedirectUrl()
$response->redirect();
$key = $response->getTransactionReference();
// You'll need to pass $key as well as "payerid" query parameter that you'll get from paypal redirecting back to your site
$completePurchase = $gateway->completePurchase(array(
'transactionReference' => $key,
'payerId' => $_GET['PAYERID'],
));
$response2 = $completePurchase->send();