Dwolla SDK for PHP
This repository contains the source code for Dwolla's PHP-based SDK as generated by this fork of swagger-codegen, which allows developers to interact with Dwolla's server-side API via a PHP API. Any action that can be performed via an HTTP request can be made using this SDK when executed within a server-side environment.
Note: Temporary PHP 7.4 support was added using these replacements:
\$this\->([a-z0-9\_]+) = \$data\["([a-z0-9\_]+)"\]\;into
\$this->$1 = \$data\["$2"\] ?? null;
Table of Contents
- Getting Started
- Making Requests
- Additional Resources
$ composer require dwolla/dwollaswagger $ composer install
To use, just
require your Composer
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
password values as the application key and secret that you fetched from one of the aforementioned links, respectively.
DwollaSwagger\Configuration::$username = "API_KEY"; DwollaSwagger\Configuration::$password = "API_SECRET"; # For Sandbox $apiClient = new DwollaSwagger\ApiClient("https://api-sandbox.dwolla.com"); # For Production $apiClient = new DwollaSwagger\ApiClient("https://api.dwolla.com");
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 (
webhook-subscriptions) or the Dwolla Account that owns the application (
funding-sources, etc.). Application tokens are obtained by using the
client_credentials OAuth grant type:
$tokensApi = new DwollaSwagger\TokensApi($apiClient); $appToken = $tokensApi->token();
Application access tokens are short-lived: 1 hour. They do not include a
refresh_token. When it expires, generate a new one using
The Dwolla client provides high-level methods for interacting with the Dwolla API.
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
The following API modules are available:
- Beneficial Owners
- Business Classifications
- Funding Sources
- Knowledge-Based Authentication (KBA)
- Label Reallocations
- Ledger Entries
- Mass Payment Items
- On-Demand Authorizations
- Webhook Subscriptions
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.
$customersApi = new DwollaSwagger\CustomersApi($apiClient); $customer = $customersApi->create([ "firstName" => "Jane", "lastName" => "Merchant", "email" => "email@example.com", "type" => "receive-only", "businessName" => "Jane Corp llc", "ipAddress" => "22.214.171.124" ], [ "Idempotency-Key" => "51a62-3403-11e6-ac61-9e71128cae77" ]); $customer; # => "https://api-sandbox.dwolla.com/customers/fc451a7a-ae30-4404-aB95-e3553fcd733f"
- 1.7.0: New
getCustomerCardTokenmethod added to
CustomersAPIfor creating a card funding sources token for a customer.
- 1.6.0: New
TokenApiadding support for application access token and client token requests.
- 1.5.0: API schema updated,
CustomersApiupdated to add support for
- 1.4.1: Fix bug in #43 to replace null-coalesce operator with backwards-compatible ternary.
- 1.4.0: Add temporary support fix for PHP 7.4. Issue #41. (Thanks, @oprypkhantc!)
- 1.3.0: Add support for custom headers on all requests. (e.g. Idempotency-Key header)
- 1.2.0: Add
KbaApi. See GitHub Releases for more information.
- 1.1.0: Add
- 1.0.20: Fix previously patched issue with parsing Location header in 201 response in ApiClient.
- 1.0.19: Patch 201 response in ApiClient.
- 1.0.18: Patch controller in CreateCustomer model.
- 1.0.17: Update
CustomersApito update support beneficial owners. Update existing models.
- 1.0.16: See GitHub Releases for more information.
- 1.0.15: Optional parameters set to null.
- 1.0.14: Trim trailing slash from host url on initialization.
- 1.0.13: Add control over IPV4 and V6 connections.
- 1.0.12: Update
CustomersApito allow for null
- 1.0.11: Allow pausing webhook subscription pause; Added support for
removedfunding source query params; and more.
- 1.0.10: Patch soft delete to deserialize with FundingSource model.
- 1.0.9: Add boolean type to fix deserialization
- 1.0.8: Add balance check endpoint in
FundingSourcesApi. Fix transfer failure deserialization in transfer model.
- 1.0.7: API schema updated,
CustomersAPIsupports Customer search, new softDelete method in
- 1.0.6: Update
TransfersApito include cancel and getting transfer fees. Added some new models and updated some existing models.
- 1.0.5: API schema error fixed,
FundingSourceobject now has
_embeddedkey to fix serialization issues. Avoid using reserved PHP function names.
CustomersApigets endpoint for IAV verification. Added
- 1.0.3: Added
access_tokenin compliance with RFC-6749 nomenclature.
- 1.0.2: New methods added for
FundingsourcesApi. More idiomatic response logic for HTTP 201 responses.
- 1.0.1: API schema updated, new methods in
- 1.0.0: Initial release.
- 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!
To learn more about Dwolla and how to integrate our product with your application, please consider visiting the following resources and becoming a member of our community!
- Dwolla Developers
- SDKs and Tools
- Developer Support Forum
This wrapper is semantically generated by a fork of swagger-codegen.