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": [
      "122-1"
    ],
    "achAccountDirectiveList": [
      "123-1",
      "123-2"
    ],
    "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.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
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": [
      "122-1"
    ],
    "achAccountDirectiveList": [
      "123-1",
      "123-2"
    ],
    "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": [
      "122-1"
    ],
    "achAccountDirectiveList": [
      "123-1",
      "123-2"
    ],
    "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": [
      "122-1"
    ],
    "achAccountDirectiveList": [
      "123-1",
      "123-2"
    ],
    "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "123-1",
            "name": "Business Account",
            "isDefault": true
          },
          {
            "accountDirective": "123-2",
            "name": "Digitally Authorized",
            "isDefault": false
          }
        ],
        "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.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
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": [
      "122-1"
    ],
    "achAccountDirectiveList": [
      "123-1",
      "123-2"
    ],
    "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.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default for locations in this group.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default for locations in this group.
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": [
      "122-1"
    ],
    "achAccountDirectiveList": [
      "123-1",
      "123-2"
    ],
    "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "123-2",
            "name": "Digitally Authorized",
            "isDefault": false
          }
        ],
        "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.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default for locations in this group.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default for locations in this group.
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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "2222-4",
            "name": "Business Account",
            "isDefault": false
          }
        ],
        "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "1234-10",
            "name": "PPD",
            "isDefault": false
          },
          {
            "accountDirective": "1234-11",
            "name": "WEB",
            "isDefault": true
          },
          {
            "accountDirective": "1234-12",
            "name": "TEL",
            "isDefault": false
          },
          {
            "accountDirective": "1234-5",
            "name": "CCD",
            "isDefault": false
          }
        ],
        "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": [
      "122-1"
    ],
    "achAccountDirectiveList": [
      "123-1",
      "123-2"
    ],
    "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "123-2",
            "name": "Digitally Authorized",
            "isDefault": false
          }
        ],
        "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "2222-4",
            "name": "Business Account",
            "isDefault": false
          }
        ],
        "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "1234-10",
            "name": "PPD",
            "isDefault": false
          },
          {
            "accountDirective": "1234-11",
            "name": "WEB",
            "isDefault": true
          },
          {
            "accountDirective": "1234-12",
            "name": "TEL",
            "isDefault": false
          },
          {
            "accountDirective": "1234-5",
            "name": "CCD",
            "isDefault": false
          }
        ],
        "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": "122-1",
        "name": "Card not present",
        "isDefault": true
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account",
        "isDefault": true
      },
      {
        "accountDirective": "123-2",
        "name": "Digitally Authorized",
        "isDefault": false
      }
    ],
    "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.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
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": "122-1",
        "name": "Card not present",
        "isDefault": true
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account",
        "isDefault": true
      },
      {
        "accountDirective": "123-2",
        "name": "Digitally Authorized",
        "isDefault": false
      }
    ],
    "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.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.

–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": "122-1",
        "name": "Card not present",
        "isDefault": true
      }
    ],
    "achAccountDirectiveList": [
      {
        "accountDirective": "123-1",
        "name": "Business Account",
        "isDefault": true
      },
      {
        "accountDirective": "123-2",
        "name": "Digitally Authorized",
        "isDefault": false
      }
    ],
    "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.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.
achAccountDirectiveList
ListN/A
List of ACH AccountDirective
Attribute Description
accountDirective
Alphanumeric10
The Account Directive.
name
Alphanumeric20
The name of the Account Directive.
isDefault
Boolean5
DEPRECATED: This field is no longer used and will be removed in a future release.
Boolean stating if this Account Directive is the default.

–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",
            "isDefault": true
          },
          {
            "accountDirective": "111-2",
            "name": "Card Present",
            "isDefault": false
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-1",
            "name": "Telephone Initiated",
            "isDefault": true
          },
          {
            "accountDirective": "222-2",
            "name": "Digitally Authorized",
            "isDefault": false
          }
        ],
        "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-1",
            "name": "Telephone Initiated",
            "isDefault": true
          }
        ],
        "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-1",
            "name": "Telephone Initiated",
            "isDefault": true
          },
          {
            "accountDirective": "2222-2",
            "name": "Prearranged Payment",
            "isDefault": false
          },
          {
            "accountDirective": "222-3",
            "name": "Digitally Authorized",
            "isDefault": false
          },
          {
            "accountDirective": "222-4",
            "name": "Business Account",
            "isDefault": false
          }
        ],
        "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",
            "isDefault": true
          }
        ],
        "achAccountDirectiveList": [
          {
            "accountDirective": "222-3",
            "name": "Digitally Authorized",
            "isDefault": false
          },
          {
            "accountDirective": "222-4",
            "name": "Business Account",
            "isDefault": false
          }
        ],
        "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.
isDefault
Boolean5
Boolean stating if this Account Directive is the default.

–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.Http;
using System.Net.Http.Headers;

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 scheduleText { 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 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 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();

            Billing billing = new Billing();
            billing.SetAutoBilling(true);
            billing.SetPaymentMethod("CARD");
            billing.SetUsername("testUser@test.com");
            BillingCard billingCard = new BillingCard();
            billingCard.SetToken("thisIsAToken1234");
            billingCard.SetExpirationMonth(12);
            billingCard.SetExpirationYear(25);
            billing.SetBillingCard(billingCard);
            company.SetBilling(billing);

            Settings settings = new Settings();
            settings.SetDescription("Here I describe this company");
            settings.SetReceiptText("Thank you for paying");
            settings.SetScheduleText("Thank you for scheduling");
            settings.SetCardFeeAmount(2.25);
            settings.SetAchFeeAmount(3.00);
            settings.SetUsername("testUser@test.com");
            Address address = new Address();
            address.SetStreetAddressOne("First street");
            address.SetCity("Our city");
            address.SetState("AL");
            address.SetZip("12345");
            address.SetCountry("US");
            settings.SetAddress(address);
            company.SetSettings(settings);

            BillingEmails billingEmails = new BillingEmails();
            billingEmails.GetPrimaryList().Add("test@test.com");
            billingEmails.GetPrimaryList().Add("test2@test.com");
            billingEmails.GetSecondaryList().Add("testSecondary@test.com");
            company.SetBillingEmails(billingEmails);


            PUTData(company, url);

            //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();
        }


        private Company 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("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            HttpResponseMessage response = await client.PutAsJsonAsync(new Uri(url), company);
            if (response.IsSuccessStatusCode) {
                company = await response.Content.ReadAsAsync<Company>();
            }

            /*
             * 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 {
   @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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 scheduleText { 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 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 HttpClient client = new HttpClient();

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

            //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();
        }


        private 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));
            if (response.IsSuccessStatusCode) {
                company = await response.Content.ReadAsAsync<Company>();
            }

            /*
             * 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.Http;
using System.Net.Http.Headers;

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 scheduleText { 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 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 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.SetDescription("Here I describe this company");
            settings.SetReceiptText("Thank you for paying");
            settings.SetCardFeeAmount(2.25);
            settings.SetUsername("testUser@test.com");
            Address address = new Address();
            address.SetStreetAddressOne("First street");
            address.SetCountry("US");
            settings.SetAddress(address);
            company.SetSettings(settings);

            PATCHData(company, url);

            //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();
        }


        private Company PATCHData(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("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            HttpResponseMessage response = await client.PatchAsJsonAsync(new Uri(url), company);
            if (response.IsSuccessStatusCode) {
                company = await response.Content.ReadAsAsync<Company>();
            }

            /*
             * 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 {
   @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',
        'isDefault' => true,
      ],
      1 => [
         'accountDirective' => '888-2',
         'isDefault' => false,
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1',
        'isDefault' => true,
      ],
    ],
  ],
];

$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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 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.SetName("Albuquerque Group");
            settings.SetDescription("Our offices in Albuquerque");
            settings.SetReceiptText("Thank you for paying");
            settings.SetScheduleText("Thank you for scheduling");
            settings.SetCardFeeAmount(2.25);
            settings.SetAchFeeAmount(3.00);
            settings.SetUsername("testUser@test.com");
            Address address = new Address();
            address.SetStreetAddressOne("First street");
            address.SetCity("Our city");
            address.SetState("AL");
            address.SetZip("12345");
            address.SetCountry("US");
            settings.SetAddress(address);
            group.SetSettings(settings);
            group.SetCustomId("Albuquerque offices");

            POSTData(group, url);

            //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();
        }


        private Group 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("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            HttpResponseMessage response = await client.PostAsync(new Uri(url), group);
            if (response.IsSuccessStatusCode) {
                group = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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 $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",
                  "isDefault": true
              },
              {
                  "accountDirective": "888-2",
                  "isDefault": false
              }
          ],
          "achAccountDirectiveList": [
              {
                  "accountDirective": "2071-1",
                  "isDefault": true
              }
          ]
      }
    };

   $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",
                    "isDefault": true
                },
                {
                    "accountDirective": "888-2",
                    "isDefault": false
                }
            ],
            "achAccountDirectiveList": [
                {
                    "accountDirective": "2071-1",
                    "isDefault": true
                }
            ]
        }
    }

   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',
        'isDefault' => true,
      ],
      1 => [
         'accountDirective' => '888-2',
         'isDefault' => false,
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1',
        'isDefault' => true,
      ],
    ],
  ],
];

$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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 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();
            group.SetCustomId("Albuquerque offices"1234);

            Settings settings = new Settings();
            settings.SetName("Albuquerque Group");
            settings.SetDescription("Change Our offices in Albuquerque");
            settings.SetScheduleText("Thank you for scheduling");
            settings.SetCardFeeAmount(2.25);
            settings.SetAchFeeAmount(3.00);
            settings.SetUsername("testUser@test.com");
            /*
             * Not including the address in a PUT will set the group address to null
             */
            group.SetSettings(settings);

            PUTData(group, url);

            //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();
        }


        private Group 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));

            HttpResponseMessage response = await client.PutAsync(new Uri(url), group);
            if (response.IsSuccessStatusCode) {
                group = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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 $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",
                  "isDefault": true
              },
              {
                  "accountDirective": "888-2",
                  "isDefault": false
              }
          ],
          "achAccountDirectiveList": [
              {
                  "accountDirective": "2071-1",
                  "isDefault": true
              }
          ]
      }
    };

   $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",
                    "isDefault": true
                },
                {
                    "accountDirective": "888-2",
                    "isDefault": false
                }
            ],
            "achAccountDirectiveList": [
                {
                    "accountDirective": "2071-1",
                    "isDefault": true
                }
            ]
        }
    }

   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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private 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;
            GETData(url);

            //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();
        }


        private Group 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));

            Group group = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            if (response.IsSuccessStatusCode) {
                group = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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?{GroupSearchParameters}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups?{GroupSearchParameters}

Sample GET Group request with GroupSearchParameters

<?php
$desiredGroupName = "Name";
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups?groupName=' . $desiredGroupName;

$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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 MainClass {
            private HttpClient client = new HttpClient();

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

                //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();
            }


            private GroupList 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));

                GroupList groups = null;
                HttpResponseMessage response = await client.GetAsync(new Uri(url));
                if (response.IsSuccessStatusCode) {
                    groups = await response.Content.ReadAsAsync<GroupList>();
                }

                /*
                 * 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 $desiredGroupName = "Name";
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups?groupName=' . $desiredGroupName;

   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

   desiredGroupName = "Name";
   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups?groupName=' + desiredGroupName
   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 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',
        'isDefault' => true,
      ],
      1 => [
         'accountDirective' => '888-2',
         'isDefault' => false,
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1',
        'isDefault' => true,
      ],
    ],
  ],
];

$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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private 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.setActivation = true;
            location.SetCustomId("Alb1");

            Settings settings = new Settings();
            settings.SetName("Albuquerque Location 1");
            settings.SetDescription("First in Albuquerque");
            settings.SetReceiptText("Thank you for paying");
            settings.SetScheduleText("Thank you for scheduling");
            settings.SetCardFeeAmount(2.25);
            settings.SetAchFeeAmount(3.00);
            settings.SetUsername("testUser@test.com");

            Address address = new Address();
            address.SetStreetAddressOne("First street");
            address.SetCity("Our city");
            address.SetState("AL");
            address.SetZip("12345");
            address.SetCountry("US");
            settings.SetAddress(address);
            location.SetSettings(settings);

            POSTData(location, url);

            //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();
        }


        private Location 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));

            HttpResponseMessage response = await client.PostAsync(new Uri(url), location);
            if (response.IsSuccessStatusCode) {
                location = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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 $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",
                  "isDefault": true
              },
              {
                  "accountDirective": "888-2",
                  "isDefault": false
              }
          ],
          "achAccountDirectiveList": [
              {
                  "accountDirective": "2071-1",
                  "isDefault": true
              }
          ]
      }
    };

   $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",
                    "isDefault": true
                },
                {
                    "accountDirective": "888-2",
                    "isDefault": false
                }
            ],
            "achAccountDirectiveList": [
                {
                    "accountDirective": "2071-1",
                    "isDefault": true
                }
            ]
        }
    }

   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',
        'isDefault' => true,
      ],
      1 => [
         'accountDirective' => '888-2',
         'isDefault' => false,
      ]
    ],
    'achAccountDirectiveList' => [
      0 => [
        'accountDirective' => '2071-1',
        'isDefault' => true,
      ],
    ],
  ],
];

$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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private 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.setActivation = true;
            location.SetCustomId("Alb1");

            Settings settings = new Settings();
            settings.SetName("Albuquerque Location 1");
            settings.SetDescription("First in Albuquerque");
            settings.SetReceiptText("Thank you for paying");
            settings.SetScheduleText("Thank you for scheduling");
            settings.SetCardFeeAmount(2.25);
            settings.SetAchFeeAmount(3.00);
            settings.SetUsername("testUser@test.com");

            Address address = new Address();
            address.SetStreetAddressOne("First street");
            address.SetCity("Our city");
            address.SetState("AL");
            address.SetZip("12345");
            address.SetCountry("US");
            settings.SetAddress(address);
            location.SetSettings(settings);

            PUTData(location, url);

            //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();
        }


        private Location 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));

            HttpResponseMessage response = await client.PutAsync(new Uri(url), location);
            if (response.IsSuccessStatusCode) {
                location = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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 $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",
                     "isDefault": true
                 },
                 {
                     "accountDirective": "888-2",
                     "isDefault": false
                 }
             ],
             "achAccountDirectiveList": [
                 {
                     "accountDirective": "2071-1",
                     "isDefault": true
                 }
             ]
         }
    };

   $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",
                   "isDefault": true
               },
               {
                   "accountDirective": "888-2",
                   "isDefault": false
               }
           ],
           "achAccountDirectiveList": [
               {
                   "accountDirective": "2071-1",
                   "isDefault": true
               }
           ]
       }
   }

   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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private 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;
            GETData(url);

            //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();
        }


        private Location 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));

            Location location = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            if (response.IsSuccessStatusCode) {
                location = await response.Content.ReadAsAsync<Location>();
            }

            /*
             * 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?{LocationSearchParameters}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations?{LocationSearchParameters}

Sample GET Location request with LocationSearchParameters

<?php
$desiredLocationName = "Name";
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations?activation=true&isAssignedToGroup=true&locationNameOrCustomId=' . $desiredLocationName;

$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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private string locationNameOrCustomId;
        private bool activation;
        private bool isAssignedToGroup;
        private List<Long> locationIdList;
        private List<String> customIdList;
    }

    public class MainClass {
            private 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.SetActivation = true; //Only include activated locations
                locationSearchParameters.SetIsAssignedToGroup = 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.SetLocationIdList(locationIdList);

                POSTData(locationSearchParameters, url);

                //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();
            }


            private LocationList POSTData(LocationSearchParameters locationSearch, 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));

                HttpResponseMessage response = await client.PostAsync(new Uri(url), locationSearch);
                if (response.IsSuccessStatusCode) {
                    location = await response.Content.ReadAsAsync<Group>();
                }

                /*
                 * 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 $desiredLocationName = "Name";
   my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations?activation=true&isAssignedToGroup=true&locationNameOrCustomId=' . $desiredLocationName;

   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

   desiredLocationName = "Name";
   c = Curl::Easy.new
   c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations?activation=true&isAssignedToGroup=true&locationNameOrCustomId=' + desiredLocationName
   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 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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private 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.setActivation = true;

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

            PATCHData(location, url);

            //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();
        }


        private Location 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));

            HttpResponseMessage response = await client.PutAsync(new Uri(url), location);
            if (response.IsSuccessStatusCode) {
                location = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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 $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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private 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/";
            GETData(url);

            //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();
        }


        private Location 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));

            Location location = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            if (response.IsSuccessStatusCode) {
                location = await response.Content.ReadAsAsync<Location>();
            }

            /*
             * 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.Http;
using System.Net.Http.Headers;

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 bool isDefault { 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 {
        private 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.setActivation = true;
            location.SetCustomId("Alb1");

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

            POSTData(location, url);

            //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();
        }


        private Location 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));

            HttpResponseMessage response = await client.PostAsync(new Uri(url), location);
            if (response.IsSuccessStatusCode) {
                location = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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 $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.Http;
using System.Net.Http.Headers;

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 {
        private HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            AccountDirectiveList accountDirectiveList = new AccountDirectiveList();
            accountDirectiveList.GetLocationIdList().add(2);
            accountDirectiveList.GetLocationIdList().add(4);
            accountDirectiveList.GetLocationIdList().add(23);
            accountDirectiveList.GetLocationIdList().add(26);
            string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/locations/effectivesettings/accountdirectives";

            POSTData(accountDirectiveList, url);

            //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();
        }


        private AccountDirectiveList POSTData(AccountDirectiveList accountDirectiveList, 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));

            HttpResponseMessage response = await client.PostAsync(new Uri(url), location);
            if (response.IsSuccessStatusCode) {
                accountDirectiveList = await response.Content.ReadAsAsync<Group>();
            }

            /*
             * 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.
payorCheckNumber
Numeric10
Check number to appear on any printed check representing this transaction.
payorAccountType
Alpha1
Required
Account type of the payor, Checking or Savings.
Valid value(s): C, S
chargeAmount
Numeric11
Required
The net dollar amount paid by the payor.
Format: XXXX.XX
Do not use any formatting symbols such as currency symbols ($), commas etc.
feeAmount
Numeric11
Required
Transaction fee amount. Fee amount to be added to the charge amount.
Format: XXXX.XX
Do not use any formatting symbols such as currency symbols ($), commas etc.
Constraint(s): If no fee is to be added to this transaction a value of zero “0” still needs to be submitted.
transactionOrigin
Alpha3
Required
The origin of the transaction.
Valid value(s): EXT
payorTransactionType
Alpha1
Required
Type of transaction, Debit or Credit.
Valid value(s): D, C
achEntryCode
Alpha3
Required
The NACHA/ACH SEC code for how payment authorization was received. Options and descriptions can be found in the appendix.
processingDate
Date10
Required
This element represents the date the payment should be submitted to the ACH payment system.
Format: YYYY-MM-DD
secondaryTrace
Alphanumeric50
Location information about a company.

API Processing Result

processACHTransactionResponse

The following table describes the individual elements of the processACHTransactionResponse object. This object represents the results of a processed transaction.

Attribute Description
processingResult
Alpha5
The result of the transaction request.
Valid value(s):
OK - The transaction was processed successfully.
ERROR - The transaction failed.
resultMessage
Alpha256
Detailed explanation of the result of the processed transaction. If processingResult was ERROR this field will provide details about why the transaction processing failed.
transactionID
Numeric20
Order/Confirmation number to transaction. This is used as a reference to a particular transaction after submission to the PDCFlow system.
achTransaction
ObjectN/A
The transaction details that were contained in your original request.

API Processing 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.

Transaction Inquiry

Retrieve the status details of a transaction you have previously submitted.

API Inquiry Request

echeckInquiryData

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

Attribute Description
customerID
Numeric4
Required
A four digit customer ID that together with the securityKey uniquely identifies the customer requesting ACH transaction information.
securityKey
Alphanumeric128
Required
A password that together with the customerID uniquely identifies the customer requesting ACH transaction information.
primaryTrace
Numeric20
Required
Order/Confirmation number of the transaction being inquired upon. If following up on a transaction submitted using the standard transaction processing, this would be the transactionID.

API Inquiry Result

getECheckDataResponse

The following table describes the individual elements of the getECheckDataResponse object. An ACH transaction can have more than one status message at a time, so these values can have more than one instance in a response.

Attribute Description
status
Alpha12
Current state of check in the ACH payment cycle.
Valid value(s):
WAITING - transaction will be included in next batch
SUBMITTED - transaction has been submitted for processing
ACKNOWLEDGED - transaction has been accepted for processing
FUNDED - money has been deposited into your account
DEDUCTION - money has been taken from your account
VOID - transaction was cancelled prior to submission for processing
RETURNED - an exception occurred while processing transaction
CORRECTION - transaction was automatically corrected during processing
ERROR - an unknown error occurred while processing transaction
statusDate
DateTime21
The date and time the check was submitted to PDCFlow.
Format: YYYY-MM-DD HH:mm:SS.S
statusDescription
Alpha256
Extended description of the status
secondaryTrace
Alphanumeric32
Location information about a company.

API Inquiry 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.

Transaction Status Inquiry

Retrieve a list of all status changes for all transactions since your last request.

API Update Inquiry Request

getECheckDataUpdates

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

Attribute Description
customerID
Numeric4
Required
A four digit customer ID that together with the securityKey uniquely identifies the customer requesting ACH status information.
securityKey
Alphanumeric128
Required
A password that together with the customerID uniquely identifies the customer requesting ACH status information.

API Update Inquiry Result

getECheckDataUpdatesResponse

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

Attribute Description
id
Numeric20
The transactionID
status
Alpha12
Current state of check in the ACH payment cycle.
Valid value(s):
WAITING - transaction will be included in next batch
SUBMITTED - transaction has been submitted for processing
ACKNOWLEDGED - transaction has been accepted for processing
FUNDED - money has been deposited into your account
DEDUCTION - money has been taken from your account
VOID - transaction was cancelled prior to submission for processing
RETURNED - an exception occurred while processing transaction
CORRECTION - transaction was automatically corrected during processing
ERROR - an unknown error occurred while processing transaction
statusDate
DateTime21
The date and time the check was submitted to PDCFlow.
Format: YYYY-MM-DD HH:mm:SS.SM
statusDescription
Alpha256
Extended description of the status
secondaryTrace
Alphanumeric32
Location information about a company.

API Update Inquiry 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.

Transaction Updating

Update the status of a previously submitted transaction. Currently, the only allowed method is to void a transaction. This will keep the transaction from being sent into the ACH network.

API Updating Request

eCheckUpdateData

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

Attribute Description
customerID
Numeric4
Required
A four digit customer ID that together with the securityKey uniquely identifies the customer requesting the update.
securityKey
Alphanumeric128
Required
A password that together with the customerID uniquely identifies the customer requesting the update.
primaryTrace
Numeric20
Required
Order/Confirmation number of the transaction being inquired upon. If following up on a transaction submitted using the standard transaction processing, this would be the transactionID.
newStatus
Alpha4
Required
New status to assign to the transaction.
Valid value(s): VOID

API Updating Result

updateStatusResponse

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

Attribute Description
status
Alpha5
The status of the transaction.
Valid value(s):
OK - The transaction was processed successfully.
ERROR - The transaction failed.
resultMessage
Alpha256
Result of attempted update.

API Updating 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. Common pieces to watch for are an incorrect namespace, missing one of the required 4 elements, or an element that is missing a value.

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.

processACHTransaction - Transaction Processing - individual transaction

<?php
// Get customer-specific information
$userInformation = [
  'pdcAccountSet' => '01',
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
  'userName' => 'frontenduser@pdc4u.com'
];

// Payment-specific information
$achInformation = [
  'payorFirstName' => 'Adam',
  'payorLastName' => 'Test',
  'payorStreetAddress1' => '1234 Main St.',
  'payorStreetAddress2' => 'Apt. 7B',
  'payorCity' => 'Ogden',
  'payorState' => 'UT',
  'payorZip' => '84404',
  'transactionEmailAddress' => 'adamemail@pdc4u.com',
  'payorPhoneNumber' => '777-777-7777',
  'payorAccountReference' => 'AB1234',
  'payorMemoInformation' => 'December payment',
  'payorBankRoutingNumber' => '124001545',
  'payorBankAccountNumber' => '123456',
  'payorCheckNumber' => '9999',
  'payorAccountType' => 'C',
  'chargeAmount' => '5.00',
  'feeAmount' => '0.50',
  'transactionOrigin' => 'EXT',
  'payorTransactionType' => 'D',
  'achEntryCode' => 'WEB',
  'processingDate' => '2017-05-31',
  'secondaryTrace' => ''
];

$url = 'https://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl';
$namespace = 'http://transaction.webservices.pdc4u.com';
$method = 'processACHTransaction';
$params = [
  'achTransaction' => $achInformation,
  '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://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl' );

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

# Payment-specific information
my %achInformation = (
  'payorFirstName' => 'Adam',
  'payorLastName' => 'Test',
  'payorStreetAddress1' => '1234 Main St.',
  'payorStreetAddress2' => 'Apt. 7B',
  'payorCity' => 'Ogden',
  'payorState' => 'UT',
  'payorZip' => '84404',
  'transactionEmailAddress' => 'adamemail@pdc4u.com',
  'payorPhoneNumber' => '777-777-7777',
  'payorAccountReference' => 'AB1234',
  'payorMemoInformation' => 'December payment',
  'payorBankRoutingNumber' => '124001545',
  'payorBankAccountNumber' => '123456',
  'payorCheckNumber' => '9999',
  'payorAccountType' => 'C',
  'chargeAmount' => '5.00',
  'feeAmount' => '0.50',
  'transactionOrigin' => 'EXT',
  'payorTransactionType' => 'D',
  'achEntryCode' => 'WEB',
  'processingDate' => '2017-05-31',
  'secondaryTrace' => ''
);

my @transaction;
foreach my $key ( keys %achInformation ) {
   push @transaction, SOAP::Data->name( $key => $achInformation{$key} );
}

# userInfo
my @userInfo;
foreach my $key ( keys %userInformation ) {
   push @userInfo, SOAP::Data->name( $key => $userInformation{$key} );
}

print $soap->call( 'processACHTransaction',
   SOAP::Data->name('achTransaction' => \SOAP::Data->value(@transaction)),
   SOAP::Data->name('userInfo' => \SOAP::Data->value(@userInfo))
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?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 = {
      'pdcAccountSet' => '01',
      'customerID' => '0000',
      'securityKey' => 'SomeSecurityKey',
      'userName' => 'frontenduser@pdc4u.com'
   }

   # Payment-specific information
   achInformation = {
      'payorFirstName' => 'Adam',
      'payorLastName' => 'Test',
      'payorStreetAddress1' => '1234 Main St.',
      'payorStreetAddress2' => 'Apt. 7B',
      'payorCity' => 'Ogden',
      'payorState' => 'UT',
      'payorZip' => '84404',
      'transactionEmailAddress' => 'adamemail@pdc4u.com',
      'payorPhoneNumber' => '777-777-7777',
      'payorAccountReference' => 'AB1234',
      'payorMemoInformation' => 'December payment',
      'payorBankRoutingNumber' => '124001545',
      'payorBankAccountNumber' => '123456',
      'payorCheckNumber' => '9999',
      'payorAccountType' => 'C',
      'chargeAmount' => '5.00',
      'feeAmount' => '0.50',
      'transactionOrigin' => 'EXT',
      'payorTransactionType' => 'D',
      'achEntryCode' => 'WEB',
      'processingDate' => '2017-05-31',
      'secondaryTrace' => ''
   }

   # Build the parameters
   params = {
      'achTransaction' => achInformation,
      'userInfo' => userInformation
   };

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

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

General transactions will use this method. It will simply accept ach details, and process the transaction.

The URL to process a check is:
test wsdl:
https://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl
live wsdl:
https://achlegacy.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl

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

The method to use is:
processACHTransaction

processACHTransactionBatch - Transaction Processing - batch of transactions

<?php
// Get customer-specific information
$userInformation = [
  'pdcAccountSet' => '01',
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
  'userName' => 'frontenduser@pdc4u.com'
];

// Payment-specific information
$achInformation = [
  'payorFirstName' => 'Adam',
  'payorLastName' => 'Test',
  'payorStreetAddress1' => '1234 Main St.',
  'payorStreetAddress2' => 'Apt. 7B',
  'payorCity' => 'Ogden',
  'payorState' => 'UT',
  'payorZip' => '84404',
  'transactionEmailAddress' => 'adamemail@pdc4u.com',
  'payorPhoneNumber' => '777-777-7777',
  'payorAccountReference' => 'AB1234',
  'payorMemoInformation' => 'December payment',
  'payorBankRoutingNumber' => '124001545',
  'payorBankAccountNumber' => '123456',
  'payorCheckNumber' => '9999',
  'payorAccountType' => 'C',
  'chargeAmount' => '5.00',
  'feeAmount' => '0.50',
  'transactionOrigin' => 'EXT',
  'payorTransactionType' => 'D',
  'achEntryCode' => 'WEB',
  'processingDate' => '2017-05-31',
  'secondaryTrace' => ''
];

//Payment-specific information for tran 2
$achInformation2 = $achInformation;
$achInformation2['payorFirstName'] = 'Adam2';

$url = 'https://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl';
$namespace = 'http://transaction.webservices.pdc4u.com';
$method = 'processACHTransactionBatch';
$params = [
  'achTransactionBatchItems' => [
    $achInformation,
    $achInformation2
  ],
  '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://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl' );

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

# Payment-specific information
my %achInformation = (
  'payorFirstName' => 'Adam',
  'payorLastName' => 'Test',
  'payorStreetAddress1' => '1234 Main St.',
  'payorStreetAddress2' => 'Apt. 7B',
  'payorCity' => 'Ogden',
  'payorState' => 'UT',
  'payorZip' => '84404',
  'transactionEmailAddress' => 'adamemail@pdc4u.com',
  'payorPhoneNumber' => '777-777-7777',
  'payorAccountReference' => 'AB1234',
  'payorMemoInformation' => 'December payment',
  'payorBankRoutingNumber' => '124001545',
  'payorBankAccountNumber' => '123456',
  'payorCheckNumber' => '9999',
  'payorAccountType' => 'C',
  'chargeAmount' => '5.00',
  'feeAmount' => '0.50',
  'transactionOrigin' => 'EXT',
  'payorTransactionType' => 'D',
  'achEntryCode' => 'WEB',
  'processingDate' => '2017-05-31',
  'secondaryTrace' => ''
);

my @batch1;
foreach my $key ( keys %achInformation ) {
   push @batch1, SOAP::Data->name( $key => $achInformation{$key} );
}

# Payment-specific information for tran 2
my %achInformation2 = %achInformation;
$achInformation2{'payorFirstName'} = 'Adam2';
my @batch2;
foreach my $key ( keys %achInformation2 ) {
   push @batch2, SOAP::Data->name( $key => $achInformation2{$key} );
}

# userInfo
my @userInfo;
foreach my $key ( keys %userInformation ) {
   push @userInfo, SOAP::Data->name( $key => $userInformation{$key} );
}

print $soap->call( 'processACHTransactionBatch',
   SOAP::Data->name('achTransactionBatchItems' => \SOAP::Data->value(@batch1)),
   SOAP::Data->name('achTransactionBatchItems' => \SOAP::Data->value(@batch2)),
   SOAP::Data->name('userInfo' => \SOAP::Data->value(@userInfo))
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?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 = {
      'pdcAccountSet' => '01',
      'customerID' => '0000',
      'securityKey' => 'SomeSecurityKey',
      'userName' => 'frontenduser@pdc4u.com'
   }

   # Payment-specific information
   achInformation = {
      'payorFirstName' => 'Adam',
      'payorLastName' => 'Test',
      'payorStreetAddress1' => '1234 Main St.',
      'payorStreetAddress2' => 'Apt. 7B',
      'payorCity' => 'Ogden',
      'payorState' => 'UT',
      'payorZip' => '84404',
      'transactionEmailAddress' => 'adamemail@pdc4u.com',
      'payorPhoneNumber' => '777-777-7777',
      'payorAccountReference' => 'AB1234',
      'payorMemoInformation' => 'December payment',
      'payorBankRoutingNumber' => '124001545',
      'payorBankAccountNumber' => '123456',
      'payorCheckNumber' => '9999',
      'payorAccountType' => 'C',
      'chargeAmount' => '5.00',
      'feeAmount' => '0.50',
      'transactionOrigin' => 'EXT',
      'payorTransactionType' => 'D',
      'achEntryCode' => 'WEB',
      'processingDate' => '2017-05-31',
      'secondaryTrace' => ''
   }

   # Payment-specific information for tran 2
   achInformation2 = achInformation;
   achInformation2['payerFirstName'] = 'Adam2';

   # Build the parameters
   params = {
      'achTransactionBatchItems' => [
         achInformation,
         achInformation2
      ],
      'userInfo' => userInformation
   };

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

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

You can also submit check transactions as a batch by providing a list of transactions.

The URL to process a check batch is:
test wsdl:
https://achlegacydemo.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl
live wsdl:
https://achlegacy.pdc4u.com/ECheckServices/ACHTransactionProcessor?wsdl

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

The method to use is:
processACHTransactionBatch

getECheckData - Transaction Inquiry - get details about processed transactions

<?php
// Get customer and transaction information
$updateInformation = [
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
  'primaryTrace' => 'SomeTransactionID'
];

$url = 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckInquiry?wsdl';
$namespace = 'http://inquiry.webservices.pdc4u.com';
$method = 'getECheckData';
$params = [
  'echeckInquiryData'=> $updateInformation
];

$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://inquiry.webservices.pdc4u.com/', "ns1" )
   ->proxy( 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckInquiry?wsdl' );

# Get customer and transaction information
my %updateInformation = (
   'customerID' => '0000',
   'securityKey' => 'SomeSecurityKey',
   'primaryTrace' => 'SomeTransactionID'
);

print $soap->call( 'getECheckData',
   SOAP::Data->name('eCheckInquiryData' => \%updateInformation)
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckInquiry?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 and transaction information
   updateInformation = {
      'customerID' => '0000',
      'securityKey' => 'SomeSecurityKey',
      'primaryTrace' => 'SomeTransactionID'
   }

   # Build the parameters
   params = {
      'echeckInquiryData' => updateInformation
   }

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

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

Gather information about a specific transaction.

The URL to check a transaction is:
test wsdl:
https://achlegacydemo.pdc4u.com/ECheckServices/ECheckInquiry?wsdl
live wsdl:
https://achlegacy.pdc4u.com/ECheckServices/ECheckInquiry?wsdl

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

The method to use is:
getECheckData

getECheckDataUpdates - Transaction Status Inquiry - get status changes since last request

<?php
// Get customer and transaction information
$updateInformation = [
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
];

$url = 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckUpdateInquiry?wsdl';
$namespace = 'http://inquiry.webservices.pdc4u.com';
$method = 'getECheckDataUpdates';
$params = [
  'echeckInquiryData'=> $updateInformation
];

$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://inquiry.webservices.pdc4u.com/', "ns1" )
   ->proxy( 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckUpdateInquiry?wsdl' );

# Get customer and transaction information
my %updateInformation = (
   'customerID' => '0000',
   'securityKey' => 'SomeSecurityKey',
);

print $soap->call( 'getECheckDataUpdates',
   SOAP::Data->name('echeckInquiryData' => \%updateInformation)
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckUpdateInquiry?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 and transaction information
   updateInformation = {
      'customerID' => '0000',
      'securityKey' => 'SomeSecurityKey',
   }

   # Build the parameters
   params = {
      'echeckInquiryData' => updateInformation
   }

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

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

Get details about all transactions since last request. It is recommended to use the Transaction Inquiry API rather than this method.

The URL to get status changes is:
test wsdl:
https://achlegacydemo.pdc4u.com/ECheckServices/ECheckUpdateInquiry?wsdl
live wsdl:
https://achlegacy.pdc4u.com/ECheckServices/ECheckUpdateInquiry?wsdl

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

The method to use is:
getECheckDataUpdates

updateStatus - Transaction Updating - change the status of a transaction

<?php
// Get customer and transaction information
$updateInformation = [
  'customerID' => '0000',
  'securityKey' => 'SomeSecurityKey',
  'primaryTrace' => 'SomeTransactionID',
  'newStatus' => 'VOID'
];

$url = 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckStatusUpdate?wsdl';
$namespace = 'http://update.webservices.pdc4u.com';
$method = 'updateStatus';
$params = [
  'eCheckUpdateData'=> $updateInformation
];

$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://update.webservices.pdc4u.com/', "ns1" )
   ->proxy( 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckStatusUpdate?wsdl' );

# Get customer and transaction information
my %updateInformation = (
   'customerID' => '0000',
   'securityKey' => 'SomeSecurityKey',
   'primaryTrace' => 'SomeTransactionID',
   'newStatus' => 'VOID'
);

print $soap->call( 'updateStatus',
   SOAP::Data->name('eCheckUpdateData' => \%updateInformation)
)->result;
#!/usr/bin/ruby

require 'savon' # version 2.0

begin
   # create a client for the service
   client = Savon.client(wsdl: 'https://achlegacydemo.pdc4u.com/ECheckServices/ECheckStatusUpdate?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 and transaction information
   updateInformation = {
      'customerID' => '0000',
      'securityKey' => 'SomeSecurityKey',
      'primaryTrace' => 'SomeTransactionID',
      'newStatus' => 'VOID'
   }

   # Build the parameters
   params = {
      'eCheckUpdateData' => updateInformation
   }

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

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

Change the status of a previously submitted transaction. In particular, VOID the transaction.

The URL to update a transaction is:
test wsdl:
https://achlegacydemo.pdc4u.com/ECheckServices/ECheckStatusUpdate?wsdl
live wsdl:
https://achlegacy.pdc4u.com/ECheckServices/ECheckStatusUpdate?wsdl

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

The method to use is:
updateStatus

GW Authentication API

The GWAuthenticationService is used for tasks related to authentication. This includes creating JWT’s for integration with specific webservices and creating API Keys for use with the TokenizationService. Authentication for the GWAuthenticationService will be done with BASIC HTTP Authorization. This includes passing a valid username and password in the header. In general, fields will only be returned if their value is not empty or null.

All requests that fail validation will return an HTTP response code 403 - Bad Request and a RequestErrorList containing details pertaining to the error(s).

Request Error List

Request Error List Object:

{
  "requestErrorList": [
    {
      "code": "ANF",
      "description": "API Key not found"
    }
  ]
}
Attribute Description
requestErrorList
ListN/A
A list of RequestError objects containing validation errors.
Details
 
code
Alpha3
The code for the validation error.
description
Alphanumeric255
The description of the validation error.

JWT

GET to retrieve list of schedule settings.

JWT Object

Full JWT Object

JWT Object:

{
  "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0IiwiZXhwIjoxMDUwNTkxNjgyLCJqdGkiOiIzZGZjMzE5Ny01NjY3LTMzNDItYTZiNy01ZjVlMDQ4MjEyNWYiLCJpYXQiOjE1OTEzOTE2ODIsInNlcnZpY2VzIjpbeyJzZXJ2aWNlQWxsb3dTdGF0dXMiOiJBQ1RJVkUiLCJzZXJ2aWNlTmFtZSI6IkNBUkQifSx7InNlcnZpY2VBbGxvd1N0YXR1cyI6IkFDVElWRSIsInNlcnZpY2VOYW1lIjoiQ0hFQ0sifV0sImNvbXBhbnlBY3RpdmF0aW9uIjoiSU5BQ1RJVkUiLCAiTWVzc2FnZSI6IlRoYW5rcyBmb3IgZGVjb2RpbmcgYW5kIGNoZWNraW5nIG91dCB0aGlzIEpXVC4gSG9wZSB5b3UgbGlrZSBpdC4gVGhpcyBtZXNzYWdlIHdpbGwgbm90IGJlIGluIGEgUkVBTCBKV1QuIn0=.KRCSY7zHE5IeCnyGwrWooDgnxJjqJmQAH7uhq2hn8eU="
}
Attribute Description
accessToken
AlphaNumericN/A
The JWT that you will use to authenticate to PDCFlow Services.

–JWT Retrieval

GET :
test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/jwts

Use a username and password to obtain a JWT for use as authentication with other PDCFlow services. This API requires a Base64 encoded username:password, passed in through the BASIC Http Authorization Header. Other than the authorization header, there are no required attributes. An example is provided below.

Sample Response:

{
  "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0IiwiZXhwIjoxMDUwNTkxNjgyLCJqdGkiOiIzZGZjMzE5Ny01NjY3LTMzNDItYTZiNy01ZjVlMDQ4MjEyNWYiLCJpYXQiOjE1OTEzOTE2ODIsInNlcnZpY2VzIjpbeyJzZXJ2aWNlQWxsb3dTdGF0dXMiOiJBQ1RJVkUiLCJzZXJ2aWNlTmFtZSI6IkNBUkQifSx7InNlcnZpY2VBbGxvd1N0YXR1cyI6IkFDVElWRSIsInNlcnZpY2VOYW1lIjoiQ0hFQ0sifV0sImNvbXBhbnlBY3RpdmF0aW9uIjoiSU5BQ1RJVkUiLCAiTWVzc2FnZSI6IlRoYW5rcyBmb3IgZGVjb2RpbmcgYW5kIGNoZWNraW5nIG91dCB0aGlzIEpXVC4gSG9wZSB5b3UgbGlrZSBpdC4gVGhpcyBtZXNzYWdlIHdpbGwgbm90IGJlIGluIGEgUkVBTCBKV1QuIn0=.KRCSY7zHE5IeCnyGwrWooDgnxJjqJmQAH7uhq2hn8eU="
}

Deprecated endpoint details

{
  "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0IiwiZXhwIjoxMDUwNTkxNjgyLCJqdGkiOiIzZGZjMzE5Ny01NjY3LTMzNDItYTZiNy01ZjVlMDQ4MjEyNWYiLCJpYXQiOjE1OTEzOTE2ODIsInNlcnZpY2VzIjpbeyJzZXJ2aWNlQWxsb3dTdGF0dXMiOiJBQ1RJVkUiLCJzZXJ2aWNlTmFtZSI6IkNBUkQifSx7InNlcnZpY2VBbGxvd1N0YXR1cyI6IkFDVElWRSIsInNlcnZpY2VOYW1lIjoiQ0hFQ0sifV0sImNvbXBhbnlBY3RpdmF0aW9uIjoiSU5BQ1RJVkUiLCAiTWVzc2FnZSI6IlRoYW5rcyBmb3IgZGVjb2RpbmcgYW5kIGNoZWNraW5nIG91dCB0aGlzIEpXVC4gSG9wZSB5b3UgbGlrZSBpdC4gVGhpcyBtZXNzYWdlIHdpbGwgbm90IGJlIGluIGEgUkVBTCBKV1QuIn0=.KRCSY7zHE5IeCnyGwrWooDgnxJjqJmQAH7uhq2hn8eU=",
  "refreshToken": "deprecatedTokenWithNoUse"
}

test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/authentication
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/authentication

The Deprecated endpoint returns the accessToken as documented below, and also returns a refreshToken that is no longer used in any capacity.

API Key

POST to create new api key.
PUT to deactivate an existing api key by id.
GET to retrieve list of api keys.

Use a username and password to manage API keys. These keys will be used to authenticate use of the TokenizationService. You can retrieve a list of existing keys, create a new key, or revoke an existing key.

ApiKey Object

Full ApiKey Object

JWT Object:

{
    "companyCredentialApiKeyId": "1",
    "companyId": "1234",
    "createDateTime": "2019-01-01 05:12:12",
    "revokeDateTime": "",
    "lastUsedDateTime": "2020-01-01 12:09:14",
    "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c"
}
Attribute Description
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

–Api key list retrieval

GET : test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys


Sample Response:

{
  "apiKeyList": [
    {
        "companyCredentialApiKeyId": "1",
        "companyId": "1234",
        "createDateTime": "2019-01-01 05:12:12",
        "revokeDateTime": "",
        "lastUsedDateTime": "2020-01-01 12:09:14",
        "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c"
    },
    {
        "companyCredentialApiKeyId": "2",
        "companyId": "1234",
        "createDateTime": "2019-01-01 09:12:12",
        "revokeDateTime": "2020-01-01 12:09:14",
        "lastUsedDateTime": "2020-01-01 04:09:14",
        "apiKey": "c5f81234-5e11-1234-3a66-ae0d2435673c"
    }
  ]
}

GET to retrieve a full list of all active and revoked API keys. There are no required parameters. View example request.

API Response

Attribute Description
apiKeyList
ListN/A
A list of apiKeyList objects containing details about each key.
Api Key Object
 
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

–Create new key

POST to have a new key created. There are no required parameters. View example request.

POST : test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys

Sample Response:

{
    "companyCredentialApiKeyId": "3",
    "companyId": "1234",
    "createDateTime": "2020-06-01 05:12:12",
    "revokeDateTime": "",
    "lastUsedDateTime": "2020-01-01 12:09:14",
    "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c"
}
Attribute Description
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

–Revoke existing key

PUT test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys/{id}
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys/{id}

PUT to revoke an existing key. The key revoked will no longer be able to be used, effective immediately.
The companyCredentialApiKeyId should be used as the numeric id submitted to revoke an apiKey. If the key to specified to be revoked is the last active key, it will not be revoked. Instead, an Http Response Code 409 will be returned. View example request.

Sample Response:

{
    "companyCredentialApiKeyId": "2",
    "companyId": "1234",
    "createDateTime": "2019-01-01 05:12:12",
    "revokeDateTime": "",
    "lastUsedDateTime": "2020-01-01 12:09:14",
    "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c"
}

Click to view object definition
Attribute Description
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

Sample Code

This section offers some client implementation examples in different programming languages. Keep in mind, these are only minimalistic examples used to demonstrate the GWAuthentication 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 '404':
Description = 'The requested signature/document/image was not found.'

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

Status '409':
Description = 'Conflict. The resource could not be modified.'

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

Sample Retrieve new JWT

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;

namespace RestClient {

    public class Jwt {
        public string accessToken { get; set; }
    }

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

        private static void Main(string[] args) {
            string url = "https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts";
            GETData(url);

            //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();
        }


        private Jwt 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));

            Jwt jwt = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            if (response.IsSuccessStatusCode) {
                jwt = await response.Content.ReadAsAsync<jwt>();
            }

            /*
             * 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 jwt;
        }
    }

}
<?php
$url = 'https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts';

$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(