C#
Dwolla.Client
is available on Nuget 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 NuGet to distribute this package. Check out the Microsoft documentation for more information on how to install and manage packages from Nuget using Visual Studio.
Here’s an example using the Package Manager Console
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:
Finally, you can create an instance of DwollaClient
by specifying which environment you will be using—Production or Sandbox—via the isSandbox
boolean flag.
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 AppTokenRequest
.
Making Requests
Once you’ve created a DwollaClient
, currently, you can make low-level HTTP requests.
Low-Level Requests
To make low-level HTTP requests, you can use the GetAsync()
, PostAsync()
, UploadAsync()
and DeleteAsync()
methods with the available request models. These methods will return responses that can be mapped to one of the available response models.
Setting Headers
To specify headers for a request (e.g., Authorization
), you can pass a Headers
object as the last argument.
GET
POST
DELETE
Example App
Take a look at the Example Application for examples on how to use the available C# models to call the Dwolla API. Before you can begin using the app, however, you will need to specify a DWOLLA_APP_KEY
and DWOLLA_APP_SECRET
environment variable.
Docker
If you prefer to use Docker to run ExampleApp locally, a Dockerfile file is included in the root directory. You can either build the Docker image with your API key and secret (by passing the values via CLI), or you can specify the values for the app_key
and app_secret
build arguments in Dockerfile. Finally, you will need to build and run the Docker image. More information on this topic can be found on Docker’s website, or you can find some example commands below.
Building Docker Container
Running Container Instance
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!