paypal/paypal-payouts-sdk
最新稳定版本:1.0.1
Composer 安装命令:
composer require paypal/paypal-payouts-sdk
包简介
PayPal's PHP SDK for Payouts REST APIs
README 文档
README
Welcome to PayPal Payouts. This repository contains PayPal's PHP SDK for Payouts and samples for v1/payments/payouts APIs.
This is a part of the next major PayPal SDK. It includes a simplified interface to only provide simple model objects and blueprints for HTTP calls. This repo currently contains functionality for PayPal Payouts APIs which includes Payouts.
Please refer to the PayPal Payouts Integration Guide for more information. Also refer to Setup your SDK for additional information about setting up the SDK's.
Prerequisites
PHP 5.6 and above
An environment which supports TLS 1.2 (see the TLS-update site for more information)
Usage
Binaries
It is not necessary to fork this repository for using the PayPal SDK. Please take a look at PayPal Payouts Server SDK for configuring and working with SDK without forking this code.
For contributing to this repository or using the samples you can fork this repository.
Setting up credentials
Get client ID and client secret by going to https://developer.paypal.com/developer/applications and generating a REST API app. Get Client ID and Secret from there.
require __DIR__ . '/vendor/autoload.php'; use PaypalPayoutsSDK\Core\PayPalHttpClient; use PaypalPayoutsSDK\Core\SandboxEnvironment; // Creating an environment $clientId = "<<PAYPAL-CLIENT-ID>>"; $clientSecret = "<<PAYPAL-CLIENT-SECRET>>"; $environment = new SandboxEnvironment($clientId, $clientSecret); $client = new PayPalHttpClient($environment);
Examples
Creating a Payout
This will create a Payout and print batch id for the created Payouts
use PaypalPayoutsSDK\Payouts\PayoutsPostRequest; $request = new PayoutsPostRequest(); $body= json_decode( '{ "sender_batch_header": { "email_subject": "SDK payouts test txn" }, "items": [ { "recipient_type": "EMAIL", "receiver": "payouts2342@paypal.com", "note": "Your 1$ payout", "sender_item_id": "Test_txn_12", "amount": { "currency": "USD", "value": "1.00" } }] }', true); $request->body = $body; $client = PayPalClient::client(); $response = $client->execute($request); print "Status Code: {$response->statusCode}\n"; print "Status: {$response->result->batch_header->batch_status}\n"; print "Batch ID: {$response->result->batch_header->payout_batch_id}\n"; print "Links:\n"; foreach($response->result->links as $link) { print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; } echo json_encode($response->result, JSON_PRETTY_PRINT), "\n";
Retrieve a Payouts Batch
This will retrieve a payouts batch
$request = new PayoutsGetRequest($batchId); $response = $client->execute($request); echo json_encode($response->result, JSON_PRETTY_PRINT), "\n";
Parsing Failure Response
This will execute a Get request to simulate a failure
try{ $request = new PayoutsGetRequest(null); $response = $client->execute($request); echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; } catch(HttpException $e){ echo $e->getMessage() var_dump(json_decode($e->getMessage())); }
Running tests
To run integration tests using your client id and secret, clone this repository and run the following command:
$ composer install $ CLIENT_ID=YOUR_SANDBOX_CLIENT_ID CLIENT_SECRET=OUR_SANDBOX_CLIENT_SECRET composer unit
You may use the client id and secret above for demonstration purposes.
Samples
You can start off by trying out Samples.
Note: Update the PayPalClient.php with your sandbox client credentials or pass your client credentials as environment variable while executing the samples.
License
Code released under SDK LICENSE
paypal/paypal-payouts-sdk 适用场景与选型建议
paypal/paypal-payouts-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.08M 次下载、GitHub Stars 达 46, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rest」 「sdk」 「paypal」 「payouts」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 paypal/paypal-payouts-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 paypal/paypal-payouts-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 paypal/paypal-payouts-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.
A PayPal IPN (Instant Payment Notification) listener for PHP
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
统计信息
- 总下载量: 1.08M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 46
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04
