Dwolla V2 Kotlin provides a Dwolla V2 API client for the Kotlin and Java programming languages.
Add this to your project's POM:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.Dwolla</groupId>
<artifactId>dwolla-v2-kotlin</artifactId>
<version>0.1.2</version>
</dependency>
Add this to your project's build file:
repositories {
// ...
maven(url = "https://jitpack.io") {
name = "jitpack"
}
}
dependencies {
implementation("com.github.Dwolla:dwolla-v2-kotlin:0.1.2")
}
Before making requests, you'll need to set up a Dwolla client using your app credentials.
Your app credentials can be found on the applications page of the Dwolla Dashboard (sandbox, production).
import com.dwolla.Dwolla
import com.dwolla.DwollaEnvironment
val dwolla = Dwolla(
key = "YOUR_APP_KEY",
secret = "YOUR_APP_SECRET",
environment = DwollaEnvironment.SANDBOX // defaults to PRODUCTION
)
import com.dwolla.Dwolla;
import com.dwolla.DwollaEnvironment;
Dwolla dwolla = new Dwolla(
"YOUR_APP_KEY",
"YOUR_APP_SECRET",
DwollaEnvironment.SANDBOX // defaults to PRODUCTION
);
The Dwolla client provides low-level and high-level methods for interacting with the Dwolla API.
The low-level methods get
, post
, and delete
send HTTP requests to the Dwolla API using your app credentials.
These methods are all you need to use the Dwolla API. You can refer to the Dwolla API Docs
for information on supported endpoints, request parameters, and response parameters.
dwolla.get
dwolla.post
dwolla.delete
Examples:
The best SDKs are not just simple; they’re intuitive. Developers would rather stay in the flow of their code than troubleshoot back-and-forth trying to figure out someone else’s code. Luckily, statically typed languages let us include information typically found in docs within type signatures.
While the low-level methods are all you need, high-level methods exist to make things easier. They embed information you would typically refer to the docs for in the SDK itself such as endpoints, request parameters, and response parameters.
As of now, a subset of the Dwolla API has high-level methods available:
-
dwolla.accounts.*
-
dwolla.beneficialOwners.*
-
dwolla.businessClassifications.*
-
dwolla.customers.*
-
dwolla.documents.*
-
dwolla.fundingSources.*
-
dwolla.fundingSourcesTokens.*
-
dwolla.iavTokens.*
-
dwolla.root.*
-
dwolla.events.*
-
dwolla.labels.*
-
dwolla.massPayments.*
-
dwolla.transfers.*
-
dwolla.webhooks.*
-
dwolla.webhookSubscriptions.*
Requests made with Dwolla V2 Kotlin throw two types of exceptions:
DwollaApiException
: Thrown when an API request is unsuccessful. This could occur for a variety of reasons such as invalid request parameters. Details can be found in the exception'serror (DwollaApiError)
object.DwollaAuthException
: Thrown when an error occurs obtaining authenticating with the API. You should not encounter this exception unless yourDwolla
key and/or secret is incorrect. Details can be found in the exception'serror (DwollaAuthError)
object.
try {
dwolla.customers.list()
} catch (e: DwollaApiException) {
e.message // String
e.statusCode // Int
e.headers // Headers
e.error // DwollaError
} catch (e: DwollaApiException) {
e.message // String
e.statusCode // Int
e.headers // Headers
e.error // OAuthError
}
try {
dwolla.customers.list();
} catch (DwollaApiException e) {
String message = e.message;
Integer statusCode = e.statusCode;
Headers headers = e.headers;
DwollaError error = e.error;
} catch (DwollaAuthException e) {
String message = e.message;
Integer statusCode = e.statusCode;
Headers headers = e.headers;
OAuthError error = e.error;
}
If you have any feedback please reach out to us or create an issue.
- 0.1.2
- Add
delete
methods toDwollaClient
- Add
- 0.1.1
- Add serializer for
JsonBody
(#13)
- Add serializer for
- 0.1.0
- Refactoring
Client
=>Dwolla
Environment
=>DwollaEnvironment
DwollaException
=>DwollaApiException
OAuthException
=>DwollaAuthException
- Add OpenID support
dwolla.auth()
dwolla.token()
dwolla.refreshToken()
- Additional high-level APIs
dwolla.accounts.*
dwolla.beneficialOwners.*
dwolla.fundingSources.*
dwolla.fundingSourcesTokens.*
dwolla.iavTokens.*
- Refactored high-level APIs
- Refactoring
- 0.1.0-pre1
- Initial release