C# Dwolla: Create a Customer

Back to Index

Shows how to create a new Customer. To create Unverified Customers, you need to provide only the customer’s full name and email address, as well as a business name if applicable. A successful request is indicated by a response status code of 201 with an empty response body.

Documentation: https://docsv2.dwolla.com/#create-a-customer

CURL Command

curl -X POST https://api-sandbox.dwolla.com/customers \
-H "Content-Type: application/vnd.dwolla.v1.hal+json" \
-H "Accept: application/vnd.dwolla.v1.hal+json" \
-H "Authorization: Bearer DWOLLA_ACCESS_TOKEN" \
-d '{
  "firstName": "Joe",
  "lastName": "Merchant",
  "email": "jmerchant@nomail.net",
  "ipAddress": "99.99.99.99",
  "businessName": "Merchant Joe, Inc."
}'

C# Example

Chilkat.Rest rest = new Chilkat.Rest();
bool success;

//  URL: https://api-sandbox.dwolla.com/customers
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect("api-sandbox.dwolla.com",port,bTls,bAutoReconnect);
if (success != true) {
    Debug.WriteLine("ConnectFailReason: " + Convert.ToString(rest.ConnectFailReason));
    Debug.WriteLine(rest.LastErrorText);
    return;
}

Chilkat.JsonObject json = new Chilkat.JsonObject();
json.UpdateString("firstName","Joe");
json.UpdateString("lastName","Merchant");
json.UpdateString("email","jmerchant@nomail.net");
json.UpdateString("ipAddress","99.99.99.99");
json.UpdateString("businessName","Merchant Joe, Inc.");

rest.AddHeader("Content-Type","application/vnd.dwolla.v1.hal+json");
rest.AddHeader("Authorization","Bearer DWOLLA_ACCESS_TOKEN");
rest.AddHeader("Accept","application/vnd.dwolla.v1.hal+json");

Chilkat.StringBuilder sbRequestBody = new Chilkat.StringBuilder();
json.EmitSb(sbRequestBody);
Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
success = rest.FullRequestSb("POST","/customers",sbRequestBody,sbResponseBody);
if (success != true) {
    Debug.WriteLine(rest.LastErrorText);
    return;
}