PHP code example of itemvirtual / ecommerce-paypal
1. Go to this page and download the library: Download itemvirtual/ecommerce-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/ */
itemvirtual / ecommerce-paypal example snippets
use Itemvirtual\EcommercePaypal\Services\PaypalCheckout;
$EcommercePaypal = new PaypalCheckout();
$EcommercePaypalApprovalLink = null;
$EcommercePaypalOrder = $EcommercePaypal->setTotal(<TotalAmountToPay>)->createOrder();
if ($EcommercePaypalOrder) {
$EcommercePaypalApprovalLink = $EcommercePaypal->getApprovalLink($EcommercePaypalOrder);
$EcommercePaypalOrderId = $EcommercePaypal->getOrderId($EcommercePaypalOrder);
}
use Itemvirtual\EcommercePaypal\Services\PaypalCheckout;
$paypalOrderId = $request->get('token', null);
$EcommercePaypal = new PaypalCheckout();
$EcommercePaypalResponse = $EcommercePaypal->captureOrder($paypalOrderId);
$isOrderSuccessful = $EcommercePaypal->isOrderSuccessful($EcommercePaypalResponse);