Plaid PHP SDK supporting:
- Link tokens
- Auth
- Items
- Accounts
- Institutions
- Webhooks
- Identity
- Income
- Assets
- Balance
- Liabilities
- Investments
- Payment Initiation (UK only)
- Processors (Stripe & Dwolla)
For full description of request and response payloads and properties, please see the official Plaid API docs.
- PHP 7.2+
- ext-curl
- ext-json
composer require tomorrow-ideas/plaid-sdk-phpInstantiate the Plaid client class with your credentials.
$client = new \TomorrowIdeas\Plaid\Plaid("your-client-id", "your-secret", "your-public-key");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
$client->setEnvironment("sandbox");The Plaid client by default uses API version 2019-05-29. You can change the version by calling the setVersion method.
Possible API versions:
- 2019-05-29
- 2018-05-22
- 2017-03-08
$client->setVersion("2019-05-29");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"
];use TomorrowIdeas\Plaid\Plaid;
require __DIR__ . "/vendor/autoload.php";
$plaid = new Plaid(
\getenv("PLAID_CLIENT_ID"),
\getenv("PLAID_CLIENT_SECRET"),
\getevv("PLAID_PUBLIC_KEY")
);
$plaid->setEnvironment(
\getenv("PLAID_ENVIRONMENT")
);
$item = $plaid->getItem("itm_1234");For a full description of the response payload, please see the official Plaid API docs.
createLinkToken(
string $client_name,
string $language,
array $country_codes,
string $client_user_id,
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): objectgetAuth(string $access_token, array $options = []): object[?]
getLiabilities(string $access_token, array $options = []): object[?]
getItem(string $access_token): object[?]removeItem(string $access_token): object[?]createPublicToken(string $access_token): object[?]exchangeToken(string $public_token): object[?]rotateAccessToken(string $access_token): object[?]
getWebhookVerificationKey(string $key_id): object[?]updateWebhook(string $access_token, string $webhook): object[?]
getAccounts(string $access_token): object[?]
getInstitution(string $institution_id, array $options = []): object[?]getInstitutions(int $count, int $offset, array $options = []): object[?]findInstitution(string $query, array $products, array $options = []): object[?]
getTransactions(string $access_token, DateTime $start_date, DateTime $end_date, array $options = []): object[?]
getBalance(string $access_token, array $options = []): object[?]
getIdentity(string $access_token): object[?]
getIncome(string $access_token): object[?]
createAssetReport(array $access_tokens, int $days_requested, array $options = []): object[?]refreshAssetReport(string $asset_report_token, int $days_requested, array $options = []): object[?]filterAssetReport(string $asset_report_token, array $exclude_accounts): object[?]getAssetReport(string $asset_report_token, bool $include_insights = false): object[?]getAssetReportPdf(string $asset_report_token): ResponseInterface[?] Note: 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 headers. See official Plaid API docs for more information.removeAssetReport(string $asset_report_token): object[?]createAssetReportAuditCopy(string $asset_report_token, string $auditor_id): object[?]removeAssetReportAuditCopy(string $audit_copy_token): object[?]
getInvestmentHoldings(string $access_token, array $options = []): object[?]getInvestmentTransactions(string $access_token, DateTime $start_date, DateTime $end_date, array $options = []): object[?]
createRecipient(string $name, string $iban, RecipientAddress $address): object[?] Note: See the Entities section for details about theRecipientAddressentity needed for this method.getRecipient(string $recipient_id): object[?]listRecipients(): object[?]createPayment(string $recipient_id, string $reference, float $amount, string $currency, PaymentSchedule $payment_schedule = null): object[?]createPaymentToken(string $payment_id): object[?]getPayment(string $payment_id): object[?]listPayments(array $options = []): object[?]
createStripeToken(string $access_token, string $account_id): object[?]createDwollaToken(string $access_token, string $account_id): object[?]
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");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")
);All unsuccessfull (non 2xx) responses will throw a PlaidRequestException. The full response object is available via the getResponse() method.