MENU
Pdcflowlogo
PHP CSharp Perl Ruby

Introduction

Welcome to the PDCflow API Docs! Here you can find information and examples on the diverse selection of APIs used to integrate with PDCflow.

Attribute Tables

Attribute tables include all of the critical information that you will use to integrate with our APIs. The example below shows you where to find each piece of information for an Attribute.

Attribute Description
Attribute Name
FormatMax Length
If Required/Conditional
This is where there will be a description of the Attribute and what it is used for.
Format: formatted-sample
Constraint(s): Explanation of constraint(s)
Valid value(s): value1, value2
Default: The Default Value

Code Samples

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
// Libraries needed. On an Ubuntu system, run the following commands:

sudo apt-get install php7.0-soap
sudo apt-get install php-curl
sudo apt-get install php-json

Debugging SOAP in PHP:
Add tracing:
<?php $client = new SoapClient($url, array('trace' => 1)); ?>

Output the results of the trace:
<?php var_dump( $client->__getLastRequest() ); ?>

Debugging REST in PHP:
<?php curl_setopt($curl, CURLOPT_VERBOSE, true); ?>
# Libraries needed. On an Ubuntu system, run the following commands:

sudo apt-get install cpanminus
sudo cpan App::cpanminus (take defaults)
sudo cpanm LWP::Authen::Wsse
sudo cpanm SOAP::Lite
# Libraries needed. On an Ubuntu system, run the following commands:

sudo apt-get install ruby-dev
sudo apt-get install zlib1g-dev
sudo gem install savon
sudo gem install curl
sudo apt-get install libcurl4-gnutls-dev
sudo gem install curb

You can view sample code in the dark area to the right. We provide examples in PHP, Perl, & Ruby. For the code samples to work, each language will require the installation of specific libraries which are listed to the right.

Integrator Forum

If you can’t find the information you are looking for, need an example not provided here, or have a specific question you want answered head over to our API Forum.

Company Administration Service

The Company Administration Service allows easy integration for creating, modifying, and retrieving of Companies, Locations and Groups, and their related Settings. Requests are made through POST, PUT, PATCH, GET or DELETE requests.

Authentication for the CompanyAdministrationService will be done with a Base64 encoded username:password, passed in through the BASIC HTTP Authorization Header.
Any endpoints under /companies are accessible to get or modify even if the company is INACTIVE.
Any endpoints under /locations or groups can only be retrieved, modified or created for an ACTIVE company.

General Service Notes

POST Create a new entity.
PUT Update and overwrite an existing entity.
PATCH Update portions of an existing entity. In general, fields will be updated if supplied and contain a non-null value. If supplied value is empty "", the field will be cleared. If supplied value is null, the field will not be changed.
GET Retrieve a single entity or a list of entities.
DELETE Delete an existing entity.
RESPONSE In general, fields will only be returned if their value is not null or empty.

Using this service, you can manage information about your company, such as a description for the company, your billing information and who gets emailed for invoices.

Company


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies

PUT an updated Company which will overwrite existing values
GET a Company. This endpoint will also create a new Setting record if one does not exist
PATCH an updated Company which will overwrite existing values if not null

Request Examples
Response Example

Click to view Full Company Object

Company Object:

{
  "companyId": 1234,
  "billing": {
    "autoBilling": true,
    "paymentMethod": "CARD",
    "billingCard": {
      "cardToken": "thisIsAToken1234",
      "expirationMonth": 12,
      "expirationYear": 24
    },
    "billingCheck": {
      "bankAccountNumber": "123456789",
      "bankRoutingNumber": "987654321"
    },
    "address": {
      "streetAddressOne": "My billing",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "username": "user@test.com",
    "invoiceBreakdownLevel": "LOCATION"
  },
  "settings": {
    "name": "Best Company",
    "description": "Our company is great",
    "address": {
      "streetAddressOne": "My company",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Thank you for doing what you did.",
    "scheduleText": "Thank you for setting up payments with us.",
    "cardFeeAmount": "1.25",
    "achFeeAmount": "2.50",
    "hierarchyDisplaySetting": "COMPANY",
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2020-06-01 12:00:15",
    "dateModified": "2020-12-16 05:13:22"
  },
  "billingEmails": {
    "primaryList": [
      "test@test.com",
      "test3@test.com"
    ],
    "secondaryList": [
      "test2@test.com"
    ]
  },
  "billToCompany": {
    "companyId": "2222",
    "companyName": "I Will Pick Up the Tab"
  }
}
Attribute Description
companyId
Numeric
The id of the Company.
billing
Object
The Billing data for this Company.
Attribute Description
autoBilling
Boolean5
Boolean to specify if Auto Billing is enabled. PDCflow will send you an invoice and will automatically charge your payment method.
paymentMethod
Alpha5
The Billing Payment Method.
Valid Values: CARD, CHECK.
billingCard
Object
The BillingCard data.
Attribute Description
cardToken
Alphanumeric16
The billing card token that represents the credit card to be used for processing.
expirationMonth
Numeric2
The expiration month of the credit card.
expirationYear
Numeric4
The expiration year of the credit card.
billingCheck
Object
The BillingCheck data.
Attribute Description
bankAccountNumber
Alphanumeric20
The Bank Account Number to be used for processing.
bankRoutingNumber
Numeric9
The Routing Number for the Bank.
address
Object
Billing address of the company. This is specifically for the billing method.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the billing method.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
username
Alphanumeric60
The name of the User performing the request.
NOTE: This field is not returned in the response.
invoiceBreakdownLevel
Alpha8
To what level the company invoice will be broken down at the end of the billing cycle. For example, if set to LOCATION, the invoice will show billing broken down by how much each location processed. An empty value will default to COMPANY. Valid Values: COMPANY, GROUP, LOCATION.
settings
Object
The Settings for this Company. NOTE: The following fields cannot be modified and are ignored if passed in: name, cardAccountDirectiveList, achAccountDirectiveList.
Attribute Description
name
Alphanumeric100
The name of the company.
description
Alphanumeric150
A description of the company.
address
Object
Address for this company.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the company.
Required for Company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
Required for Company.
state
Alphanumeric2
State.
Required for Company.
zip
NumericString5
Zip Code.
Required for Company.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
Required for Company.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by this company.
scheduleText
Alphanumeric5000
Text that will show on a schedule for this company.
cardFeeAmount
Numeric7
Fee for a card transaction processed by this company.
achFeeAmount
Numeric7
Fee for an ach transaction processed by this company.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
allowedCardTypes
List4
Readonly
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
dateCreated
Date
Date created.
Format: URL Encoded ISO-8601
dateModified
Date
Date modified.
Format: URL Encoded ISO-8601
hierarchyDisplay
ObjectN/A
Display information for the company, group, or location. This is based on the hierarchyDisplaySetting.
Attribute Description
name
Alphanumeric100
The name of the location, group, or company.
address
Object
Address of the location/group/company. Depending on what hierarchy level this is from, parts of this object may be null.
Attribute Description
streetAddressOne
Alphanumeric60
Street Address One.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
billingEmails
Object
The billingEmails for this Company. These emails will receive an invoice each month and also notification when the payment on the invoice has failed or been completed successfully.
Attribute Description
primaryList
List
A list of email addresses for which billing invoices and bill processing details will be posted. These email addresses, comma separated, cannot exceed 100 characters. The total email addresses in this BillingEmails object cannot exceed a count of 10. There is no difference between this list and the secondaryList. If you exceed the count or length limits on this list, add more emails to the other.
secondaryList
List
A list of email addresses for which billing invoices and bill processing details will be posted. These email addresses, comma separated, cannot exceed 100 characters. The total email addresses in this BillingEmails object cannot exceed a count of 10. There is no difference between this list and the primaryList. If you exceed the count or length limits on this list, add more emails to the other.
billToCompany
ObjectN/A
Readonly
Which company this company is being billed to. If this is not null, then no billing will be returned for this company.
Attribute Description
companyId
Numeric8
The id of the company being billed to.
companyName
Alphanumeric45
The name of the company being billed to.

–Company Retrieval

GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies


Sample Response:

{
  "companyId": 1234,
  "billing": {
    "autoBilling": true,
    "paymentMethod": "CARD",
    "billingCard": {
      "cardToken": "thisIsAToken1234",
      "expirationMonth": 12,
      "expirationYear": 24
    },
    "address": {
      "streetAddressOne": "My billing",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "username": "user@test.com",
    "invoiceBreakdownLevel": "COMPANY"
  },
  "settings": {
    "name": "Best Company",
    "description": "Our company is great",
    "address": {
      "streetAddressOne": "My company",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Thank you for doing what you did.",
    "scheduleText": "Thank you for setting up payments with us.",
    "cardFeeAmount": "1.25",
    "achFeeAmount": "2.50",
    "hierarchyDisplaySetting": "COMPANY",
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2020-06-01 12:00:15",
    "dateModified": "2020-12-16 05:13:22"
  },
  "billingEmails": {
    "primaryList": [
      "test@test.com",
      "test3@test.com"
    ]
  }
}

Retrieve details about your company. https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies

–Modify your Company

PATCH :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies


Sample Response:

{
  "companyId": 1234,
  "billing": {
    "autoBilling": true,
    "paymentMethod": "CARD",
    "billingCard": {
      "cardToken": "thisIsAToken1234",
      "expirationMonth": 12,
      "expirationYear": 24
    },
    "address": {
      "streetAddressOne": "My billing",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "username": "user@test.com",
    "invoiceBreakdownLevel": "COMPANY"
  },
  "settings": {
    "name": "Best Company",
    "description": "Our company is great",
    "address": {
      "streetAddressOne": "My company",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Thank you for doing what you did.",
    "scheduleText": "Thank you for setting up payments with us.",
    "cardFeeAmount": "1.25",
    "achFeeAmount": "2.50",
    "hierarchyDisplaySetting": "COMPANY",
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2020-06-01 12:00:15",
    "dateModified": "2020-12-16 05:13:22"
  },
  "billingEmails": {
    "primaryList": [
      "test@test.com",
      "test3@test.com"
    ]
  }
}

PATCH requests will modify only the specified parts of your company. Below are the fields and options that can be modified. Required fields cannot be set to null.

Attribute Description
billing
Object
You can update your company’s billing information.
Click to view the Billing object
autoBilling
Boolean5
Required
Boolean to specify if Auto Billing is enabled. PDCflow will send you an invoice and will automatically charge your payment method.
paymentMethod
Alpha5
Conditional
The Billing Payment Method.
Valid Values: CARD, CHECK.
Required if autoBilling is true.
billingCard
Object
Conditional
The BillingCard data. Required for CARD paymentMethod.
Click to see the Billing Card object
cardToken
Alphanumeric16
Required
The billing card token that represents the credit card to be used for processing.
expirationMonth
Numeric2
Required
The expiration month of the credit card.
expirationYear
Numeric4
Required
The expiration year of the credit card.
billingCheck
Object
Conditional
The BillingCheck data. Required for CHECK paymentMethod.
Click to see the Billing Check object
bankAccountNumber
Alphanumeric20
Required
The Bank Account Number to be used for processing.
bankRoutingNumber
Numeric9
Required
The Routing Number for the Bank.
address
Object
Required
Billing address of the company. This is specifically for the billing method.
Click to see the Address object
streetAddressOne
Alphanumeric60
Required
Street Address One. This is specifically for the billing address.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
Required
City.
state
Alphanumeric2
Required
State.
zip
NumericString5
Required
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Conditional
Country.
username
Alphanumeric60
Required
The name of the User performing the request.
NOTE: This field is not returned in the response.
invoiceBreakdownLevel
Alpha8
To what level the company invoice will be broken down at the end of the billing cycle. For example, if set to LOCATION, the invoice will show billing broken down by how much each location processed. An empty value will default to COMPANY. Valid Values: COMPANY, GROUP, LOCATION.
settings
Object
Required
The Settings for this Company. NOTE: The following fields cannot be modified and are ignored if passed in: name, cardAccountDirectiveList, achAccountDirectiveList.
Click to see the Settings object
description
Alphanumeric150
A description of the company.
address
Object
Address for this company.
Click to see the Address object
streetAddressOne
Alphanumeric60
Required
The main street address for your company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
Required
City.
state
Alphanumeric2
Required
State.
zip
NumericString5
Required
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Required
Country.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by this company.
scheduleText
Alphanumeric5000
Text that will show on a schedule for this company.
cardFeeAmount
Numeric7
Fee for a card transaction processed by this company.
achFeeAmount
Numeric7
Fee for an ach transaction processed by this company.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
billingEmails
Object
The billingEmails for this Company. These emails will receive an invoice each month and also notification when the payment on the invoice has failed or been completed successfully.
Click here to see the BillingEmails object
primaryList
List
A list of email addresses for which billing invoices and bill processing details will be posted. These email addresses, comma separated, cannot exceed 100 characters. The total email addresses in this BillingEmails object cannot exceed a count of 10. There is no difference between this list and the secondaryList. If you exceed the count or length limits on this list, add more emails to the other.
secondaryList
List
A list of email addresses for which billing invoices and bill processing details will be posted. These email addresses, comma separated, cannot exceed 100 characters. The total email addresses in this BillingEmails object cannot exceed a count of 10. There is no difference between this list and the primaryList. If you exceed the count or length limits on this list, add more emails to the other.

Group Object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups

POST to create a new Group
PUT to update a Group overwriting all existing values
GET to get a Group or list of Groups
DELETE to delete a Group record. Any associated locations will still exist but will be unassigned from any group

Request Examples
Response Example

Click to view Full Group Object

Group Object:

{
  "groupId": 1111,
  "customId": "MyFacilityId4321",
  "locationCount": 1,
  "locationIds": [
    12
  ],
  "settings": {
    "name": "Best Group",
    "description": "Our group is great",
    "address": {
      "streetAddressOne": "My group",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Thank you for doing what you did.",
    "scheduleText": "Thank you for setting up payments with us.",
    "cardFeeAmount": "1.25",
    "achFeeAmount": "2.50",
    "hierarchyDisplaySetting": "GROUP",
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2020-06-01 12:00:15",
    "dateModified": "2020-12-16 05:13:22"
  },
  "locations": [
    {
      "locationId": 12,
      "customId": "123456",
      "activation": true,
      "groupId": 1111,
      "settings": {
        "name": "The Best Location",
        "description": "The Best Location that anyone could have.",
        "address": {
          "streetAddressOne": "There's a place",
          "streetAddressTwo": "On ocean avenue",
          "city": "Yeehaw",
          "state": "LA",
          "zip": "12345",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Location receipt text",
        "scheduleText": "Thanks for scheduling with this location",
        "cardFeeAmount": 3.33,
        "achFeeAmount": 3.33,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "122-1",
            "name": "Card not present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "123-1",
            "name": "Business Account"
          },
          {
            "accountDirective": "123-2",
            "name": "Digitally Authorized"
          }
        ],
        "dateCreated": "2019-08-29 14:56:49",
        "dateModified": "2020-05-13 07:08:55"
      }
    }
  ]
}
Attribute Description
groupId
Numeric
The id of the Group.
customId
AlphaNumeric25
A custom, editable id for the group.
locationIds
ListN/A
List of ids for associated Locations in the Group.
locationCount
Numeric
The number of associated Locations in the Group.
settings
Object
The Settings for this Group.
Attribute Description
name
Alphanumeric100
The name of the group.
description
Alphanumeric150
A description of the group.
address
Object
Address for this group.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the group in your company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by locations in this group.
scheduleText
Alphanumeric5000
Text that will show on a schedule for locations in this group.
cardFeeAmount
Numeric7
Fee for a card transaction processed by locations in his group.
achFeeAmount
Numeric7
Fee for an ach transaction processed by locations in this group.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
allowedCardTypes
List4
Readonly
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
dateCreated
Date
Date created.
Format: URL Encoded ISO-8601
dateModified
Date
Date modified.
Format: URL Encoded ISO-8601
hierarchyDisplay
ObjectN/A
Display information for the company, group, or location. This is based on the hierarchyDisplaySetting.
Attribute Description
name
Alphanumeric100
The name of the location, group, or company.
address
Object
Address of the location/group/company. Depending on what hierarchy level this is from, parts of this object may be null.
Attribute Description
streetAddressOne
Alphanumeric60
Street Address One.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
locations
ListN/A
List of associated Locations NOTE: This list is only returned when a single Group is requested.

–Group Creation

POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups


Sample Response:

{
  "groupId": 1111,
  "customId": "My1234Custom",
  "settings": {
    "name": "Best Group",
    "description": "Our group is great",
    "address": {
      "streetAddressOne": "My group",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Thank you for doing what you did.",
    "scheduleText": "Thank you for setting up payments with us.",
    "cardFeeAmount": "1.25",
    "achFeeAmount": "2.50",
    "hierarchyDisplaySetting": "GROUP",
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2020-06-01 12:00:15",
    "dateModified": "2020-12-16 05:13:22"
  }
}
Attribute Description
customId
AlphaNumeric25
A custom, editable id for the group.
locationIds
ListN/A
List of ids for associated Locations in the Group.
settings
Object
Required
The Settings for this Group.
Attribute Description
name
Alphanumeric100
Required
The name of the group.
description
Alphanumeric150
A description of the group.
address
Object
Address for this group. This will show on locations that have the hierarchyDisplaySetting set to GROUP and are assigned to this group.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the group. This is only required for Company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by locations in this group.
scheduleText
Alphanumeric5000
Text that will show on a schedule for locations in this group.
cardFeeAmount
Numeric7
Fee for a card transaction processed by locations in this group.
achFeeAmount
Numeric7
Fee for an ach transaction processed by locations in this group.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
allowedCardTypes
List4
Readonly
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
locations
ListN/A
Readonly
List of associated Locations NOTE: This is only returned when a single Group is requested.

–Group Modification

PUT :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}


Sample Response:

{
  "groupId": 1111,
  "customId": "MyFacilityId4321",
  "locationCount": 1,
  "locationIds": [
    12
  ],
  "settings": {
    "name": "Best Group",
    "description": "Our group is great",
    "address": {
      "streetAddressOne": "My group",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345"
    },
    "receiptText": "Thank you for doing what you did.",
    "scheduleText": "Thank you for setting up payments with us.",
    "cardFeeAmount": "1.25",
    "achFeeAmount": "2.50",
    "hierarchyDisplaySetting": "COMPANY",
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2020-06-01 12:00:15",
    "dateModified": "2020-12-16 05:13:22"
  },
  "locations": [
    {
      "locationId": 12,
      "customId": "123456",
      "activation": true,
      "groupId": 1111,
      "settings": {
        "name": "The Best Location",
        "description": "The Best Location that anyone could have.",
        "cardFeeAmount": 3.33,
        "achFeeAmount": 3.33,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "122-1",
            "name": "Card not present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "123-2",
            "name": "Digitally Authorized"
          }
        ],
        "dateCreated": "2019-08-29 14:56:49",
        "dateModified": "2020-05-13 07:08:55"
      }
    }
  ]
}

PUT requests will completely override the existing specified (by groupId in the URL) group. As such, the request object the same as the group creation.

Click to view the group object
Attribute Description
customId
AlphaNumeric25
A custom, editable id for the group.
locationIds
ListN/A
List of ids for associated Locations in the Group.
settings
Object
Required
The Settings for this Group.
Attribute Description
name
Alphanumeric100
The name of the group.
description
Alphanumeric150
A description of the group.
address
Object
Address for this group. This will show on locations that have the hierarchyDisplaySetting set to GROUP and are assigned to this group.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the group. This is only required for Company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by locations in this group.
scheduleText
Alphanumeric5000
Text that will show on a schedule for locations in this group.
cardFeeAmount
Numeric7
Fee for a card transaction processed by locations in this group.
achFeeAmount
Numeric7
Fee for an ach transaction processed by locations in this group.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
allowedCardTypes
List4
Readonly
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
locations
ListN/A
Readonly
List of associated Locations NOTE: This is only returned when a single Group is requested.

–Group Retrieval List

GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups


Sample Response:

{
  "groupList": [
    {
      "groupId": 2123,
      "locationCount": 1,
      "locationIds": [
        2
      ],
      "settings": {
        "name": "Group Name Unique",
        "description": "Group Description",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "Apt 2",
          "city": "Coyote",
          "state": "CA",
          "zip": "84123",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Receipt Text",
        "scheduleText": "Schedule Text",
        "cardFeeAmount": 1.00,
        "achFeeAmount": 4.00,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "3333-1",
            "name": "Card not present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "2222-4",
            "name": "Business Account"
          }
        ],
        "dateCreated": "2020-04-16 12:21:53",
        "dateModified": "2020-04-28 12:26:01"
      }
    },
    {
      "groupId": 2323,
      "customId": "2233",
      "locationCount": 1,
      "locationIds": [
        3333
      ],
      "settings": {
        "name": "Another Group Online",
        "address": {
          "streetAddressOne": "1",
          "city": "Here",
          "state": "UT",
          "zip": "88444",
          "country": "US"
        },
        "cardAccountDirectiveList": [
          {
            "accountDirective": "7777-3",
            "name": "Card present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "1234-10",
            "name": "PPD"
          },
          {
            "accountDirective": "1234-11",
            "name": "WEB"
          },
          {
            "accountDirective": "1234-12",
            "name": "TEL"
          },
          {
            "accountDirective": "1234-5",
            "name": "CCD"
          }
        ],
        "dateCreated": "2020-10-15 19:53:11",
        "dateModified": "2020-10-15 19:53:11"
      }
    }
  ]
}

Retrieve a list of all groups.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups

–Group Retrieval Individual

GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}


Sample Response:

{
  "groupId": 1111,
  "customId": "MyFacilityId4321",
  "locationCount": 1,
  "locationIds": [
    12
  ],
  "settings": {
    "name": "Best Group",
    "description": "Our group is great",
    "address": {
      "streetAddressOne": "My group",
      "streetAddressTwo": "address",
      "city": "New York",
      "state": "AK",
      "zip": "12345"
    },
    "receiptText": "Thank you for doing what you did.",
    "scheduleText": "Thank you for setting up payments with us.",
    "cardFeeAmount": "1.25",
    "achFeeAmount": "2.50",
    "hierarchyDisplaySetting": "COMPANY",
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2020-06-01 12:00:15",
    "dateModified": "2020-12-16 05:13:22"
  },
  "locations": [
    {
      "locationId": 12,
      "customId": "123456",
      "activation": true,
      "groupId": 1111,
      "settings": {
        "name": "The Best Location",
        "description": "The Best Location that anyone could have.",
        "cardFeeAmount": 3.33,
        "achFeeAmount": 3.33,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "122-1",
            "name": "Card not present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "123-2",
            "name": "Digitally Authorized"
          }
        ],
        "dateCreated": "2019-08-29 14:56:49",
        "dateModified": "2020-05-13 07:08:55"
      }
    }
  ]
}

Retrieve an individual group by groupId.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/1111

POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups


Sample Response:

{
  "groupList": [
    {
      "groupId": 2123,
      "locationCount": 1,
      "customId": "MyFacility1234",
      "locationIds": [
        2
      ],
      "settings": {
        "name": "Group Name Unique",
        "description": "Group Description",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "Apt 2",
          "city": "Coyote",
          "state": "CA",
          "zip": "84123",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Receipt Text",
        "scheduleText": "Schedule Text",
        "cardFeeAmount": 1.00,
        "achFeeAmount": 4.00,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "3333-1",
            "name": "Card not present",
            "accountDirective": "111-1",
            "name": "Card not present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "2222-4",
            "name": "Business Account"
          }
        ],
        "dateCreated": "2020-04-16 12:21:53",
        "dateModified": "2020-04-28 12:26:01"
      }
    },
    {
      "groupId": 2323,
      "customId": "MyFacility2233",
      "locationCount": 1,
      "locationIds": [
        3333
      ],
      "settings": {
        "name": "Another Group Online",
        "address": {
          "streetAddressOne": "1",
          "city": "Here",
          "state": "UT",
          "zip": "88444",
          "country": "US"
        },
        "cardAccountDirectiveList": [
          {
            "accountDirective": "7777-3",
            "name": "Card present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "1234-10",
            "name": "PPD"
          },
          {
            "accountDirective": "1234-11",
            "name": "WEB"
          },
          {
            "accountDirective": "1234-12",
            "name": "TEL"
          },
          {
            "accountDirective": "1234-5",
            "name": "CCD"
          }
        ],
        "dateCreated": "2020-10-15 19:53:11",
        "dateModified": "2020-10-15 19:53:11"
      }
    }
  ]
}
Attribute Description
groupName
Alphanumeric
Find Groups by their Name (partial match). For example, if there is a Group named “My Cool Group”, this Group could be found by passing in groupName=cool.
groupIdList
List
Find Groups by their groupId.
customIdList
List
Find Groups by their customId. If this parameter is present but empty in the request, the search will return groups with a customId that is null.

Retrieve a list of all groups that match search parameters.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups

–Group Deletion

DELETE :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}


Delete an individual group by groupId.

Location


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations

POST a new Location record
PUT an updated Location which will overwrite all existing values
GET a Location or list of Locations
PATCH an updated Location which will overwrite existing values if not null

A Location cannot be deleted. Rather, it can be inactivated such that it cannot be used, but will still be available for reporting.

Request Examples
Response Example

Click to view Full Location Object

Location Object:

{
  "locationId": 12,
  "customId": "123456",
  "activation": true,
  "groupData": {
    "id": 123,
    "name": "Best Group",
    "customId": "Group123"
  },
  "settings": {
    "name": "The Best Location",
    "description": "The Best Location that anyone could have.",
    "address": {
      "streetAddressOne": "There's a place",
      "streetAddressTwo": "On ocean avenue",
      "city": "Yeehaw",
      "state": "LA",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Location receipt text",
    "scheduleText": "Thanks for scheduling with this location",
    "cardFeeAmount": 3.33,
    "achFeeAmount": 3.33,
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2019-08-29 14:56:49",
    "dateModified": "2020-05-13 07:08:55"
  }
}
Attribute Description
locationId
Numeric
The id of the Location.
customId
Alphanumeric25
A custom unique identifier for referencing this location.
activation
Boolean5
Boolean stating if this Location is Active or Deactivated.
groupData
Object
Readonly
Data pertaining to the Group this Location is a part of. If this location does not belong to a group, this field will not be present.
Attribute Description
groupId
Numeric
The id of the Group.
customId
AlphaNumeric25
A custom, editable id for the group.
name
Numeric100
The name of the group.
settings
Object
The Settings for this Location.
Attribute Description
name
Alphanumeric100
The name of the location.
description
Alphanumeric150
A description of the location.
address
Object
Address for this location.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the location in your company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by this location.
scheduleText
Alphanumeric5000
Text that will show on a schedule for this location.
cardFeeAmount
Numeric7
Fee for a card transaction processed by this location.
achFeeAmount
Numeric7
Fee for an ach transaction processed by this location.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
allowedCardTypes
List4
Readonly
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
dateCreated
Date
Date created.
Format: URL Encoded ISO-8601
dateModified
Date
Date modified.
Format: URL Encoded ISO-8601
hierarchyDisplay
ObjectN/A
Display information for the company, group, or location. This is based on the hierarchyDisplaySetting.
Attribute Description
name
Alphanumeric100
The name of the location, group, or company.
address
Object
Address of the location/group/company. Depending on what hierarchy level this is from, parts of this object may be null.
Attribute Description
streetAddressOne
Alphanumeric60
Street Address One.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.

–Location Creation

POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations


Sample Response:

{
  "locationId": 12,
  "customId": "123456",
  "activation": true,
  "groupId": 1111,
  "settings": {
    "name": "The Best Location",
    "description": "The Best Location that anyone could have.",
    "address": {
      "streetAddressOne": "There's a place",
      "streetAddressTwo": "On ocean avenue",
      "city": "Yeehaw",
      "state": "LA",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Location receipt text",
    "scheduleText": "Thanks for scheduling with this location",
    "cardFeeAmount": 3.33,
    "achFeeAmount": 3.33,
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2019-08-29 14:56:49",
    "dateModified": "2020-05-13 07:08:55"
  }
}
Attribute Description
customId
Alphanumeric25
A custom unique identifier for referencing this location.
activation
Boolean5
Boolean stating if this Location is Active or Deactivated.
groupId
Numeric
The ID of the Group this location is a part of.
settings
Object
The Settings for this Location.
Attribute Description
name
Alphanumeric100
Required
The name of the group.
description
Alphanumeric150
A description of the group.
address
Object
Address for this group.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the group in your company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by locations in this group.
scheduleText
Alphanumeric5000
Text that will show on a schedule for locations in this group.
cardFeeAmount
Numeric7
Fee for a card transaction processed by locations in his group.
achFeeAmount
Numeric7
Fee for an ach transaction processed by locations in this group.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
allowedCardTypes
List4
Readonly
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.

–Location Modification

PUT :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{locationId}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{locationId}


Sample Response:

{
  "locationId": 12,
  "customId": "123456",
  "activation": true,
  "groupId": 1111,
  "settings": {
    "name": "The Best Location",
    "description": "The Best Location that anyone could have.",
    "address": {
      "streetAddressOne": "There's a place",
      "streetAddressTwo": "On ocean avenue",
      "city": "Yeehaw",
      "state": "LA",
      "zip": "12345",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "receiptText": "Location receipt text",
    "scheduleText": "Thanks for scheduling with this location",
    "cardFeeAmount": 3.33,
    "achFeeAmount": 3.33,
    "cardAccountDirectiveList": [
      {
        "accountDirective": "111-1",
        "name": "Card not present",
        "allowedCardTypeList": [
          "AMERICAN_EXPRESS",
          "DISCOVER",
          "MASTERCARD",
          "VISA"
        ]
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account"
      },
      {
        "accountDirective": "123-2",
        "name": "Telephone Initiated"
      }
    ],
    "dateCreated": "2019-08-29 14:56:49",
    "dateModified": "2020-05-13 07:08:55"
  }
}

PUT requests will completely override the existing specified (by locationId in the URL) location. As such, the request object the same as the location creation.

Click to view example
Attribute Description
customId
Alphanumeric25
A custom unique identifier for referencing this location.
activation
Boolean5
Boolean stating if this Location is Active or Deactivated.
groupId
Numeric
The ID of the Group this location is a part of.
settings
Object
The Settings for this Location.
Attribute Description
name
Alphanumeric100
Required
The name of the group.
description
Alphanumeric150
A description of the group.
address
Object
Address for this group.
Attribute Description
streetAddressOne
Alphanumeric60
The main street address for the group in your company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
City.
state
Alphanumeric2
State.
zip
NumericString5
Zip Code.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Country.
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by locations in this group.
scheduleText
Alphanumeric5000
Text that will show on a schedule for locations in this group.
cardFeeAmount
Numeric7
Fee for a card transaction processed by locations in his group.
achFeeAmount
Numeric7
Fee for an ach transaction processed by locations in this group.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name, address, receiptText and scheduleText will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
allowedCardTypes
List4
Readonly
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.

–Location Retrieval List

GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations


Sample Response:

{
  "locationList": [
    {
      "locationId": 12,
      "customId": "1568834964",
      "activation": true,
      "groupData": {
        "id": 1111,
        "name": "BestGroup",
        "customId": "3333Group"
      },
      "settings": {
        "name": "First location",
        "description": "big number 1",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "1568834964",
          "city": "Clinton",
          "state": "AZ",
          "zip": "84444",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "scheduleText": "Schedule Text 1568834964",
        "cardFeeAmount": 6.00,
        "achFeeAmount": 3.00,
        "dateCreated": "2019-08-29 07:16:34",
        "dateModified": "2020-08-11 05:28:10"
      }
    },
    {
      "locationId": 16,
      "customId": "1568834598",
      "activation": true,
      "settings": {
        "name": "Second location",
        "description": "the #1",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "1568834598",
          "city": "Sweet",
          "state": "IN",
          "zip": "11225",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Receipt Text 1568834598",
        "scheduleText": "Schedule Text 1568834598",
        "dateCreated": "2019-08-29 07:19:10",
        "dateModified": "2020-06-23 04:49:57"
      }
    },
    {
      "locationId": 33,
      "customId": "898465",
      "activation": true,
      "settings": {
        "name": "This location name",
        "dateCreated": "2019-09-10 11:53:09",
        "dateModified": "2020-04-15 09:29:32"
      }
    }
  ]
}

Retrieve a list of all locations.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations

–Location Retrieval Individual

GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{locationId}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{locationId}


Sample Response:

{
  "locationId": 12,
  "customId": "1568834964",
  "activation": true,
  "groupData": {
    "id": 1111,
    "name": "Barney",
    "customId": "MyGroup1"
  },
  "settings": {
    "name": "First location",
    "description": "big number 1",
    "address": {
      "streetAddressOne": "1234 W 5678 S",
      "streetAddressTwo": "1568834964",
      "city": "Clinton",
      "state": "AZ",
      "zip": "84444",
      "zipPlusFour": "1234",
      "country": "US"
    },
    "scheduleText": "Schedule Text 1568834964",
    "cardFeeAmount": 6.00,
    "achFeeAmount": 3.00,
    "dateCreated": "2019-08-29 07:16:34",
    "dateModified": "2020-08-11 05:28:10"
  }
}

Retrieve an individual location by locationId.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/12

POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations


Sample Response:

{
  "locationList": [
    {
      "locationId": 12,
      "customId": "1568834964",
      "activation": true,
      "groupData": {
        "id": 1111,
        "name": "BestGroup",
        "customId": "3333Group"
      },
      "settings": {
        "name": "First location",
        "description": "big number 1",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "1568834964",
          "city": "Clinton",
          "state": "AZ",
          "zip": "84444",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "scheduleText": "Schedule Text 1568834964",
        "cardFeeAmount": 6.00,
        "achFeeAmount": 3.00,
        "dateCreated": "2019-08-29 07:16:34",
        "dateModified": "2020-08-11 05:28:10"
      }
    },
    {
      "locationId": 16,
      "customId": "1568834598",
      "activation": true,
      "groupData": {
        "id": 222,
        "name": "Barn Group",
        "customId": "321d"
      },
      "settings": {
        "name": "Second location",
        "description": "the #1",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "1568834598",
          "city": "Sweet",
          "state": "IN",
          "zip": "11225",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Receipt Text 1568834598",
        "scheduleText": "Schedule Text 1568834598",
        "dateCreated": "2019-08-29 07:19:10",
        "dateModified": "2020-06-23 04:49:57"
      }
    },
    {
      "locationId": 33,
      "customId": "898465",
      "activation": true,
      "settings": {
        "name": "This location name",
        "dateCreated": "2019-09-10 11:53:09",
        "dateModified": "2020-04-15 09:29:32"
      }
    }
  ]
}
Attribute Description
locationNameOrCustomId
Alphanumeric
Find Locations by their Name (partial match) or Custom ID (partial match). For example, if there is a Location named “My Cool Location”, this Location could be found by passing in locationNameOrCustomId=cool.
activation
Boolean
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will return.
isAssignedToGroup
Boolean
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will return.
locationIdList
NumericListN/A
Retrieve all Locations with a locationId in this list.

Retrieve a list of all locations that match search parameters.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations

Effective Settings

These endpoints are to retrieve all the data to be used for request. This will combine all the data, inherited up to the COMPANY if it is empty or null in any of the children (Group or Location). Objects retrieved from this endpoint will also include the inheritedFromGroup and/or the inheritedFromCompany variables that specify which values were inherited.

Use this endpoint to retrieve a list of group objects, with their effective settings and an inheritedFromCompany field that defines which fields were inherited, filtered by GroupSearchParameters.
POST to retrieve a list of locations.

View GroupSearchParameters - Parameters to search groups by.
View Group object - A list of Group objects will be the response.

POST :
Test endpoint: https://scheduledemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/effectivesettings/search
Live endpoint: https://schedule.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/effectivesettings/search


Sample Response:

{
  "groupList": [
    {
      "groupId": 1,
      "locationCount": 3,
      "locationIds": [
        6,
        7,
        8
      ],
      "settings": {
        "name": "Group One",
        "description": "This is a group",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "Bldg 23",
          "city": "New York",
          "state": "MT",
          "zip": "12345",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Company Receipt Text",
        "scheduleText": "Company Schedule Text",
        "cardFeeAmount": 11.00,
        "achFeeAmount": 1.50,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "111-1",
            "name": "Regular",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "VISA"
            ]
          },
          {
            "accountDirective": "111-2",
            "name": "Card Present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-1",
            "name": "Telephone Initiated"
          },
          {
            "accountDirective": "222-2",
            "name": "Digitally Authorized"
          }
        ],
        "dateCreated": "2020-03-18 09:01:40",
        "dateModified": "2020-04-12 06:48:20",
        "inheritedFromCompany": [
          "receiptText",
          "scheduleText",
          "cardFeeAmount",
          "cardAccountDirectiveList",
          "achAccountDirectiveList"
        ]
      }
    },
    {
      "groupId": 2,
      "locationCount": 1,
      "locationIds": [
        12
      ],
      "settings": {
        "name": "Northern Group",
        "description": "A group in the north region",
        "address": {
          "streetAddressOne": "1234 W 5678 S",
          "streetAddressTwo": "Bldg 23",
          "city": "Miami",
          "state": "FL",
          "zip": "54321",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Group Receipt Text",
        "scheduleText": "Group Schedule Text",
        "cardFeeAmount": 10.00,
        "achFeeAmount": 6.50,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "111-1",
            "name": "Regular",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-1",
            "name": "Telephone Initiated"
          }
        ],
        "dateCreated": "2020-04-11 09:01:40",
        "dateModified": "2020-04-12 08:14:00"
      }
    }
  ]
}

POST to retrieve a list of groups, with their effective settings, based on the parameters.

Attribute Description
groupName
Alphanumeric
Find Groups by their Name. This will search for any name that contains the search parameter.
groupIdList
NumericListN/A
Retrieve all Groups with a groupId in this list.

Use this endpoint to retrieve a list of location objects, with their settings inherited from their group or company, filtered by LocationSearchParameters.
POST to retrieve a list of locations with their inherited settings.

View LocationSearchParameters - Parameters to search locations by.
View Location object - A list of Location objects, with their inherited settings, will be the response.

POST :
Test endpoint: https://scheduledemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/effectivesettings/search
Live endpoint: https://schedule.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/effectivesettings/search


Sample Response:

{
  "locationList": [
    {
      "locationId": 12,
      "customId": "MyFirstLocation",
      "activation": true,
      "settings": {
        "name": "Best location name",
        "description": "How about a description",
        "address": {
          "streetAddressOne": "Here",
          "streetAddressTwo": "Test",
          "city": "Christmas Town",
          "state": "MI",
          "zip": "12345",
          "zipPlusFour": "1234",
          "country": "US"
        },
        "receiptText": "Best location receipt text ever",
        "scheduleText": "Best schedule text",
        "cardFeeAmount": 1.10,
        "achFeeAmount": 3.00,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "111-1",
            "name": "Card not present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-1",
            "name": "Telephone Initiated"
          },
          {
            "accountDirective": "2222-2",
            "name": "Prearranged Payment"
          },
          {
            "accountDirective": "222-3",
            "name": "Digitally Authorized"
          },
          {
            "accountDirective": "222-4",
            "name": "Business Account"
          }
        ],
        "dateCreated": "2020-01-01 17:59:59",
        "dateModified": "2020-01-02 23:55:55",
        "inheritedFromCompany": [
          "achAccountDirectiveList",
          "achFeeAmount"
        ],
        "inheritedFromGroup": [
          "receiptText",
          "scheduleText"
        ]
      }
    },
    {
      "locationId": 33,
      "customId": "1568834598",
      "activation": true,
      "groupData": {
        "id": 1,
        "name": "Another Group"
      },
      "settings": {
        "name": "Another location",
        "description": "the #1",
        "receiptText": "Receipt Text 1568834598",
        "scheduleText": "Schedule Text 1568834598",
        "cardFeeAmount": 1.10,
        "achFeeAmount": 3.00,
        "cardAccountDirectiveList": [
          {
            "accountDirective": "111-2",
            "name": "Card present",
            "allowedCardTypeList": [
              "AMERICAN_EXPRESS",
              "DISCOVER",
              "MASTERCARD",
              "VISA"
            ]
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-3",
            "name": "Digitally Authorized"
          },
          {
            "accountDirective": "222-4",
            "name": "Business Account"
          }
        ],
        "dateCreated": "2020-04-06 09:39:06",
        "dateModified": "2020-04-06 09:39:06",
        "inheritedFromGroup": [
          "receiptText",
          "scheduleText"
        ]
      }
    }
  ]
}

POST to retrieve a list of locations, with their settings inherited from the group or company, based on the parameters.

Attribute Description
locationNameOrCustomId
Alphanumeric
Find Locations by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
activation
Boolean
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will return.
isAssignedToGroup
Boolean
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will return.
locationIdList
NumericListN/A
Retrieve all Locations with a locationId in this list.

–Location Effective Settings List Account Directives

Use this endpoint to retrieve a list of accountDirective objects for a list of locationIds. This will return all the distinct account directives for the locations. If multiple locations have accesss to the same account directive, that directive will only be represented once in the list. POST to retrieve a list of inherited account directives for the list of locations.

View AccountDirectiveList object - A list of distinct accountDirective objects, will be the response.

POST :
Test endpoint: https://scheduledemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives
Live endpoint: https://schedule.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives


Sample Response:

{
  "locationIdList": [
    43,
    45,
    11297,
    11298,
    11299
  ],
  "cardAccountDirectiveList": [
    {
      "accountDirective": "2109-1",
      "name": "Card present",
      "isDefault": false
    },
    {
      "accountDirective": "2109-2",
      "name": "Card not present",
      "isDefault": false
    }
  ],
  "achAccountDirectiveList": [
    {
      "accountDirective": "2071-1217",
      "name": "Test 1209",
      "isDefault": false
    },
    {
      "accountDirective": "2071-1210",
      "name": "Test 1202",
      "isDefault": false
    },
    {
      "accountDirective": "2071-1206",
      "name": "Test 1198",
      "isDefault": false
    }
  ]
}

POST to retrieve a list of locations, with their settings inherited from the group or company, based on the parameters.

Attribute Description
locationNameOrCustomId
Alphanumeric
Find Locations by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
activation
Boolean
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will return.
isAssignedToGroup
Boolean
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will return.
locationIdList
NumericListN/A
Retrieve all Locations with a locationId in this list.

Reference Objects

These objects are used as part of the objects defined above. These are included here for reference.

–Setting

Each Setting field applies to a Company or Location or Group.

Attribute Description
name
Alphanumeric100
Conditional
The name of the group or location for which these settings apply.
Required for Group and Location.
description
Alphanumeric150
A description of the company, group or location for which these settings apply.
address
Object
Address for this location/group/company
receiptText
Alphanumeric5000
Text that will show on a receipt for transactions processed by this location/group/company.
scheduleText
Alphanumeric5000
Text that will show on a schedule for this location/group/company.
cardFeeAmount
Numeric7
Fee for a card transaction processed by this location/group/company.
achFeeAmount
Numeric7
Fee for an ach transaction processed by this location/group/company.
hierarchyDisplaySetting
Enum
This defines whether the company, group or location name and address will display on schedules and transaction receipts.
Valid Values: COMPANY, GROUP, LOCATION.
There must be a group configured for the level to be GROUP. There must be an active location configured for the level to be LOCATION.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
dateCreated
Date
Readonly
Date created.
Format: URL Encoded ISO-8601
dateModified
Date
Readonly
Date modified.
Format: URL Encoded ISO-8601
hierarchyDisplay
ObjectN/A
Readonly
Display information for the company, group, or location. This is based on the hierarchyDisplaySetting. See the HierarchyDisplay object definition below.
inheritedFromGroup
ListN/A
Readonly
List of Setting field names where the setting was inherited from its Group
See the Effective Settings and Effective Settings Preview endpoint definition.
inheritedFromCompany
ListN/A
Readonly
List of Setting field names where the setting was inherited from the Company
See the Effective Settings and Effective Settings Preview endpoint definition.

–Hierarchy Display

Attribute Description
name
Alphanumeric100
The name of the location, group, or company.
address
Object
Address of the location/group/company. Depending on what hierarchy level this is from, parts of this object may be null.
A Company will always have all parts (with the exception of streetAddressTwo).
A Group or Location may have only individual parts.

–Address

Attribute Description
streetAddressOne
Alphanumeric60
Conditional
Street Address One.
Required for Company.
streetAddressTwo
Alphanumeric30
Street Address Two.
city
Alphanumeric45
Conditional
City.
Required for Company.
state
Alphanumeric2
Conditional
State.
Required for Company.
zip
NumericString5
Conditional
Zip Code.
Required for Company.
zipPlusFour
NumericString4
Four digit Zip Code extension.
country
Alphanumeric2
Conditional
Country.
Required for Company.

–Group Search Parameters

POST these parameters to the Group retrieval endpoint to filter the search.

Attribute Description
groupName
Alphanumeric
Find Groups by their Name. This will search for any name that contains the search parameter.
groupIdList
NumericListN/A
Retrieve all Groups with a groupId in this list.

–Location Search Parameters

POST these parameters to the Location retrieval endpoint to filter the search.

Attribute Description
locationNameOrCustomId
Alphanumeric
Find Locations by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
activation
Boolean
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will return.
isAssignedToGroup
Boolean
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will return.
locationIdList
NumericListN/A
Retrieve all Locations with a locationId in this list.

–Account Directive

Attribute Description
accountDirective
Alphanumeric10
Required
The Account Directive.
name
Alphanumeric20
Readonly
The name of the Account Directive.
allowedCardTypes
List4
Readonly
ONLY ON Card Account Directives
A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD, VISA, DISCOVER, AMERICAN_EXPRESS.

–Billing

Attribute Description
autoBilling
Boolean5
Required
Boolean to specify if Auto Billing is enabled.
paymentMethod
Alpha5
Conditional
The Billing Payment Method.
Valid Values: CARD, CHECK.
Required if autoBilling is true.
billingCard
Object
Conditional
The BillingCard data. Required for CARD paymentMethod.
billingCheck
Object
Conditional
The BillingCheck data. Required for CHECK paymentMethod.
address
Object
Billing address of the company. This is specifically for the billing method.
username
Alphanumeric60
Required
The name of the User performing the request.
NOTE: This field is not returned in the response.
invoiceBreakdownLevel
Alpha8
To what level the company invoice will be broken down at the end of the billing cycle. For example, if set to LOCATION, the invoice will show billing broken down by how much each location processed. An empty value will default to COMPANY. Valid Values: COMPANY, GROUP, LOCATION.

–BillingCard

Attribute Description
cardToken
Alphanumeric16
Required
The billing card token that represents the credit card to be used for processing.
expirationMonth
Numeric2
Required
The expiration month of the credit card.
expirationYear
Numeric4
Required
The expiration year of the credit card.

–BillingCheck

Attribute Description
bankAccountNumber
Alphanumeric20
Required
The Bank Account Number to be used for processing.
bankRoutingNumber
Numeric9
Required
The Routing Number for the Bank.

–BillingEmails

Attribute Description
primaryList
List
A list of email addresses for which billing invoices and bill processing details will be posted. These email addresses, comma separated, cannot exceed 100 characters. The total email addresses in this BillingEmails object cannot exceed a count of 10.
secondaryList
List
A list of email addresses for which billing invoices and bill processing details will be posted. These email addresses, comma separated, cannot exceed 100 characters. The total email addresses in this BillingEmails object cannot exceed a count of 10.

–Account Directive List

Attribute Description
locationIdList
ListN/A
The list of location ids that were used to retrieve the account directives for.
cardAccountDirectiveList
ListN/A
List of Card AccountDirective
achAccountDirectiveList
ListN/A
List of ACH AccountDirective

Sample Code

This section offers some client implementation examples. Keep in mind, these are only minimalistic examples used to demonstrate the Service REST API and are not meant for production use.

– Result Status Codes

Expected Http Status codes

Status '200':
Description = 'Success.'

Status: '400':
Description = 'Malformed request. The request is either incorrectly formatted, or there are validation errors.'

Status '401':
Description = 'Invalid credentials.'

Status '403':
Description = 'Service not activated.'

Status '404':
Description = 'The requested resource was not found.'

Status '405':
Description = 'POST, GET, PUT request not supported for resource.'

Status '500':
Description = 'An internal error has occurred.'

All requests will return a status code. For example, in the case of status code 400, check for a requestErrorList in the response, containing information on validation failure. See RequestErrorList Object definition

–Sample Company requests


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies

Sample PUT Company request

<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';

$company = [
  'billing' => [
      'autoBilling' => true,
      'paymentMethod' => 'CARD',
      'billingCard' => [
          'cardToken' => 'ThisIsAToken2224',
          'expirationMonth' => 12,
          'expirationYear' => 25
      ]
  ],
  'settings' => [
        'description' => 'Updated Company Description',
        'receiptText' => 'Updated Receipt Text',
        'scheduleText' => 'Updated Schedule Text',
        'cardFeeAmount' => 1,
        'achFeeAmount' => 1,
        'username' => 'Someone',
        'address' => [
            'streetAddressOne' => '1234 W 5678 S',
            'streetAddressTwo' => 'Bldg 2',
            'city' => 'Ogden',
            'state' => 'UT',
            'zip' => '84401',
            'country' => 'US'
        ]
  ],
  'billingEmails' => [
    'primaryList' => ['test@test.com', 'primary@primary.com'],
    'secondaryList' => ['test2@test.com', 'secondary@secondary.com']
  ]
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($company, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class Settings {
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
    }

    public class BillingCard {
        public string cardToken { get; set; }
        public int expirationMonth { get; set; }
        public int expirationYear { get; set; }
    }

    public class Billing {
        public bool autoBilling { get; set; }
        public string paymentMethod { get; set; }
        public string username { get; set; }
        public BillingCard billingCard { get; set; }
        public Address address { get; set; }
    }

    public class BillingEmails {
        public List<string> primaryEmails { get; set; } = new List<string>();
        public List<string> secondaryEmails { get; set; } = new List<string>();
    }

    public class Company {
        public Billing billing { get; set; } = new Billing();
        public Settings settings { get; set; } = new Settings();
        public BillingEmails billingEmails { get; set; } = new BillingEmails();
    }


    public class MainClass {
        private static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            Console.WriteLine("Starting");
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies";
            Company company = new Company();

            Billing billing = new Billing();
            billing.autoBilling = true;
            billing.paymentMethod = "CARD";
            billing.username = "testUser@test.com";
            Address address = new Address();
            address.streetAddressOne = "First street";
            address.city = "Our city";
            address.state = "AL";
            address.zip = "12345";
            address.country = "US";
            billing.address = address;
            BillingCard billingCard = new BillingCard();
            billingCard.cardToken = "thisIsAToken1234";
            billingCard.expirationMonth = 12;
            billingCard.expirationYear = 2025;
            billing.billingCard = billingCard;
            company.billing = billing;

            Settings settings = new Settings();
            settings.description = "Here I describe this company";
            settings.receiptText = "Thank you for paying";
            settings.scheduleText = "Thank you for scheduling";
            settings.cardFeeAmount = 2.25;
            settings.achFeeAmount = 3.00;
            settings.username = "testUser@test.com";
            settings.address = address;
            company.settings = settings;

            BillingEmails billingEmails = new BillingEmails();
            billingEmails.primaryEmails.Add("test@test.com");
            billingEmails.primaryEmails.Add("test2@test.com");
            billingEmails.secondaryEmails.Add("testSecondary@test.com");
            company.billingEmails = billingEmails;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = PUTData(company, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task PUTData(Company company, string url) {        
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
            try 
            {
                Console.WriteLine("Sending Request");
                var postContent = new StringContent(JsonConvert.SerializeObject(company), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PutAsync(url, postContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }

        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   @primaryEmails = ("test@test.com", "primary@primary.com");
   @secondaryEmails = ("test2@test.com", "secondary@secondary.com");
   my $data = {
        "billing": {
            "autoBilling": true,
            "paymentMethod": "CARD",
            "billingCard": {
                "cardToken": "ThisIsAToken2224",
                "expirationMonth": "12",
                "expirationYear": "25"
            }
        },
        "settings": {
            "description": "Updated Company Description",
            "receiptText": "Updated Receipt Text",
            "scheduleText": "Updated Schedule Text",
            "cardFeeAmount": 1,
            "achFeeAmount": 1,
            "username": "Someone",
            "address": {
                "streetAddressOne": "1234 W 5678 S",
                "streetAddressTwo": "Bldg 2",
                "city": "Ogden",
                "state": "UT",
                "zip": "84401",
                "country": "US"
            }
        },
        "billingEmails": {
            "primaryList" : $primaryList,
            "secondaryList" : $secondaryList
        }
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';

   my $req = HTTP::Request->new( 'PUT', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
        "billing": {
            "autoBilling": true,
            "paymentMethod": "CARD",
            "billingCard": {
                "cardToken": "ThisIsAToken2224",
                "expirationMonth": "12",
                "expirationYear": "25"
            }
        },
        "settings": {
            "description": "Updated Company Description",
            "receiptText": "Updated Receipt Text",
            "scheduleText": "Updated Schedule Text",
            "cardFeeAmount": 1,
            "achFeeAmount": 1,
            "username": "Someone",
            "address": {
                "streetAddressOne": "1234 W 5678 S",
                "streetAddressTwo": "Bldg 2",
                "city": "Ogden",
                "state": "UT",
                "zip": "84401",
                "country": "US"
            }
        },
        "billingEmails": {
            "primaryList":["test@test.com", "primary@primary.com"],
            "secondaryList":["test2@test.com", "secondary@secondary.com"]
        }
    }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_put(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

PUT to modify the existing Company for the Authenticated User

Response

Updated Company object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies

Sample GET Company request

<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';

$curl = curl_init();

curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
        public List<string> allowedCardTypes { get; set; }
    }

    public class HierarchyDisplay {
        public string name { get; set; }
        public Address address;
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string dateCreated { get; set; }
        public string dateModified { get; set; }
        public string hierarchyDisplaySetting { get; set; }
        public HierarchyDisplay hierarchyDisplay { get; set; }
    }

    public class BillingCard {
        public string cardToken { get; set; }
        public int expirationMonth { get; set; }
        public int expirationYear { get; set; }
    }

    public class Billing {
        public bool autoBilling { get; set; }
        public string paymentMethod { get; set; }
        public string username { get; set; }
        public BillingCard billingCard { get; set; }
        public Address address { get; set; }
    }

    public class BillingEmails {
        public List<string> primaryEmails { get; set; } = new List<string>();
        public List<string> secondaryEmails { get; set; } = new List<string>();
    }

    public class Company {
        public Billing billing { get; set; } = new Billing();
        public Settings settings { get; set; } = new Settings();
        public BillingEmails billingEmails { get; set; } = new BillingEmails();
    }

    public class MainClass {
        private static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies";

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            Task<Company> task = GETData(url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task<Company> GETData(string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            Company company = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            string responseBody = await response.Content.ReadAsStringAsync();
            JObject json = JObject.Parse(responseBody);
            if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                JArray requestErrorList = (JArray)json["requestErrorList"];
                foreach (var item in requestErrorList)
                {
                    Console.WriteLine(item);
                    string errorCode = (string)item["code"];
                    string description = (string)item["description"];
                    bool retriable = (bool)item["retriable"];
                    Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                    //What fields does this error apply to and what are the values of those fields
                    if (item["apiFieldNameList"] != null) {
                        JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                        foreach (var apiField in apiFieldNameList) {
                            string fieldName = (string)apiField["apiFieldName"];
                            string fieldValue = (string)apiField["apiFieldValue"];
                            Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                        }
                    }
                }
            }
            else 
            {
                // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                company = JsonConvert.DeserializeObject<Company>(responseBody);
                // Do something with it
                Console.WriteLine("CompanyName: " + company.settings.name);
            }
            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            return company;
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';

   my $req = HTTP::Request->new( 'GET', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

GET a single Company for the Authenticated User

Response

Company object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies

Sample PATCH Company request

<?php

$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';

$company = [
  'billing' => [
      'autoBilling' => true,
      'paymentMethod' => 'CARD',
      'billingCard' => [
          'cardToken' => 'ThisIsAToken2224',
          'expirationMonth' => 12,
          'expirationYear' => 25
      ]
  ],
  'settings' => [
        'description' => 'Updated Company Description',
        'receiptText' => 'Updated Receipt Text',
        'scheduleText' => 'Updated Schedule Text',
        'cardFeeAmount' => 1,
        'achFeeAmount' => 1
  ],
  'billingEmails' => [
    'primaryList' => [], //This will remove all current emails in primaryList
    'secondaryList' => ['another@test.com']
  ]
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($company, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class BillingCard {
        public string cardToken { get; set; }
        public int expirationMonth { get; set; }
        public int expirationYear { get; set; }
    }

    public class Billing {
        public bool autoBilling { get; set; }
        public string paymentMethod { get; set; }
        public string username { get; set; }
        public BillingCard billingCard { get; set; }
        public Address address { get; set; }
    }

    public class BillingEmails {
        public List<string> primaryEmails { get; set; } = new List<string>();
        public List<string> secondaryEmails { get; set; } = new List<string>();
    }

    public class Company {
        public Billing billing { get; set; }
        public Settings settings { get; set; }
        public BillingEmails billingEmails { get; set; }
    }


    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies";
            Company company = new Company();

            Settings settings = new Settings();
            settings.description = "Here I describe this company";
            settings.receiptText = "Thank you for paying";
            settings.cardFeeAmount = 2.25;
            settings.username = "testUser@test.com";
            Address address = new Address();
            address.streetAddressOne = "First street";
            address.country = "US";
            settings.address = address;
            company.settings = settings;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = PATCHData(company, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task PATCHData(Company company, string url) {
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded companyUsername:companyPassword)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            try 
            {
                Console.WriteLine("Sending Request");
                var postContent = new StringContent(JsonConvert.SerializeObject(company), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PatchAsync(url, postContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else 
                {
                    // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                    company = JsonConvert.DeserializeObject<Company>(responseBody);
                    // Do something with it
                    Console.WriteLine("CompanyName: " + company.settings.description);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   @primaryEmails = ();
   @secondaryEmails = ("another@test.com");
   my $data = {
       "billing": {
           "autoBilling": true,
           "paymentMethod": "CARD",
           "billingCard": {
               "cardToken": "ThisIsAToken2224",
               "expirationMonth": "12",
               "expirationYear": "25"
           }
       },
       "settings": {
         "description": "Updated Company Description",
         "receiptText": "Updated Receipt Text",
         "scheduleText": "Updated Schedule Text",
         "cardFeeAmount": 1,
         "achFeeAmount": 1
       },
        "billingEmails": {
            "primaryList" : $primaryList,
            "secondaryList" : $secondaryList
        }
   };

   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';

   my $req = HTTP::Request->new( 'PATCH', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
       "billing": {
           "autoBilling": true,
           "paymentMethod": "CARD",
           "billingCard": {
               "cardToken": "ThisIsAToken2224",
               "expirationMonth": "12",
               "expirationYear": "25"
           }
       },
       "settings": {
           "description": "Updated Company Description",
           "receiptText": "Updated Receipt Text",
           "scheduleText": "Updated Schedule Text",
           "cardFeeAmount": 1,
           "achFeeAmount": 1
       },
       "billingEmails": {
            "primaryList":[],
            "secondaryList":["another@test.com"]
       }
   }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_patch(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

PATCH to modify an existing Company

Response

Updated Company object

–Sample Group requests


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups

Sample POST Group request

<?php

$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/';

$group = [
  'locationIds' => [1],
  'settings' => [
    'name' => 'Group Name',
    'description' => 'Group Description',
    'address' => [
      'streetAddressOne' => '1234 W 5678 S',
      'streetAddressTwo' => 'Bldg 2',
      'city' => 'Ogden',
      'state' => 'UT',
      'zip' => '84401',
      'zipPlusFour' => '1234',
      'country' => 'US',
    ],
    'receiptText' => 'Receipt Text',
    'scheduleText' => 'Schedule Text',
    'cardFeeAmount' => 1,
    'achFeeAmount' => 1,
    'cardAccountDirectiveList' => [
      0 => [
        'accountDirective' => '888-1'
      ],
      1 => [
         'accountDirective' => '888-2'
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1'
      ],
    ],
  ],
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($group, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Group {
        public string customId { get; set; }
        public List<int> locationIds { get; set; } = new List<int>();
        public Settings settings { get; set; } = new Settings();
    }


    public class MainClass {
        private static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups";
            Group group = new Group();
            Settings settings = new Settings();
            settings.name = "Albuquerque Group";
            settings.description = "Our offices in Albuquerque";
            settings.receiptText = "Thank you for paying";
            settings.scheduleText = "Thank you for scheduling";
            settings.cardFeeAmount = 2.25;
            settings.achFeeAmount = 3.00;
            settings.username = "testUser@test.com";
            Address address = new Address();
            address.streetAddressOne = "First street";
            address.city = "Our city";
            address.state = "AL";
            address.zip = "12345";
            address.country = "US";
            settings.address = address;
            group.settings = settings;
            group.customId = "Albuquerque offices";

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = POSTData(group, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task POSTData(Group group, string url) {        
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
            try 
            {
                Console.WriteLine("Sending Request");
                var postContent = new StringContent(JsonConvert.SerializeObject(group), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PostAsync(url, postContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else {
                    Console.WriteLine(json["groupId"]);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }

        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
      "locationIds": [1],
      "settings": {
          "name": "Group Name",
          "description": "Group Description",
          "address": {
              "streetAddressOne": "1234 W 5678 S",
              "streetAddressTwo": "Bldg 2",
              "city": "Ogden",
              "state": "UT",
              "zip": "84401",
              "zipPlusFour": "1234",
              "country": "US"
          },
          "receiptText": "Receipt Text",
          "scheduleText": "Schedule Text",
          "cardFeeAmount": 1,
          "achFeeAmount": 1,
          "cardAccountDirectiveList": [
              {
                  "accountDirective": "888-1"
              },
              {
                  "accountDirective": "888-2"
              }
          ],
          "achAccountDirectiveList": [
              {
                  "accountDirective": "2071-1"
              }
          ]
      }
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/';

   my $req = HTTP::Request->new( 'POST', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
        "locationIds": [1],
        "settings": {
            "name": "Group Name",
            "description": "Group Description",
            "address": {
                "streetAddressOne": "1234 W 5678 S",
                "streetAddressTwo": "Bldg 2",
                "city": "Ogden",
                "state": "UT",
                "zip": "84401",
                "zipPlusFour": "1234",
                "country": "US"
            },
            "receiptText": "Receipt Text",
            "scheduleText": "Schedule Text",
            "cardFeeAmount": 1,
            "achFeeAmount": 1,
            "cardAccountDirectiveList": [
                {
                    "accountDirective": "888-1"
                },
                {
                    "accountDirective": "888-2"
                }
            ],
            "achAccountDirectiveList": [
                {
                    "accountDirective": "2071-1"
                }
            ]
        }
    }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_post(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

POST to create a new Group

Response

Group object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}

Sample PUT Group request

<?php

$groupIdToUpdate = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $groupIdToUpdate;

$group = [
  'locationIds' => [1],
  'settings' => [
    'name' => 'Updated Group Name',
    'description' => 'Group Description',
    'address' => [
      'streetAddressOne' => '1234 W 5678 S',
      'streetAddressTwo' => 'Bldg 2',
      'city' => 'Ogden',
      'state' => 'UT',
      'zip' => '84401',
      'zipPlusFour' => '1234',
      'country' => 'US',
    ],
    'receiptText' => 'Receipt Text',
    'scheduleText' => 'Schedule Text',
    'cardFeeAmount' => 1,
    'achFeeAmount' => 1,
    'cardAccountDirectiveList' => [
      0 => [
        'accountDirective' => '888-1'
      ],
      1 => [
         'accountDirective' => '888-2'
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1'\
      ],
    ],
  ],
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($group, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }    

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Group {
        public string customId { get; set; }
        public List<int> locationIds { get; set; } = new List<int>();
        public Settings settings { get; set; } = new Settings();
    }


    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            int groupId = 1234;
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/"+groupId;
            Group group = new Group();
            group.customId = "Albuquerque offices";

            Settings settings = new Settings();
            settings.name = "Albuquerque Group";
            settings.description = "Change Our offices in Albuquerque";
            settings.scheduleText = "Thank you for scheduling";
            settings.cardFeeAmount = 2.25;
            settings.achFeeAmount = 3.00;
            settings.username = "testUser@test.com";
            /*
             * Not including the address in a PUT will set the group address to null
             */
            group.settings = settings;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = PUTData(group, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task PUTData(Group group, string url) {
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            try 
            {
                Console.WriteLine("Sending Request");
                var putContent = new StringContent(JsonConvert.SerializeObject(group), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PutAsync(url, putContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else {
                    Console.WriteLine(json["groupId"]);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
      "locationIds": [1],
      "settings": {
          "name": "Updated Group Name",
          "description": "Group Description",
          "address": {
              "streetAddressOne": "1234 W 5678 S",
              "streetAddressTwo": "Bldg 2",
              "city": "Ogden",
              "state": "UT",
              "zip": "84401",
              "zipPlusFour": "1234",
              "country": "US"
          },
          "receiptText": "Receipt Text",
          "scheduleText": "Schedule Text",
          "cardFeeAmount": 1,
          "achFeeAmount": 1,
          "cardAccountDirectiveList": [
              {
                  "accountDirective": "888-1"
              },
              {
                  "accountDirective": "888-2"
              }
          ],
          "achAccountDirectiveList": [
              {
                  "accountDirective": "2071-1"
              }
          ]
      }
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $groupIdToUpdate = 1;
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $groupIdToUpdate;

   my $req = HTTP::Request->new( 'PUT', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
        "locationIds": [1],
        "settings": {
            "name": "Updated Group Name",
            "description": "Group Description",
            "address": {
                "streetAddressOne": "1234 W 5678 S",
                "streetAddressTwo": "Bldg 2",
                "city": "Ogden",
                "state": "UT",
                "zip": "84401",
                "zipPlusFour": "1234",
                "country": "US"
            },
            "receiptText": "Receipt Text",
            "scheduleText": "Schedule Text",
            "cardFeeAmount": 1,
            "achFeeAmount": 1,
            "cardAccountDirectiveList": [
                {
                    "accountDirective": "888-1"
                },
                {
                    "accountDirective": "888-2"
                }
            ],
            "achAccountDirectiveList": [
                {
                    "accountDirective": "2071-1"
                }
            ]
        }
    }

   groupIdToUpdate = 1;
   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' + groupIdToUpdate
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_put(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

PUT to modify an existing Group by its id

Response

Updated Group object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups

Request

GET a list of all Groups

Response

List of Group objects


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}

Sample GET Group request by id

<?php
$desiredGroupId = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $desiredGroupId;

$curl = curl_init();

curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class HierarchyDisplay {
        public string name { get; set; }
        public Address address;
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string dateCreated { get; set; }
        public string dateModified { get; set; }
        public string hierarchyDisplaySetting { get; set; }
        public HierarchyDisplay hierarchyDisplay { get; set; }
    }

    public class Location {
        public int locationId { get; set; }
        public string customId { get; set; }
        public Settings settings { get; set; }
    }

    public class Group {
        public int groupId { get; set; }
        public string customId { get; set; }
        public int locationCount { get; set; }
        public List<int> locationIds { get; set; } = new List<int>();
        public Settings settings { get; set; } = new Settings();
        public List<Location> locations { get; set; } = new List<Location>();
    }

    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            int myGroupId = 12;
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/" + myGroupId;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            Task<Group> task = GETData(url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task<Group> GETData(string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            Group group = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            string responseBody = await response.Content.ReadAsStringAsync();
            JObject json = JObject.Parse(responseBody);
            if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                JArray requestErrorList = (JArray)json["requestErrorList"];
                foreach (var item in requestErrorList)
                {
                    Console.WriteLine(item);
                    string errorCode = (string)item["code"];
                    string description = (string)item["description"];
                    bool retriable = (bool)item["retriable"];
                    Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                    //What fields does this error apply to and what are the values of those fields
                    if (item["apiFieldNameList"] != null) {
                        JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                        foreach (var apiField in apiFieldNameList) {
                            string fieldName = (string)apiField["apiFieldName"];
                            string fieldValue = (string)apiField["apiFieldValue"];
                            Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                        }
                    }
                }
            }
            else 
            {
                // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                group = JsonConvert.DeserializeObject<Group>(responseBody);
                // Do something with it
                Console.WriteLine("GroupId: " + group.groupId);
            }
            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            return group;
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $desiredGroupId = 1;
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $desiredGroupId;

   my $req = HTTP::Request->new( 'GET', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   desiredGroupId = 1;
   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' + desiredGroupId
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

GET a single Group by its id

Response

Group object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search

Sample POST Group request with GroupSearchParameters

<?php

$groupSearchParameters = [
    'groupNameOrCustomId' = 'customName'
];

$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search/';

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($groupSearchParameters, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class HierarchyDisplay {
        public string name { get; set; }
        public Address address;
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string dateCreated { get; set; }
        public string dateModified { get; set; }
        public string hierarchyDisplaySetting { get; set; }
        public HierarchyDisplay hierarchyDisplay { get; set; }
    }

    public class Location {
        public int locationId { get; set; }
        public string customId { get; set; }
        public Settings settings { get; set; }
    }

    public class Group {
        public int groupId { get; set; }
        public string customId { get; set; }
        public int locationCount { get; set; }
        public List<int> locationIds { get; set; } = new List<int>();
        public Settings settings { get; set; } = new Settings();
    }

    public class GroupList {
        public List<Group> groupList { get; set; }
    }

    public class GroupSearchParameters {
        public string groupName { get; set; }
        public string groupNameOrCustomId { get; set; }
        public List<int> groupIdList { get; set; } = new List<int>();
        public List<string> customIdList { get; set; } = new List<string>();
    }

    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search";

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            GroupSearchParameters groupSearchParameters = new GroupSearchParameters();
            groupSearchParameters.groupNameOrCustomId = "customGroupId";

            Task<GroupList> task = POSTData(groupSearchParameters, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task<GroupList> POSTData(GroupSearchParameters groupSearch, string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            GroupList groups = null;
            var postContent = new StringContent(JsonConvert.SerializeObject(groupSearch), Encoding.UTF8, "application/json");
            HttpResponseMessage response = await client.PostAsync(url, postContent);
            string responseBody = await response.Content.ReadAsStringAsync();
            JObject json = JObject.Parse(responseBody);
            if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                JArray requestErrorList = (JArray)json["requestErrorList"];
                foreach (var item in requestErrorList)
                {
                    Console.WriteLine(item);
                    string errorCode = (string)item["code"];
                    string description = (string)item["description"];
                    bool retriable = (bool)item["retriable"];
                    Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                    //What fields does this error apply to and what are the values of those fields
                    if (item["apiFieldNameList"] != null) {
                        JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                        foreach (var apiField in apiFieldNameList) {
                            string fieldName = (string)apiField["apiFieldName"];
                            string fieldValue = (string)apiField["apiFieldValue"];
                            Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                        }
                    }
                }
            }
            else 
            {
                // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                groups = JsonConvert.DeserializeObject<GroupList>(responseBody);
                // Do something with it
                Console.WriteLine("Groups: " + groups.groupList.Count);
            }
            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            return groups;
        }
    }
}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
      "groupNameOrCustomId": "Custom Name"
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search';

   my $req = HTTP::Request->new( 'POST', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

begin

   data = {
        "groupNameOrCustomId": "CustomID"
    }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_post(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

POST to get a list of all Groups with matching GroupSearchParameters

Response

List of Group objects with matching GroupSearchParameters


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}

Request

DELETE to delete a Group record that does not have associated Locations

Response

Status code 200 - Successful
Status code 404 - Record could not be found
Status code 409 - Could not be deleted as there are associated Locations

–Sample Location requests


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations

Sample POST Location request

<?php

$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/';

$location = [
  'customId' => 'Custom Location ID',
  'activation' => true,
  'groupId' => 1,
  'settings' => [
    'name' => 'Location Name',
    'description' => 'Location Description',
    'address' => [
      'streetAddressOne' => '1234 W 5678 S',
      'streetAddressTwo' => 'Bldg 2',
      'city' => 'Ogden',
      'state' => 'UT',
      'zip' => '84401',
      'zipPlusFour' => '1234',
      'country' => 'US',
    ],
    'receiptText' => 'Receipt Text',
    'scheduleText' => 'Schedule Text',
    'cardFeeAmount' => 1,
    'achFeeAmount' => 1,
    'cardAccountDirectiveList' => [
      0 => [
        'accountDirective' => '888-1'
      ],
      1 => [
         'accountDirective' => '888-2'
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1'
      ],
    ],
  ],
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Location {
        public long locationId { get; set; }
        public string customId { get; set; }
        public bool activation { get; set; }
        public Settings settings { get; set; } = new Settings();
    }


    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations";
            Location location = new Location();
            location.activation = true;
            location.customId = "Alb1";

            Settings settings = new Settings();
            settings.name = "Albuquerque Location 1";
            settings.description = "First in Albuquerque";
            settings.receiptText = "Thank you for paying";
            settings.scheduleText = "Thank you for scheduling";
            settings.cardFeeAmount = 2.25;
            settings.achFeeAmount = 3.00;
            settings.username = "testUser@test.com";

            Address address = new Address();
            address.streetAddressOne = "First street";
            address.city = "Our city";
            address.state = "AL";
            address.zip = "12345";
            address.country = "US";
            settings.address = address;
            location.settings = settings;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = POSTData(location, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task POSTData(Location location, string url) {
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            try 
            {
                Console.WriteLine("Sending Request");
                var putContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PostAsync(url, putContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else {
                    Console.WriteLine(responseBody);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
      "customId": "Custom Location ID",
      "activation": true,
      "groupId": 1,
      "settings": {
          "name": "Group Name",
          "description": "Group Description",
          "address": {
              "streetAddressOne": "1234 W 5678 S",
              "streetAddressTwo": "Bldg 2",
              "city": "Ogden",
              "state": "UT",
              "zip": "84401",
              "zipPlusFour": "1234",
              "country": "US"
          },
          "receiptText": "Receipt Text",
          "scheduleText": "Schedule Text",
          "cardFeeAmount": 1,
          "achFeeAmount": 1,
          "cardAccountDirectiveList": [
              {
                  "accountDirective": "888-1"
              },
              {
                  "accountDirective": "888-2"
              }
          ],
          "achAccountDirectiveList": [
              {
                  "accountDirective": "2071-1"
              }
          ]
      }
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/';

   my $req = HTTP::Request->new( 'POST', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
        "customId": "Custom Location ID",
        "activation": true,
        "groupId": 1,
        "settings": {
            "name": "Group Name",
            "description": "Group Description",
            "address": {
                "streetAddressOne": "1234 W 5678 S",
                "streetAddressTwo": "Bldg 2",
                "city": "Ogden",
                "state": "UT",
                "zip": "84401",
                "zipPlusFour": "1234",
                "country": "US"
            },
            "receiptText": "Receipt Text",
            "scheduleText": "Schedule Text",
            "cardFeeAmount": 1,
            "achFeeAmount": 1,
            "cardAccountDirectiveList": [
                {
                    "accountDirective": "888-1"
                },
                {
                    "accountDirective": "888-2"
                }
            ],
            "achAccountDirectiveList": [
                {
                    "accountDirective": "2071-1"
                }
            ]
        }
    }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_post(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

POST to create a new Location

Response

Location object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}

Sample PUT Location request

<?php

$locationIdToUpdate = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' . $locationIdToUpdate;

$location = [
  'customId' => 'Custom Location ID',
  'activation' => true,
  'groupId' => 1,
  'settings' => [
    'name' => 'Updated Location Name',
    'description' => 'Updated Location Description',
    'address' => [
      'streetAddressOne' => '1234 W 5678 S',
      'streetAddressTwo' => 'Bldg 2',
      'city' => 'Ogden',
      'state' => 'UT',
      'zip' => '84401',
      'zipPlusFour' => '1234',
      'country' => 'US',
    ],
    'receiptText' => 'Receipt Text',
    'scheduleText' => 'Schedule Text',
    'cardFeeAmount' => 1,
    'achFeeAmount' => 1,
    'cardAccountDirectiveList' => [
      0 => [
        'accountDirective' => '888-1'
      ],
      1 => [
         'accountDirective' => '888-2'
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1'
      ],
    ],
  ],
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Location {
        public string customId { get; set; }
        public bool activation { get; set; }
        public Settings settings { get; set; } = new Settings();
    }


    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            int locationIdToUpdate = 22;
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/" + locationIdToUpdate; 
            Location location = new Location();
            location.activation = true;
            location.customId = "Alb1";

            Settings settings = new Settings();
            settings.name = "Albuquerque Location 1";
            settings.description = "First in Albuquerque";
            settings.receiptText = "Thank you for paying";
            settings.scheduleText = "Thank you for scheduling";
            settings.cardFeeAmount = 2.25;
            settings.achFeeAmount = 3.00;
            settings.username = "testUser@test.com";

            Address address = new Address();
            address.streetAddressOne = "First street";
            address.city = "Our city";
            address.state = "AL";
            address.zip = "12345";
            address.country = "US";
            settings.address = address;
            location.settings = settings;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = PUTData(location, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task PUTData(Location location, string url) {
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            try 
            {
                Console.WriteLine("Sending Request");
                var putContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PutAsync(url, putContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else {
                    Console.WriteLine(json["locationId"]);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
         "customId": "Custom Location ID",
         "activation": true,
         "groupId": 1,
         "settings": {
             "name": "Updated Group Name",
             "description": "Updated Group Description",
             "address": {
                 "streetAddressOne": "1234 W 5678 S",
                 "streetAddressTwo": "Bldg 2",
                 "city": "Ogden",
                 "state": "UT",
                 "zip": "84401",
                 "zipPlusFour": "1234",
                 "country": "US"
             },
             "receiptText": "Receipt Text",
             "scheduleText": "Schedule Text",
             "cardFeeAmount": 1,
             "achFeeAmount": 1,
             "cardAccountDirectiveList": [
                 {
                     "accountDirective": "888-1"
                 },
                 {
                     "accountDirective": "888-2"
                 }
             ],
             "achAccountDirectiveList": [
                 {
                     "accountDirective": "2071-1"
                 }
             ]
         }
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $locationIdToUpdate = 1;
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' . $locationIdToUpdate;

   my $req = HTTP::Request->new( 'PUT', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
       "customId": "Custom Location ID",
       "activation": true,
       "groupId": 1,
       "settings": {
           "name": "Updated Group Name",
           "description": "Updated Group Description",
           "address": {
               "streetAddressOne": "1234 W 5678 S",
               "streetAddressTwo": "Bldg 2",
               "city": "Ogden",
               "state": "UT",
               "zip": "84401",
               "zipPlusFour": "1234",
               "country": "US"
           },
           "receiptText": "Receipt Text",
           "scheduleText": "Schedule Text",
           "cardFeeAmount": 1,
           "achFeeAmount": 1,
           "cardAccountDirectiveList": [
               {
                   "accountDirective": "888-1"
               },
               {
                   "accountDirective": "888-2"
               }
           ],
           "achAccountDirectiveList": [
               {
                   "accountDirective": "2071-1"
               }
           ]
       }
   }

   locationIdToUpdate = 1;
   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' + locationIdToUpdate
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_put(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

PUT to modify an existing Location by its id

Response

Updated Location object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations

Request

GET a list of all Locations

Response

List of Location objects


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}

Sample GET Location request by id

<?php
$desiredLocationId = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' . $desiredLocationId;

$curl = curl_init();

curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Location {
        public long locationId { get; set; }
        public string customId { get; set; }
        public bool activation { get; set; }
        public Settings settings { get; set; } = new Settings();
    }


    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            int myLocationId = 12;
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/" + myLocationId;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            Task<Location> task = GETData(url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task<Location> GETData(string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            Location location = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            string responseBody = await response.Content.ReadAsStringAsync();
            JObject json = JObject.Parse(responseBody);
            if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                JArray requestErrorList = (JArray)json["requestErrorList"];
                foreach (var item in requestErrorList)
                {
                    Console.WriteLine(item);
                    string errorCode = (string)item["code"];
                    string description = (string)item["description"];
                    bool retriable = (bool)item["retriable"];
                    Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                    //What fields does this error apply to and what are the values of those fields
                    if (item["apiFieldNameList"] != null) {
                        JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                        foreach (var apiField in apiFieldNameList) {
                            string fieldName = (string)apiField["apiFieldName"];
                            string fieldValue = (string)apiField["apiFieldValue"];
                            Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                        }
                    }
                }
            }
            else 
            {
                // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                location = JsonConvert.DeserializeObject<Location>(responseBody);
                // Do something with it
                Console.WriteLine("LocationId: " + location.locationId);
            }
            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            return location;
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $desiredLocationId = 1;

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' . $desiredLocationId;

   my $req = HTTP::Request->new( 'GET', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   desiredLocationId = 1;

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' + desiredLocationId
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

GET a single Location by its id

Response

Location object


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/search
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/search

Sample POST LocationSearchParameters to find Location objects that match the parameters

<?php
$locationSearchParameters = [
    'locationNameOrCustomId' = 'customName'
];

$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/search/';

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(locationSearchParameters, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Location {
        public string customId { get; set; }
        public bool activation { get; set; }
        public Settings settings { get; set; } = new Settings();
    }

    public class LocationList {
        public List<Location> locationList { get; set; }
    }

    public class LocationSearchParameters {
        public string locationNameOrCustomId { get; set; }
        public bool? activation { get; set; }  //This needs to be nullable as a null value will specify not to search on this parameter
        public bool? isAssignedToGroup { get; set; }  //This needs to be nullable as a null value will specify not to search on this parameter
        public List<long> locationIdList { get; set; }
        public List<String> customIdList { get; set; }
    }

    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/search";
            LocationSearchParameters locationSearchParameters = new LocationSearchParameters();
            locationSearchParameters.activation = true; //Only include activated locations
            locationSearchParameters.isAssignedToGroup = true; //Only include locations that are assigned to a group
            List<long> locationIdList = new List<long>();  //Only include locations that have a locationId in this list
            locationIdList.Add(12);
            locationIdList.Add(22);
            locationSearchParameters.locationIdList = locationIdList;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = POSTData(locationSearchParameters, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task<LocationList> POSTData(LocationSearchParameters locationSearchParameters, string url) {
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            LocationList locationList = null;
            try 
            {
                Console.WriteLine("Sending Request");
                var postContent = new StringContent(JsonConvert.SerializeObject(locationSearchParameters), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PostAsync(url, postContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else {
                    Console.WriteLine(responseBody);
                    // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                    locationList = JsonConvert.DeserializeObject<LocationList>(responseBody);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }
            return locationList;
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
      "locationNameOrCustomId": "Custom Name"
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/search';

   my $req = HTTP::Request->new( 'POST', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

begin

   data = {
        "locationNameOrCustomId": "CustomID"
    }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/search'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_post(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

GET a list of all Locations with matching LocationSearchParameters

Response

List of Location objects with matching LocationSearchParameters


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}

Sample PATCH Location request

<?php

$locationIdToUpdate = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' . $locationIdToUpdate;

$data = [
  'groupId' => 1
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Location {
        public string customId { get; set; }
        public bool? activation { get; set; }
        public Settings settings { get; set; } = new Settings();
    }


    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/22";
            Location location = new Location();
            location.activation = true;

            Settings settings = new Settings();
            settings.receiptText = "";            //Set the receiptText to null, allowing for inheritance from the group (if assigned) or company
            settings.username = "testUser@test.com";

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = PATCHData(location, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task PATCHData(Location location, string url) {
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            try 
            {
                Console.WriteLine("Sending Request");
                var patchContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PatchAsync(url, patchContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else {
                    Console.WriteLine(responseBody);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
         "groupId": 1
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $locationIdToUpdate = 1;
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' . $locationIdToUpdate;

   my $req = HTTP::Request->new( 'PATCH', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
       "groupId": 1
   }

   locationIdToUpdate = 1;
   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/' + locationIdToUpdate
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_patch(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

PATCH to modify an existing Location by its id

Response

Updated Location object

Effective Settings

The Effective Settings endpoint will return Setting fields that are inherited up the hierarchy. For example if a Location does not have a value set for a setting field, the setting will be provided from its assigned Group or Company. On the Setting object, there are two additional fields, inheritedFromGroup and inheritedFromCompany, that will list the fields which were inherited up the hierarchy.


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}/effectivesettings
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}/effectivesettings

Location


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}/effectivesettings
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}/effectivesettings

Group


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/effectivesettings
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/effectivesettings

Company

Sample GET effective settings for Location

<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/1/effectivesettings';

$curl = curl_init();

curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Location {
        public long locationId { get; set; }
        public string customId { get; set; }
        public bool activation { get; set; }
        public Settings settings { get; set; } = new Settings();
    }



    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            int myLocationId = 12;
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/" + myLocationId + "/effectivesettings/";

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            Task<Location> task = GETData(url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task<Location> GETData(string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            Location location = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            string responseBody = await response.Content.ReadAsStringAsync();
            JObject json = JObject.Parse(responseBody);
            if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                JArray requestErrorList = (JArray)json["requestErrorList"];
                foreach (var item in requestErrorList)
                {
                    Console.WriteLine(item);
                    string errorCode = (string)item["code"];
                    string description = (string)item["description"];
                    bool retriable = (bool)item["retriable"];
                    Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                    //What fields does this error apply to and what are the values of those fields
                    if (item["apiFieldNameList"] != null) {
                        JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                        foreach (var apiField in apiFieldNameList) {
                            string fieldName = (string)apiField["apiFieldName"];
                            string fieldValue = (string)apiField["apiFieldValue"];
                            Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                        }
                    }
                }
            }
            else 
            {
                // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                location = JsonConvert.DeserializeObject<Location>(responseBody);
                // Do something with it
                Console.WriteLine("LocationId: " + location.locationId);
            }
            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            return location;
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/1/effectivesettings';

   my $req = HTTP::Request->new( 'GET', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/1/effectivesettings'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

GET a Location, Group or Company effective settings

Response

A Location, Group or Company with their effective settings

Effective Settings Preview

The Effective Settings Preview endpoint allows a Location, Group or Company to be provided (via POST body), and the endpoint will return Setting fields that are inherited up the hierarchy without saving the provided Location, Group or Company changes.

Location


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{id}/effectivesettings/preview


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/effectivesettings/preview

Group


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}/effectivesettings/preview


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/effectivesettings/preview

Company


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/effectivesettings/preview

Sample POST effective settings preview for Location

<?php

$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/1/effectivesettings/preview';

$location = [
  'customId' => 'Custom Location ID',
  'activation' => true,
  'groupId' => 1,
  'settings' => [
    'name' => 'Location Name',
    'description' => 'Location Description',
    'address' => [
      'streetAddressOne' => '1234 W 5678 S',
      'streetAddressTwo' => 'Bldg 2',
      'city' => 'Ogden',
      'state' => 'UT',
      'zip' => '84401',
      'zipPlusFour' => '1234',
      'country' => 'US',
    ],
    'scheduleText' => 'Schedule Text',
    'cardFeeAmount' => 1
  ],
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class Address {
        public string streetAddressOne { get; set; }
        public string streetAddressTwo { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string zip { get; set; }
        public string zipPlusFour { get; set; }
        public string country { get; set; }
    }

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
    }

    public class Settings {
        public string name { get; set; }
        public string description { get; set; }
        public string receiptText { get; set; }
        public string scheduleText { get; set; }
        public double cardFeeAmount { get; set; }
        public double achFeeAmount { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
        public string username { get; set; }
        public Address address { get; set; }
        public string hierarchyDisplaySetting { get; set; }
    }

    public class Location {
        public string customId { get; set; }
        public bool activation { get; set; }
        public Settings settings { get; set; } = new Settings();
    }


    public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            int myLocationId = 12;
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/"+myLocationId+"/effectivesettings/preview";
            Location location = new Location();
            location.activation = true;
            location.customId = "Alb1";

            Settings settings = new Settings();
            settings.scheduleText = "";           //settings.scheduleText will get cleared from location, inherited from Group (if assigned) or location
            settings.username = "testUser@test.com";
            settings.address = new Address();    //settings.Address will get cleared from location, inherited from Group (if assigned) or location

            location.settings = settings;

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var task = POSTData(location, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task POSTData(Location location, string url) {
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            try 
            {
                Console.WriteLine("Sending Request");
                var putContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PostAsync(url, putContent);
                // response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                JObject json = JObject.Parse(responseBody);
                if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                    JArray requestErrorList = (JArray)json["requestErrorList"];
                    foreach (var item in requestErrorList)
                    {
                        Console.WriteLine(item);
                        string errorCode = (string)item["code"];
                        string description = (string)item["description"];
                        bool retriable = (bool)item["retriable"];
                        Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                        //What fields does this error apply to and what are the values of those fields
                        if (item["apiFieldNameList"] != null) {
                            JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                            foreach (var apiField in apiFieldNameList) {
                                string fieldName = (string)apiField["apiFieldName"];
                                string fieldValue = (string)apiField["apiFieldValue"];
                                Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                            }
                        }
                    }
                }
                else {
                    Console.WriteLine(responseBody);
                }
            }
            catch(HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");   
                Console.WriteLine("Message :{0} ",e.Message);
            }
        }
    }

}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
      "customId": "Custom Location ID",
      "activation": true,
      "groupId": 1,
      "settings": {
          "name": "Group Name",
          "description": "Group Description",
          "address": {
              "streetAddressOne": "1234 W 5678 S",
              "streetAddressTwo": "Bldg 2",
              "city": "Ogden",
              "state": "UT",
              "zip": "84401",
              "zipPlusFour": "1234",
              "country": "US"
          },
          "scheduleText": "Schedule Text",
          "cardFeeAmount": 1
      }
    };

   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/1/effectivesettings/preview';

   my $req = HTTP::Request->new( 'POST', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
        "customId": "Custom Location ID",
        "activation": true,
        "groupId": 1,
        "settings": {
            "name": "Group Name",
            "description": "Group Description",
            "address": {
                "streetAddressOne": "1234 W 5678 S",
                "streetAddressTwo": "Bldg 2",
                "city": "Ogden",
                "state": "UT",
                "zip": "84401",
                "zipPlusFour": "1234",
                "country": "US"
            },
            "scheduleText": "Schedule Text",
            "cardFeeAmount": 1
        }
    }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/1/effectivesettings/preview'
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_post(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

POST a Location, Group or Company to return effective settings.

NOTE: Use the {id} endpoint for an existing Location or Group to have better validation on fields that must be unique such as Location.customId or Group.locationIds. This will not load the Location or Group settings stored in the database, but will use the settings provided.

Response

A Location, Group or Company with their effective settings

Effective Settings Account Directives

The Effective Settings account directives endpoint will return cardAccountDirectiveList and achAccountDirectiveList fields that are inherited up the hierarchy. For example if a Location does not have a value set for an accountDirective field, the accountDirectives will be provided from its assigned Group or Company. These account directives will only be once in the list, even if multiple locations are assigned the same account directive.


Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/ists/locations/effectivesettings/accountdirectives

Sample POST Location effective settings account directives

<?php

$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives';

$locationIdList = [ 1, 5, 6, 10, 33];

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace RestClient {

    public class AccountDirective {
        public string accountDirective { get; set; }
        public string name { get; set; }
        public bool isDefault { get; set; }
    }

    public class AccountDirectiveList {
        public List<long> locationIdList { get; set; }
        public List<AccountDirective> cardAccountDirectiveList { get; set; }
        public List<AccountDirective> achAccountDirectiveList { get; set; }
    }

        public class MainClass {
        static HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives";

            AccountDirectiveList accountDirectiveList = new AccountDirectiveList();
            accountDirectiveList.locationIdList = new List<long>();
            accountDirectiveList.locationIdList.Add(45);
            accountDirectiveList.locationIdList.Add(43);

            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            Task<AccountDirectiveList> task = POSTData(accountDirectiveList, url);
            task.Wait();

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        static async Task<AccountDirectiveList> POSTData(AccountDirectiveList searchParameters, string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            AccountDirectiveList accountDirectiveList = null;
            var postContent = new StringContent(JsonConvert.SerializeObject(searchParameters), Encoding.UTF8, "application/json");
            HttpResponseMessage response = await client.PostAsync(url, postContent);
            string responseBody = await response.Content.ReadAsStringAsync();
            JObject json = JObject.Parse(responseBody);
            if (response.StatusCode != System.Net.HttpStatusCode.OK) {
                JArray requestErrorList = (JArray)json["requestErrorList"];
                foreach (var item in requestErrorList)
                {
                    Console.WriteLine(item);
                    string errorCode = (string)item["code"];
                    string description = (string)item["description"];
                    bool retriable = (bool)item["retriable"];
                    Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
                    //What fields does this error apply to and what are the values of those fields
                    if (item["apiFieldNameList"] != null) {
                        JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
                        foreach (var apiField in apiFieldNameList) {
                            string fieldName = (string)apiField["apiFieldName"];
                            string fieldValue = (string)apiField["apiFieldValue"];
                            Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
                        }
                    }
                }
            }
            else 
            {
                // Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
                accountDirectiveList = JsonConvert.DeserializeObject<AccountDirectiveList>(responseBody);
                // Do something with it
                Console.WriteLine("Card Account Directives: " + accountDirectiveList.cardAccountDirectiveList.Count);
            }
            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            return accountDirectiveList;
        }
    }
}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;

eval {
   my $data = {
      "locationIdList": [12, 444, 253, 333]
      }
    };

   $data = JSON::XS->new->utf8->encode ($data);

    my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives';

   my $req = HTTP::Request->new( 'POST', $url );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
   $req->content_type('application/json');
   $req->content_length( length($data) );
   $req->content( $data );

   my $lwp = LWP::UserAgent->new;
   $lwp->timeout(30);
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'
require 'base64'

begin

   data = {
        "locationIdList":[12, 33, 45, 659]
    }

   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives';
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true

   headers={}
   headers['Content-Type'] = 'application/json'
   headers['Content-Length'] = data.to_json.length
   payload = data.to_json

   c.headers = headers
   c.http_post(payload)

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

Request

POST a list of location ids

Response

An AccountDirectivesList object with the request location ids and all the card and ach account directives those locations have access to.

REST Fault

RequestErrorList

Attribute Description
requestErrorList
ListN/A
A list of RequestError objects containing validation errors.
Constraint(s): Only returned when validation errors occur. See RequestError Object definition.

RequestError

Attribute Description
code
Alpha3
The code for the validation error.
description
AlphanumericN/A
The description of the validation error.
retriable
Boolean5
Boolean to specify if the same request can be retried. This indicates a temporary failure.
apiFieldNameList
ListN/A
List of ApiFieldName with the specified RequestError

ApiFieldName

Attribute Description
d
apiFieldName
Alphanumeric
The name of the Api Field.
apiFieldValue
Alphanumeric
The value of the Api Field. When the Api Field is a list, this will show the specific list value which failed.

Credit Card API [DEPRECATED]

The credit card API allows you to easily process credit cards, tokenize a card number for future use, and run payments exclusively from a tokenized card.

API Request

userInfo

The following table describes the individual elements of the userInfo object.

Attribute Description
customerID
Numeric4
Required
A four digit customer ID that together with the securityKey uniquely identifies the customer processing credit cards.
securityKey
Alphanumeric128
Required
A password that together with the customerId uniquely identifies the customer processing credit cards.
accountSet
Numeric4
Required
Code to determine what account to deposit funds.
Format: Always 4 digits (0001, 0012, 0104, etc)
testMode
Deprecated
This element is deprecated. Do not include in request.
userName
Alphanumeric75
The user who submitted the transaction.

creditCard

The following table describes the individual elements of the creditCard object.

Attribute Description
cardHolderFirstName
Alpha45
Required
First name of card holder.
cardHolderLastName
Alpha45
Required
Last name of card holder.
cardHolderStreetAddress1
Alphanumeric80
Card holder street address line 1.
cardHolderStreetAddress2
Alphanumeric45
Card holder street address line 2.
cardHolderCity
Alphanumeric45
Card holder city.
cardHolderState
Alpha2
Card holder state.
Format: two character abbreviation (UT, CA, MI, etc)
cardHolderZipCode
Alpha10
Card holder zip code.
cardHolderCountry
Deprecated
This element is deprecated. Do not include in request.
cardHolderEmailAddress
Alphanumeric75
Email address where a receipt will be sent at the completion of the transaction.
cardHolderPhoneNumber
Alphanumeric12
Card holder telephone number.
Format: XXX-XXX-XXXX
cardHolderPhoneNumberType
Deprecated
This element is deprecated. Do not include in request.
accountReference
Alphanumeric45
Required
Reference/ID value. This is often the customer account number from your system.
memoInformation
Alphanumeric50
Memo information for the explanation of the transaction.
cardMagStripeData
AlphanumericN/A
Conditional
Mag Stripe data read from card using a PDCFlow approved card scanner.
Constraint(s): Required when using scanner.
cardNumber
Alphanumeric16
Conditional
Credit card number.
Constraint(s): Required for all transactions, except for CREDIT or VOID that were originally scanned through an approved PDCFlow scanner.

See Test Credit Cards in the Appendix for values and expected results.
cardExpirationMonth
Numeric2
Conditional
Credit expiration month.
Format: 2 digit month, such as 01, 08, 12, etc.
Constraint(s): Required for all transactions, except for CREDIT or VOID that were originally scanned through an approved PDCFlow scanner.
cardExpirationYear
Numeric2
Conditional
Card expiration year.
Format: 2 digit year, such as 17.
Constraint(s): Required for all transactions, except for CREDIT or VOID that were originally scanned through an approved PDCFlow scanner.
cardCvv2
Numeric4
Card CVV2 number. This will be 3 digits for Visa, MasterCard, and Discover, and 4 digits for American Express cards.
chargeAmount
Numeric11
Conditional
The net dollar amount paid by the payer.
Format: XXXX.XX
Do not use any formatting symbols such as currency symbols ($), commas etc.
Constraint(s): Required for all transactions, except when storing a card using the storeCard method.
convenienceFee
Numeric11
Conditional
Transaction fee amount. Fee amount to be added to the charge amount. If no fee is to be added to this transaction a value of zero (0) still needs to be provided.
Format: XXXX.XX
Do not use any formatting symbols such as currency symbols ($), commas etc.
Constraint(s): Required for all transactions, except when storing a card using the storeCard method.
currencyType
Alpha3
Required
As an integrator, this must be set to EXT.
Valid value(s): EXT
processingCommand
Alpha6
Required
Indicates how the card is to be processed.
Valid value(s): SALE, VOID, CREDIT
secondaryTrace
Alphanumeric50
Location information about a company.
originalOrderNumber
Numeric20
Conditional
When issuing a CREDIT or VOID, the original order number should be provided here.
Constraint(s): Required with processingCommand of CREDIT or VOID.
originalAmount
Deprecated
This element is deprecated. Do not include in request.

vaultInfo

The following table describes the individual elements of the vaultInfo object.

Attribute Description
vaultKey
Alphanumeric20
Conditional
The token for a card. This token should have been previously stored. Passing in this token will only automatically populate the card number and the card expiration date for processing.
Constraint(s): Required when using the processStoredCreditCardTransaction method.

API Result

-- Sample success XML --
<return>
    <processingResult>&lt;processing-results>&lt;result>OK&lt;/result>&lt;/processing-results></processingResult>
    <gatewayResponseData><![CDATA[<?xml version="1.0" ?><com.pdc4u.webservices.gps.TransactionResponse><requestResultStatus>APPROVED</requestResultStatus><cardTransactionResult><transactionId>23608</transactionId><cardToken>removedFromSample</cardToken><authorizationCode>095242</authorizationCode><cvv2ResultCode>M</cvv2ResultCode><roundTripNVPS></roundTripNVPS></cardTransactionResult><checkTransactionResult></checkTransactionResult><checkStatusUpdateResult><newStatus></newStatus><transactionId></transactionId><roundTripNVPS></roundTripNVPS></checkStatusUpdateResult><requestErrors><requestError></requestError></requestErrors></com.pdc4u.webservices.gps.TransactionResponse>]]></gatewayResponseData>
    <orderNumber>23608</orderNumber>
    <authorizationCode>095242</authorizationCode>
    <softwareVersion/>
    <state>OK</state>
 </return>
 -- Sample error XML --
 <return>
     <processingResult><![CDATA[<processing-results><result>Error</result><error>Field Card Expiration Year is required.</error><error>Field Card Expiration Month is required.</error></processing-results>]]></processingResult>
     <gatewayResponseData><![CDATA[<?xml version="1.0" ?><com.pdc4u.webservices.gps.TransactionResponse><requestResultStatus>ERROR</requestResultStatus><cardTransactionResult><transactionId></transactionId><authorizationCode></authorizationCode><cvv2ResultCode></cvv2ResultCode><roundTripNVPS></roundTripNVPS></cardTransactionResult><checkTransactionResult><roundTripNVPS></roundTripNVPS></checkTransactionResult><checkStatusUpdateResult><newStatus></newStatus><transactionId></transactionId><roundTripNVPS></roundTripNVPS></checkStatusUpdateResult><requestErrors><requestError><com.pdc4u.webservices.gps.RequestError><code>10001</code><description>Field Card Expiration Year is required.</description></com.pdc4u.webservices.gps.RequestError><com.pdc4u.webservices.gps.RequestError><code>10001</code><description>Field Card Expiration Month is required.</description></com.pdc4u.webservices.gps.RequestError></requestError></requestErrors></com.pdc4u.webservices.gps.TransactionResponse>]]></gatewayResponseData>
     <orderNumber/>
     <authorizationCode/>     
     <softwareVersion/>
     <state>ERROR</state>
     <transactionProcessingMessages>
        <message>Field Card Expiration Year is required.</message>
        <xmlTag>error</xmlTag>
     </transactionProcessingMessages>
     <transactionProcessingMessages>
        <message>Field Card Expiration Month is required.</message>
        <xmlTag>error</xmlTag>
     </transactionProcessingMessages>
  </return>

The following table describes the individual elements in a response. Sample success and failure examples are listed to the right.

Attribute Description
processingResult
XMLN/A
Result of the transaction.
gatewayResponseData
XMLN/A
Similar to processingResult, but contains additional information, such as a card token, cvv2 result, and customizable round-trip name/value pairs.
orderNumber
Numeric20
Order/Confirmation number of transaction. Returned in conjunction with authorizationCode when a transaction is successfully processed through the gateway.
authorizationCode
Alphanumeric75
Returned in conjunction with orderNumber when a transaction is successfully processed through the gateway. This value will be blank when issuing a VOID.
softwareVersion
Alphanumeric20
The version number of the the CreditCard SOAP Service.
state
Alpha10
The result of a request. A successful request will have a state of OK. Attribute not present when using storeCard.
transactionProcessingMessages
XMLN/A
Error messages from a request. This attribute will not be present on a successful request, but can exist one or more times with an error. See example to the right for structure of attribute.

API Fault

Generally, the only time a fault should be thrown is if you can’t connect to our system, or if the soap package is malformed. Verify you can access our WSDL and that all required elements listed above are present in your request.

Credit Card Vault

PDCFlow also offers a Credit Card Vault for even more secure credit card processing, particularly in the event of a recurring payment or other multiple transactions. The Vault is fully PCI-DSS compliant and allows you to process transactions without the risk of passing actual credit card information in a live environment. There are two distinct web services in the package. The first is to set up the key that will apply to the credit card number and then a second service to process a transaction based on the key.

The WSDL for the Vault and the Credit Card Processing are nearly identical. It will require the same core input as listed in the previous chart for the Credit Card transaction WSDL. The primary difference is that you will “Store” the card number in the Vault and the Vault will do any future processing of that card. When you store the card in the Vault, it will return a “cardStorageResult” as opposed to a card processing result. This element will also return a unique “authorizationKey”. You will need to save and store this key. When you wish to process a charge to the credit card, you will use the Key as a reference for the card number that is inside the Vault.

A stored card transaction uses the same basic information as for a normal credit card transaction. For the new charge, you will need to send the new transaction information that includes the processingCommand and the chargeAmount/convenienceFee.

Sample Code

This section offers some client implementation examples in different languages. Keep in mind, these are only minimalistic examples used to demonstrate the Credit Card Services API and are not meant for production use.

Process a basic credit card transaction

<?php

// Get customer-specific information
$userInformation = [
    'accountSet' => '0001',
    'customerID' => '0000',
    'securityKey' => 'SomeSecurityKey',
    'userName' => 'frontenduser@pdc4u.com'
];

// Payment-specific information
$creditCardInformation = [
    'cardHolderFirstName' => 'Adam',
    'cardHolderLastName' => 'Test',
    'cardHolderStreetAddress1' => '1234 Main St.',
    'cardHolderStreetAddress2' => 'Apt. 7B',
    'cardHolderCity' => 'Ogden',
    'cardHolderState' => 'UT',
    'cardHolderZipCode' => '84404',
    'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
    'cardHolderPhoneNumber' => '777-777-7777',
    'accountReference' => 'AB1234',
    'memoInformation' => 'December payment',
    'cardMagStripeData' => '',
    'cardNumber' => '4000100011112224',
    'cardExpirationMonth' => '09',
    'cardExpirationYear'=> '22',
    'cardCvv2' => '123',        
    'chargeAmount' => '5.00',
    'convenienceFee' => '0.50',
    'currencyType' => 'EXT',
    'processingCommand' => 'SALE',
    'secondaryTrace' => '',
    'originalOrderNumber' => ''
];

$url = 'https://cclegacydemo.pdc4u.com/CreditCardServices/CreditCardTransactionProcessor?wsdl';
$namespace = 'http://transaction.webservices.pdc4u.com';
$method = 'processCreditCardTransaction';
$params = [
    'creditCard' => $creditCardInformation,
    'userInfo'=> $userInformation
];

$client = new SoapClient($url);

try {
  $response = $client->__soapCall(
    $method,
    [$params, $namespace]
  );

  print_r($response);
}
catch (SoapFault $fault) {
  print_r($fault);
}

#!/usr/bin/perl

use SOAP::Lite +trace => 'debug';

my $soap = SOAP::Lite
   ->readable(1)
   ->autotype(0)
   ->ns( 'http://transaction.webservices.pdc4u.com/', "ns1" )
   ->proxy( 'https://cclegacydemo.pdc4u.com/CreditCardServices/CreditCardTransactionProcessor?wsdl' );

my %userInformation = (
  'pdcAccountSet' => '01',
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
  'userName' => 'frontenduser@pdc4u.com'
);

# Payment-specific information
my %creditCardInformation = (
   'cardHolderFirstName' => 'Adam',
   'cardHolderLastName' => 'Test',
   'cardHolderStreetAddress1' => '1234 Main St.',
   'cardHolderStreetAddress2' => 'Apt. 7B',
   'cardHolderCity' => 'Ogden',
   'cardHolderState' => 'UT',
   'cardHolderZipCode' => '84404',
   'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
   'cardHolderPhoneNumber' => '777-777-7777',
   'accountReference' => 'AB1234',
   'memoInformation' => 'December payment',
   'cardMagStripeData' => '',
   'cardNumber' => '4000100011112224',
   'cardExpirationMonth' => '09',
   'cardExpirationYear'=> '22',
   'cardCvv2' => '123',
   'chargeAmount' => '5.00',
   'convenienceFee' => '0.50',
   'currencyType' => 'EXT',
   'processingCommand' => 'SALE',
   'secondaryTrace' => '',
   'originalOrderNumber' => ''
);

print $soap->call( 'processCreditCardTransaction',
   SOAP::Data->name('creditCard' => \%creditCardInformation),
   SOAP::Data->name('userInfo' => \%userInformation)
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://cclegacydemo.pdc4u.com/CreditCardServices/CreditCardTransactionProcessor?wsdl',
      log_level: :debug,
      log: true,
      pretty_print_xml: true)

   puts "Available operations: "
   client.operations.each { |x| puts "   #{x}", "\n" } # find which operations are supported

   # Get customer-specific information
   userInformation = {
      'accountSet' => '0001',
      'customerID' => '0000',
      'securityKey' => 'SomeSecurityKey',
      'userName' => 'frontenduser@pdc4u.com'
   }

   # Payment-specific information
   creditCardInformation = {
      'cardHolderFirstName' => 'Adam',
      'cardHolderLastName' => 'Test',
      'cardHolderStreetAddress1' => '1234 Main St.',
      'cardHolderStreetAddress2' => 'Apt. 7B',
      'cardHolderCity' => 'Ogden',
      'cardHolderState' => 'UT',
      'cardHolderZipCode' => '84404',
      'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
      'cardHolderPhoneNumber' => '777-777-7777',
      'accountReference' => 'AB1234',
      'memoInformation' => 'December payment',
      'cardMagStripeData' => '',
      'cardNumber' => '4000100011112224',
      'cardExpirationMonth' => '09',
      'cardExpirationYear'=> '22',
      'cardCvv2' => '123',
      'chargeAmount' => '5.00',
      'convenienceFee' => '0.50',
      'currencyType' => 'EXT',
      'processingCommand' => 'SALE',
      'secondaryTrace' => '',
      'originalOrderNumber' => ''
   }

   params = {
      'creditCard' => creditCardInformation,
      'userInfo'=> userInformation
   }

   response = client.call(:process_credit_card_transaction, message: params)

   puts response
rescue
   puts "Caught: #$!\n"
end

General transactions will use this method. It will simply accept credit card details, and process the card.

The URL to process a credit card is:
test wsdl:
https://cclegacydemo.pdc4u.com/CreditCardServices/CreditCardTransactionProcessor?wsdl
live wsdl:
https://cclegacy.pdc4u.com/CreditCardServices/CreditCardTransactionProcessor?wsdl

The namespace to use is:
http://transaction.webservices.pdc4u.com

The method to use is:
processCreditCardTransaction

Store a credit card in the vault

<?php

// Get customer-specific information
$userInformation = [
    'accountSet' => '0001',
    'customerID' => '0000',
    'securityKey' => 'SomeSecurityKey',
    'userName' => 'frontenduser@pdc4u.com'
];

// Payment-specific information
$creditCardInformation= [
    'cardHolderFirstName' => 'Adam',
    'cardHolderLastName' => 'Test',
    'cardHolderStreetAddress1' => '1234 Main St.',
    'cardHolderStreetAddress2' => 'Apt. 7B',
    'cardHolderCity' => 'Ogden',
    'cardHolderState' => 'UT',
    'cardHolderZipCode' => '84404',
    'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
    'cardHolderPhoneNumber' => '777-777-7777',
    'accountReference' => 'AB1234',
    'memoInformation' => 'December payment',
    'cardMagStripeData' => '',
    'cardNumber' => '4000100011112224',
    'cardExpirationMonth' => '09',
    'cardExpirationYear'=> '22',
    'cardCvv2' => '',       
    'chargeAmount' => '',
    'convenienceFee' => '',
    'currencyType' => 'EXT',
    'processingCommand' => 'SALE',
    'secondaryTrace' => '',
    'originalOrderNumber' => ''
];

$url = 'https://cclegacydemo.pdc4u.com/CreditCardServices/CardVault?wsdl';
$namespace = 'http://transaction.webservices.pdc4u.com';
$method = 'storeCard';
$params = [
    'creditCard' => $creditCardInformation,
    'userInfo'=> $userInformation
];

$client = new SoapClient($url);

try {
  $response = $client->__soapCall(
    $method,
    [$parms, $namespace]
  );

  print_r($response);
}
catch (SoapFault $fault) {
  print_r($fault);
}
#!/usr/bin/perl

use SOAP::Lite +trace => 'debug';

my $soap = SOAP::Lite
   ->readable(1)
   ->autotype(0)
   ->ns( 'http://transaction.webservices.pdc4u.com/', "ns1" )
   ->proxy( 'https://cclegacydemo.pdc4u.com/CreditCardServices/CardVault?wsdl' );

my %userInformation = (
  'pdcAccountSet' => '01',
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
  'userName' => 'frontenduser@pdc4u.com'
);

# Payment-specific information
my %creditCardInformation = (
   'cardHolderFirstName' => 'Adam',
   'cardHolderLastName' => 'Test',
   'cardHolderStreetAddress1' => '1234 Main St.',
   'cardHolderStreetAddress2' => 'Apt. 7B',
   'cardHolderCity' => 'Ogden',
   'cardHolderState' => 'UT',
   'cardHolderZipCode' => '84404',
   'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
   'cardHolderPhoneNumber' => '777-777-7777',
   'accountReference' => 'AB1234',
   'memoInformation' => 'December payment',
   'cardMagStripeData' => '',
   'cardNumber' => '4000100011112224',
   'cardExpirationMonth' => '09',
   'cardExpirationYear'=> '22',
   'cardCvv2' => '123',
   'chargeAmount' => '',
   'convenienceFee' => '',
   'currencyType' => 'EXT',
   'processingCommand' => 'SALE',
   'secondaryTrace' => '',
   'originalOrderNumber' => ''
);

print $soap->call( 'storeCard',
   SOAP::Data->name('creditCard' => \%creditCardInformation),
   SOAP::Data->name('userInfo' => \%userInformation)
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://cclegacydemo.pdc4u.com/CreditCardServices/CardVault?wsdl',
      log_level: :debug,
      log: true,
      pretty_print_xml: true)

   puts "Available operations: "
   client.operations.each { |x| puts "   #{x}", "\n" } # find which operations are supported

   # Get customer-specific information
   userInformation = {
      'accountSet' => '0001',
      #'customerID' => '0000',
      #'securityKey' => 'SomeSecurityKey',
      'customerID' => '6299',
      'securityKey' => '31819d62fe0161d307defb1737b74ba4',
      'userName' => 'frontenduser@pdc4u.com'
   }

   # Payment-specific information
   creditCardInformation= {
      'cardHolderFirstName' => 'Adam',
      'cardHolderLastName' => 'Test',
      'cardHolderStreetAddress1' => '1234 Main St.',
      'cardHolderStreetAddress2' => 'Apt. 7B',
      'cardHolderCity' => 'Ogden',
      'cardHolderState' => 'UT',
      'cardHolderZipCode' => '84404',
      'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
      'cardHolderPhoneNumber' => '777-777-7777',
      'accountReference' => 'AB1234',
      'memoInformation' => 'December payment',
      'cardMagStripeData' => '',
      'cardNumber' => '4000100011112224',
      'cardExpirationMonth' => '09',
      'cardExpirationYear'=> '22',
      'cardCvv2' => '',
      'chargeAmount' => '',
      'convenienceFee' => '',
      'currencyType' => 'EXT',
      'processingCommand' => 'SALE',
      'secondaryTrace' => '',
      'originalOrderNumber' => ''
   }

   params = {
      'creditCard' => creditCardInformation,
      'userInfo'=> userInformation
   }

   response = client.call(:store_card, message: params)

   puts response
rescue
   puts "Caught: #$!\n"
end

Tokenize card details (card number, card expiration month, card expiration year) to be used later, generally in conjunction with the next code sample, the processStoredCreditCardTransaction method. This will only store a card, it will not process a transaction. Transaction details are generally not required at this point, as you are only storing card information. The cvv2 is also not necessary, as this piece of data can not be stored.

The URL to test the vault storage service is:
test wsdl:
https://cclegacydemo.pdc4u.com/CreditCardServices/CardVault?wsdl
live wsdl:
https://cclegacy.pdc4u.com/CreditCardServices/CardVault?wsdl

The namespace to use is:
http://transaction.webservices.pdc4u.com

The method to use is:
storeCard

Process a credit card transaction from the vault

<?php

// Get customer-specific information
$userInformation = [
    'accountSet' => '0001',
    'customerID' => '0000',
    'securityKey' => 'SomeSecurityKey',
    'userName' => 'frontenduser@pdc4u.com'
];

// Payment-specific information
$creditCardInformation = [
    'cardHolderFirstName' => 'Adam',
    'cardHolderLastName' => 'Test',
    'cardHolderStreetAddress1' => '1234 Main St.',
    'cardHolderStreetAddress2' => 'Apt. 7B',
    'cardHolderCity' => 'Ogden',
    'cardHolderState' => 'UT',
    'cardHolderZipCode' => '84404',
    'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
    'cardHolderPhoneNumber' => '777-777-7777',
    'accountReference' => 'AB1234',
    'memoInformation' => 'December payment',
    'cardMagStripeData' => '',
    'cardNumber' => '',
    'cardExpirationMonth' => '',
    'cardExpirationYear'=> '',
    'cardCvv2' => '',       
    'chargeAmount' => '5.00',
    'convenienceFee' => '0.50',
    'currencyType' => 'EXT',
    'processingCommand' => 'SALE',
    'secondaryTrace' => '',
    'originalOrderNumber' => ''
];

//Tokenized card from vault to use
$vaultInformation = [
    'vaultKey' => 'abc123'
];

$url = 'https://cclegacydemo.pdc4u.com/CreditCardServices/StoredCreditCardTransactionProcessor?wsdl';
$namespace = 'http://transaction.webservices.pdc4u.com';
$method = 'processStoredCreditCardTransaction';
$params = [
    'creditCard' => $creditCardInformation,
    'userInfo'=> $userInformation,
    'vaultInfo' => $vaultInformation
];

$client = new SoapClient($url);

try {
  $response = $client->__soapCall(
    $method,
    [$parms, $namespace]
  );

  print_r($response);
}
catch (SoapFault $fault) {
  print_r($fault);
}
#!/usr/bin/perl

use SOAP::Lite +trace => 'debug';

my $soap = SOAP::Lite
   ->readable(1)
   ->autotype(0)
   ->ns( 'http://transaction.webservices.pdc4u.com/', "ns1" )
   ->proxy( 'https://cclegacydemo.pdc4u.com/CreditCardServices/StoredCreditCardTransactionProcessor?wsdl' );

my %userInformation = (
  'pdcAccountSet' => '01',
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
  'userName' => 'frontenduser@pdc4u.com'
);

# Payment-specific information
my %creditCardInformation = (
   'cardHolderFirstName' => 'Adam',
   'cardHolderLastName' => 'Test',
   'cardHolderStreetAddress1' => '1234 Main St.',
   'cardHolderStreetAddress2' => 'Apt. 7B',
   'cardHolderCity' => 'Ogden',
   'cardHolderState' => 'UT',
   'cardHolderZipCode' => '84404',
   'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
   'cardHolderPhoneNumber' => '777-777-7777',
   'accountReference' => 'AB1234',
   'memoInformation' => 'December payment',
   'cardMagStripeData' => '',
   'cardNumber' => '',
   'cardExpirationMonth' => '',
   'cardExpirationYear'=> '',
   'cardCvv2' => '',
   'chargeAmount' => '5.00',
   'convenienceFee' => '0.50',
   'currencyType' => 'EXT',
   'processingCommand' => 'SALE',
   'secondaryTrace' => '',
   'originalOrderNumber' => ''
);

# Tokenized card from vault to use
my %vaultInformation = (
   'vaultKey' => 'abc123'
);

print $soap->call( 'processStoredCreditCardTransaction',
   SOAP::Data->name('creditCard' => \%creditCardInformation),
   SOAP::Data->name('userInfo' => \%userInformation),
   SOAP::Data->name('vaultInfo' => \%vaultInformation)
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://cclegacydemo.pdc4u.com/CreditCardServices/StoredCreditCardTransactionProcessor?wsdl',
      log_level: :debug,
      log: true,
      pretty_print_xml: true)

   puts "Available operations: "
   client.operations.each { |x| puts "   #{x}", "\n" } # find which operations are supported

   # Get customer-specific information
   userInformation = {
      'accountSet' => '0001',
      'customerID' => '0000',
      'securityKey' => 'SomeSecurityKey',
      'userName' => 'frontenduser@pdc4u.com'
   };

   # Payment-specific information
   creditCardInformation = {
      'cardHolderFirstName' => 'Adam',
      'cardHolderLastName' => 'Test',
      'cardHolderStreetAddress1' => '1234 Main St.',
      'cardHolderStreetAddress2' => 'Apt. 7B',
      'cardHolderCity' => 'Ogden',
      'cardHolderState' => 'UT',
      'cardHolderZipCode' => '84404',
      'cardHolderEmailAddress' => 'adamemail@pdc4u.com',
      'cardHolderPhoneNumber' => '777-777-7777',
      'accountReference' => 'AB1234',
      'memoInformation' => 'December payment',
      'cardMagStripeData' => '',
      'cardNumber' => '',
      'cardExpirationMonth' => '',
      'cardExpirationYear'=> '',
      'cardCvv2' => '',
      'chargeAmount' => '5.00',
      'convenienceFee' => '0.50',
      'currencyType' => 'EXT',
      'processingCommand' => 'SALE',
      'secondaryTrace' => '',
      'originalOrderNumber' => ''
   }

   # Tokenized card from vault to use
   vaultInformation = {
      'vaultKey' => 'abc123'
   }

   params = {
      'creditCard' => creditCardInformation,
      'userInfo'=> userInformation,
      'vaultInfo' => vaultInformation
   }

   response = client.call(:process_stored_credit_card_transaction, message: params)

   puts response
rescue
   puts "Caught: #$!\n"
end

A vault key should have been stored previously. Generally, you would use the previous code example to generate the vault key (storeCard method). Using that key, you can now process a card without having to resubmit the card information. A tokenized card will only auto-populate the card number and the card expiration date. No other previous transaction information will be used in this transaction.

The URL for testing the processing on a card that is already in the vault is:
test wsdl:
https://cclegacydemo.pdc4u.com/CreditCardServices/StoredCreditCardTransactionProcessor?wsdl
live wsdl:
https://cclegacy.pdc4u.com/CreditCardServices/StoredCreditCardTransactionProcessor?wsdl

The namespace to use is:
http://transaction.webservices.pdc4u.com

The method to use is:
processStoredCreditCardTransaction

ECheck API [DEPRECATED]

This document describes the different objects and methods required to use the PDCFlow ECheckServices SOAP services.

The PDCFlow ECheck API consists of a few web services:

Transaction Processing

Submit an ACH transaction to the PDCFlow ACH system. A transaction can be processed one at a time, or in a batch mode. The objects required are the same. See the sample code below for how to send one transaction vs multiple transactions.

API Processing Request

userInfo

The following table describes the individual elements of the userInfo object.

Attribute Description
customerID
Numeric4
Required
A four digit customer ID that together with the securityKey uniquely identifies the customer processing ACH transactions.
securityKey
Alphanumeric128
Required
A password that together with the customerID uniquely identifies the customer processing ACH transactions.
pdcAccountSet
Numeric2
Required
Code to determine what account to deposit funds.
Format: 01, 02, 10, etc.
userName
Alphanumeric50
The user who submitted the transaction.
groupID
Deprecated
This element is deprecated. Do not include in request.
interLevelBillingCode
Deprecated
This element is deprecated. Do not include in request.

API Processing Request

achTransaction

The following table describes the individual elements of the achTransaction object.

Attribute Description
payorFirstName
Alpha45
Required
Payor first name.
payorLastName
Alpha45
Required
Payor last name.
payorStreetAddress1
Alphanumeric45
The first line of the street/mailing address of the payor.
payorStreetAddress2
Alphanumeric45
The second line of the street/mailing address of the payor.
payorCity
Alpha45
Payor city.
payorState
Alphanumeric2
Payor state.
Format: two character abbreviation (UT, CA, MI, etc)
payorZip
Numeric10
Payor zip code.
transactionEmailAddress
Alphanumeric75
Email address where a receipt will be sent at the completion of the transaction.
payorPhoneNumber
Numeric15
Payor telephone number.
Format: XXX-XXX-XXXX
payorPhoneNumberType
Deprecated
This element is deprecated. Do not include in request.
payorAccountReference
Numeric20
Required
Reference/ID value. This is often the customer account number from your system.
payorMemoInformation
Alphanumeric50
Memo information for the explanation of the transaction.
payorBankRoutingNumber
Numeric9
Required
Payor bank routing number.
payorBankAccountNumber
Numeric20
Required
Payor bank account number.