cihansenturk/plaid-sdk-php
Composer 安装命令:
composer require cihansenturk/plaid-sdk-php
包简介
PHP implementation of Plaid's API as an SDK.
README 文档
README
Plaid PHP SDK supporting:
- Link tokens
- Auth
- Items
- Accounts
- Institutions
- Webhooks
- Identity
- Income
- Assets
- Balance
- Liabilities
- Investments
- Payment Initiation (UK only)
- Processors (including Stripe & Dwolla)
- Bank Transfers (US only)
- Sandbox
Official Plaid API docs
For full description of request and response payloads and properties, please see the official Plaid API docs.
Requirements
- PHP 7.3+ | PHP 8.0+
- ext-curl
- ext-json
Installation
composer require tomorrow-ideas/plaid-sdk-php
Configuration
Instantiate the Plaid client class with your credentials.
$client = new \TomorrowIdeas\Plaid\Plaid("your-client-id", "your-secret", "environment");
Environments
The Plaid client by default uses the production Plaid API hostname for all API calls. You can change the environment by using the setEnvironment method.
Possible environments:
- production
- development
- sandbox
Options
Many methods allow the passing of options to the Plaid endpoint. These options should be an associative array of key/value pairs. The exact options supported are dependent on the endpoint being called. Please refer to the official Plaid documentation for more information.
$options = [ "foo" => "bar", "baz" => "bat" ];
Example
use TomorrowIdeas\Plaid\Plaid; require __DIR__ . "/vendor/autoload.php"; $plaid = new Plaid( \getenv("PLAID_CLIENT_ID"), \getenv("PLAID_CLIENT_SECRET"), \getenv("PLAID_ENVIRONMENT") ); $item = $plaid->items->get("itm_1234");
Resources
For a full description of the response payload, please see the official Plaid API docs.
Accounts
Resource: accounts
Reference: https://plaid.com/docs/#accounts
Methods:
list(string $access_token, array $options = []): objectgetBalance(string $access_token, array $options = []): objectgetIdentity(string $access_token): object
Example:
$accounts = $plaid->accounts->list($access_token);
Auth
Resource: auth
Reference: https://plaid.com/docs/#auth
Methods:
get(string $access_token, array $options = []): object
Example:
$auth = $plaid->auth->get($access_token);
Bank Transfers (U.S. only)
Resource: bank_transfers
Reference: https://plaid.com/docs/bank-transfers/
Methods:
create( string $access_token, string $idempotency_key, string $type, string $account_id, string $network, string $amount, string $currency_code, AccountHolder $account_holder, string $description, string $ach_class = null, string $custom_tag = null, array $metadata = [], string $origination_account_id = null): object
cancel(string $bank_transfer_id): objectget(string $bank_transfer_id): objectlist( ?DateTime $start_date = null, ?DateTime $end_date = null, ?int $count = null, ?int $offset = null, ?string $direction = null, ?string $origination_account_id = null): objectgetEventList( ?DateTime $start_date = null, ?DateTime $end_date = null, ?string $bank_transfer_id = null, ?string $account_id = null, ?string $bank_transfer_type = null, array $event_type = [], ?int $count = null, ?int $offset = null, ?string $direction = null, ?string $origination_account_id = null): objectsyncEvents(string $after_id, ?int $count = null): objectmigrateAccount(string $account_number, string $routing_number, string $account_type): objectgetOriginationAccountBalance(string $origination_account_id = null): object
Example:
$transfers = $plaid->bank_transfers->list();
Categories
Resource: categories
Reference: https://plaid.com/docs/api/products/#categoriesget
Methods:
list(): object
Example:
$categories = $plaid->categories->list();
Institutions
Resource: institutions
Reference: https://plaid.com/docs/api/institutions/
Methods:
get(string $institution_id, array $country_codes, array $options = []): objectlist(int $count, int $offset, array $country_codes, array $options = []): objectfind(string $query, array $country_codes, array $products = [], array $options = []): object
Example:
$institutions = $plaid->institutions->list(20, 0);
Investments
Resource: investments
Reference: https://plaid.com/docs/api/products/#investments
Methods:
listHoldings(string $access_token, array $options = []): objectlistTransactions(string $access_token, DateTime $start_date, DateTime $end_date, array $options = []): object
Example:
$holdings = $plaid->investments->listHoldings($access_token);
Tokens
Resource: tokens
Reference: https://plaid.com/docs/api/tokens/
Methods:
create(string $client_name, string $language, array $country_codes, User $user, array $products = [], ?string $webhook = null, ?string $link_customization_name = null, ?AccountFilters $account_filters = null, ?string $access_token = null, ?string $redirect_url = null, ?string $android_package_name = null, ?string $payment_id = null): object
get(string $link_token): object
Example:
$token = $plaid->tokens->create($client_name, $language, ["US","CA"], $user_id);
Liabilities
Resource: liabilities
Reference: https://plaid.com/docs/api/products/#liabilities
Methods:
list(string $access_token, array $options = []): object
Example:
$liabilities = $plaid->liabilities->list($access_token);
Items
Resource: items
Reference: https://plaid.com/docs/api/items/
Methods:
get(string $access_token): objectremove(string $access_token): objectgetIncome(string $access_token): objectcreatePublicToken(string $access_token): objectexchangeToken(string $public_token): objectrotateAccessToken(string $access_token): object
$item = $plaid->items->get($access_token);
Webhooks
Resource: webhooks
Reference: https://plaid.com/docs/api/webhooks/
Methods:
getVerificationKey(string $key_id): objectupdate(string $access_token, string $webhook): object
Example:
$verification_key = $plaid->webhooks->getVerificationKey($key_id);
Transactions
Resource: transactions
Reference: https://plaid.com/docs/api/products/#transactions
Methods:
list(string $access_token, DateTime $start_date, DateTime $end_date, array $options = []): objectrefresh(string $access_token): objectsync(string $access_token, ?string $cursor = null, ?int $count = null, array $options = []): objectrecurring(string $access_token, array $account_ids, array $options = []): object
Example:
$transactions = $plaid->transactions->list($access_token, $start_date, $end_date);
Reports
Resource: reports
Reference: https://plaid.com/docs/assets/
Methods:
createAssetReport(array $access_tokens, int $days_requested, array $options = []): objectrefreshAssetReport(string $asset_report_token, int $days_requested, array $options = []): objectfilterAssetReport(string $asset_report_token, array $exclude_accounts): objectgetAssetReport(string $asset_report_token, bool $include_insights = false): objectgetAssetReportPdf(string $asset_report_token): ResponseInterfaceNote: Because this endpoint returns PDF content in the repsponse body, this method returns an instance of a PSR-7ResponseInterface. You may leverage theResponseobject to stream the PDF back to the requesting client and access response headersremoveAssetReport(string $asset_report_token): objectcreateAssetReportAuditCopy(string $asset_report_token, string $auditor_id): objectremoveAssetReportAuditCopy(string $audit_copy_token): object
Payment Initiation (UK only)
Resource: payments
Reference: https://plaid.com/docs/#payment-initiation
Methods:
createRecipient(string $name, string $iban, RecipientAddress $address): objectgetRecipient(string $recipient_id): objectlistRecipients(): objectcreate(string $recipient_id, string $reference, float $amount, string $currency, PaymentSchedule $payment_schedule = null): objectcreateToken(string $payment_id): objectget(string $payment_id): objectlist(array $options = []): object
Example:
$plaid->payments->createRecipient($name, $iban, $address);
Processors
Resource: processors
Reference: https://plaid.com/docs/api/processors
Methods:
createToken(string $access_token, string $account_id, string $processor): objectgetAuth(string $processor_token): objectgetBalance(string $processor_token): objectgetIdentity(string $processor_token): objectcreateStripeToken(string $access_token, string $account_id): object[?]createDwollaToken(string $access_token, string $account_id): object[?]
Sandbox
Resource: sandbox
Reference: https://plaid.com/docs/api/sandbox/
Methods:
createPublicToken(string $institution_id, array $initial_products, array $options = []): objectresetLogin(string $access_token): objectsetVerificationStatus(string $access_token, string $account_id, string $verification_status): objectfireWebhook(string $access_token, string $webhook_code = "DEFAULT_UPDATE"): objectsimulateBankTransfer(string $bank_transfer_id, string $event_type, ?string $ach_return_code = null, ?string $failure_description = null): object
Example:
$response = $plaid->sandbox->fireWebhook($access_token);
Entities
User
The TomorrowIdeas\Plaid\Entities\User entity is used to represent your end user when creating a new link token.
Example:
$token_user = new User( string $id, ?string $name = null, ?string $phone_number = null, ?string $phone_number_verified_time = null, ?string $email_address = null, ?string $ssn = null, ?string $date_of_birth = null )
RecipientAddress
The TomorrowIdeas\Plaid\Entities\RecipientAddress entity is used to represent an address object for the recipient of a payment request.
Example:
$address = new TomorrowIdeas\Plaid\Entities\RecipientAddress("123 Elm St.", "Apt 1", "Anytown", "ABC 123", "GB");
PaymentSchedule
Example:
The TomorrowIdeas\Plaid\Entities\PaymnentSchedule entity is used when creating a new payment that will be a recurring charge.
See createPayment method for more information.
$payment_schedule = new TomorrowIdeas\Plaid\Entities\PaymnentSchedule( PaymentSchedule::INTERVAL_MONTHLY, 15, new DateTime("2020-10-01") );
Errors
All unsuccessfull (non 2xx) responses will throw a PlaidRequestException. The full response object is available via the getResponse() method.
cihansenturk/plaid-sdk-php 适用场景与选型建议
cihansenturk/plaid-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 924 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 07 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sdk」 「plaid」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cihansenturk/plaid-sdk-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cihansenturk/plaid-sdk-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cihansenturk/plaid-sdk-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple package for creating a Stripe Bank Account Token from a Plaid token.
Laravel specific wrapper for Plaid. Bankdata for developers.
Plaid for Laravel
PHP implementation of Plaid's API as an SDK.
Alfabank REST API integration
PHP implementation of Plaid's API as an SDK.
统计信息
- 总下载量: 924
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-25