PHP code example of chilloutalready / paypal
1. Go to this page and download the library: Download chilloutalready/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/ */
chilloutalready / paypal example snippets
php
// Get a Payment instance using the ExpressCheckout driver
$payment = OpenBuildings\PayPal\Payment::instance('ExpressCheckout');
// Set the order
$payment->order(array(
'items_price' => 10,
'shipping_price' => 3,
'total_price' => 13
));
// Set additional params needed for ExpressCheckout
$payment->return_url('example.com/success');
$payment->cancel_url('example.com/success');
// Send a SetExpressCheckout API call
$response = $payment->set_express_checkout();
// Finish the payment with the token and the payer id received.
$payment->do_express_checkout_payment($response['TOKEN'], $response['PAYERID']);