百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

laravel-paypalpayment

> 编程语言
开源

Laravel PayPal 支付包,帮助您使用 PayPal API 处理信用卡支付

340 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Laravel PayPal 支付包,帮助您使用 PayPal API 处理信用卡支付

Important :The use of the PayPal REST /payments APIs to accept credit card payments is restricted by paypal and they recomand to use Braintree Direct if you want to accept credit card payments.

Update: I may re-create the package to use Braintree in future but with no deadline. You can also use the braintree/braintree_php library.

Note :

If you're going to use this package with Laravel 4, make sure to require the Laravel 4 branch:

javascript
"require": {
    "anouar/paypalpayment": "dev-l4"
}

laravel-paypalpayment

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.

Donation :

donate a cup of :coffee: :blush: :

Watch a Quick Demo

Installation

Install this package through Composer. To your composer.json file:

javascript
"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.

php
'providers' => array(
    // ...

    Anouar\Paypalpayment\PaypalpaymentServiceProvider::class,
)

Then add an alias under aliases array.

php
'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"

Configuration

Under config/paypal_payment.php configuration file set your paypal client_id and client_secert keys

Samples

Note: If you are not fan of using facade calls, you can resove the paypal payment service like so app('paypalpayment') then assign it to a property.

1-Using credit card as paypent method

Create new controller PaypalPaymentController:

…

2-Using Express Checkout as payment method

…

3-List Payment

Add the index() function to the PaypalPaymentController Controller

php
    /*
        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);

    }

4-Get Payment details

Add the show() function to the PaypalPaymentController Controller

php
    /*
        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.

Conclusion

Please feel free to report issues and open any PRs that you thinks will help to improve the package.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHP

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言