Integrate PayPal SDK Into Laravel 4 & Laravel 5
PayPal has release an official SDK to simplify our work. Here I want to show you how to integrate into Laravel. (Version 4 and 5)
-
Install PayPal SDK via composer
Edit file composer.json
{
...
"require": {
...
"paypal/rest-api-sdk-php": "*"
},
...
}
Update the dependencies
$ php composer.phar update --no-dev
You can now use the PayPal package in the project.
-
Configure PayPal
Add a config file for paypal: app/config/paypal.php
<?php
return array(
// set your paypal credential
'client_id' => 'AcT3DS8a-SmTEtSl9hNcwyscoLypndD9q5L0YcfxmaUavz3p_xwFNRE-OauO',
'secret' => 'ENv8_RCXMfhcrzdSfAWjLWDiD_GJSD-Gbm5q2Pj92vIuobCtgLpR3SUxqAhZ',
/**
* SDK configuration
*/
'settings' => array(
/**
* Available option 'sandbox' or 'live'
*/
'mode' => 'sandbox',
/**
* Specify the max request time in seconds
*/
'http.ConnectionTimeOut' => 30,
/**
* Whether want to log to a file
*/
'log.LogEnabled' => true,
/**
* Specify the file that want to write on
*/
'log.FileName' => storage_path() . '/logs/paypal.log',
/**
* Available option 'FINE', 'INFO', 'WARN' or 'ERROR'
*
* Logging is most verbose in the 'FINE' level and decreases as you
* proceed towards ERROR
*/
'log.LogLevel' => &#
Link:
This post is submitted by our members. Submit a new post.
Tags: v4.x Tutorials Laravel 5 Laravel 5.1 Laravel 5.2 Intermediate v4.1 v4.2