Laravel PayPal 支付包,帮助您使用 PayPal API 处理信用卡支付
If you're going to use this package with Laravel 4, make sure to require the Laravel 4 branch:
"require": {
"anouar/paypalpayment": "dev-l4"
}laravel-paypalpayment is a simple package that helps you to process direct credit card payments, stored credit card payments and PayPal account payments with your Laravel 4/5 projects using PayPal REST API SDK.
donate a cup of :coffee: :blush: :
Install this package through Composer. To your composer.json file:
"require": {
"anouar/paypalpayment": ">=3.0"
}Next, run composer update.
Add the service provider to config/app.php (app/config/app.php for Laravel 4), in the providers array.
'providers' => array(
// ...
Anouar\Paypalpayment\PaypalpaymentServiceProvider::class,
)Then add an alias under aliases array.
'aliases' => array(
// ...
'Paypalpayment' => Anouar\Paypalpayment\Facades\PaypalPayment::class,
)Finaly Pulish the package configuration by running this CMD
php artisan vendor:publish --provider="Anouar\Paypalpayment\PaypalpaymentServiceProvider"Under config/paypal_payment.php configuration file set your paypal client_id and client_secert keys
app('paypalpayment') then assign it to a property.Create new controller PaypalPaymentController:
……Add the index() function to the PaypalPaymentController Controller
/*
Use this call to get a list of payments.
url:payment/
*/
public function index()
{
$payments = Paypalpayment::getAll(['count' => 1, 'start_index' => 0], Paypalpayment::apiContext());
return response()->json([$payments->toArray()], 200);
}Add the show() function to the PaypalPaymentController Controller
/*
Use this call to get details about payments that have not completed,
such as payments that are created and approved, or if a payment has failed.
url:payment/PAY-3B7201824D767003LKHZSVOA
*/
public function show($payment_id)
{
$payment = Paypalpayment::getById($payment_id, Paypalpayment::apiContext());
return response()->json([$payment->toArray()], 200);
}Under the (routes.php for previous versions) or web.php file and register your routing.
Please feel free to report issues and open any PRs that you thinks will help to improve the package.
暂无开放 Issues,或尚未同步最近议题。