PHP
Use Dwolla’s SDK for PHP to build applications that interact with the Dwolla API to perform account-to-account payment functions.
PHP
dwolla-swagger-php
is available on Packagist with source code available on our GitHub page.
Getting Started
Installation
To begin using this SDK, you will first need to download it to your machine. We use Packagist to distribute this package, which allows it to be downloaded via Composer.
To use, just require
your Composer autoload.php
file.
Initialization
Before any API requests can be made, you must first determine which environment you will be using, as well as fetch the application key and secret. To fetch your application key and secret, please visit one of the following links:
- Production: https://dashboard.dwolla.com/applications
- Sandbox: https://dashboard-sandbox.dwolla.com/applications
Finally, you can create an instance of ApiClient
after configuring the username
and password
values as the application key and secret that you fetched from one of the aforementioned links, respectively.
Tokens
Application access tokens are used to authenticate against the API on behalf of an application. Application tokens can be used to access resources in the API that either belong to the application itself (webhooks
, events
, webhook-subscriptions
) or the Dwolla Account that owns the application (accounts
, customers
, funding-sources
, etc.). Application tokens are obtained by using the client_credentials
OAuth grant type:
Application access tokens are short-lived: 1 hour. They do not include a refresh_token
. When it expires, generate a new one using $tokensApi->token()
.
Making Requests
The Dwolla client provides high-level methods for interacting with the Dwolla API.
High-Level Requests
High-level methods make development easier by embedding information you would typically refer to Dwolla’s API reference for in the SDK itself, such as endpoints, request arguments, and response deserialization. DwollaSwagger
contains the API
module, which allows the user to make requests, as well as models
, which are data access objects that the library uses to deserialize responses.
Each model represents the different kinds of requests and responses that can be made with the Dwolla API. View the full list in the models
directory.
The following API modules are available:
- Accounts
- Beneficial Owners
- Business Classifications
- Customers
- Documents
- Events
- Funding Sources
- Knowledge-Based Authentication (KBA)
- Labels
- Label Reallocations
- Ledger Entries
- Mass Payment Items
- On-Demand Authorizations
- Root
- Sandbox
- Tokens
- Transfers
- Webhooks
- Webhook Subscriptions
Setting Headers
You can pass custom headers in your requests as per the schema of the API models. Here is an example of creating a Customer with an Idempotency-Key header.
Responses
Success
Errors
You can wrap your requests in a try/catch block to handle errors.
Community
- If you have any feedback, please reach out to us on our forums or by creating a GitHub issue.
- If you would like to contribute to this library, bug reports and pull requests are always appreciated!