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:
{
"billToCompany": {
"companyId": "2222",
"companyName": "I Will Pick Up the Tab"
},
"billing": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"autoBilling": true,
"billingCard": {
"cardToken": "thisIsAToken1234",
"expirationMonth": 12,
"expirationYear": 24
},
"billingCheck": {
"bankAccountNumber": "123456789",
"bankRoutingNumber": "987654321"
},
"invoiceBreakdownLevel": "LOCATION",
"paymentMethod": "CARD",
"username": "user@test.com"
},
"billingEmails": {
"primaryList": [
"test@test.com",
"test3@test.com"
],
"secondaryList": [
"anotherTest@test.com"
]
},
"companyId": 1234,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
companyId
Numeric
|
The id of the Company .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
billing
Object
|
The Billing data for this Company .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
|
The Settings for this Company .
NOTE: The following fields cannot be modified and are ignored if passed in: name, cardAccountDirectiveList,
achAccountDirectiveList.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 .
|
–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:
{
"billToCompany": {
"companyId": "2222",
"companyName": "I Will Pick Up the Tab"
},
"billing": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"autoBilling": true,
"billingCard": {
"cardToken": "thisIsAToken1234",
"expirationMonth": 12,
"expirationYear": 24
},
"billingCheck": {
"bankAccountNumber": "123456789",
"bankRoutingNumber": "987654321"
},
"invoiceBreakdownLevel": "LOCATION",
"paymentMethod": "CARD",
"username": "user@test.com"
},
"billingEmails": {
"primaryList": [
"test@test.com",
"test3@test.com"
],
"secondaryList": [
"anotherTest@test.com"
]
},
"companyId": 1234,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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:
{
"billing": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"autoBilling": true,
"billingCard": {
"cardToken": "thisIsAToken1234",
"expirationMonth": 12,
"expirationYear": 24
},
"billingCheck": {
"bankAccountNumber": "123456789",
"bankRoutingNumber": "987654321"
},
"invoiceBreakdownLevel": "LOCATION",
"paymentMethod": "CARD",
"username": "user@test.com"
},
"billingEmails": {
"primaryList": [
"test@test.com",
"test3@test.com"
],
"secondaryList": [
"anotherTest@test.com"
]
},
"companyId": 1234,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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
|
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 . |
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
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
|
||||||||||||||||||||||
cashAccountDirectiveList
ListN/A
|
List of Cash 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 .
|
||||||||||||||||||||||
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. |
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
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.
|
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:
{
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"locations": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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 .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locations
ListN/A
|
List of associated Locations
See the Location Object definition.
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:
{
"customId": "NewGroupCustom12345",
"groupId": 1111,
"locationIds": [
15,
3
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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 .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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:
{
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationIds": [
15,
3
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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
A custom, editable id for the group.
List of
ids
for associated Locations
in the Group
.
The
Settings
for this Group
.
Attribute
Description
The name of the group or location for which these settings apply.
Required for Group
and Location
.
A description of the company, group or location for which these settings apply.
Address
for this location/group/company
Attribute
Description
Street Address One.
Required for Company
.
Street Address Two.
City.
Required for Company
.
State.
Required for Company
.
Zip Code.
Required for Company
.
Four digit Zip Code extension.
Country.
Required for Company
.
Text that will show on a receipt for transactions processed by this location/group/company.
Text that will show on a schedule for this location/group/company.
Fee for a card transaction processed by this location/group/company.
Fee for an ach transaction processed by this location/group/company.
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
.
List of Card
AccountDirective
Attribute
Description
The Account Directive.
The name of the Account Directive.
Only editable on company accountDirective endpoint
Whether the account directive is active. Only active account directives can be used for processing.
ONLY ON Check Account Directives
Only editable on company accountDirective endpoint. Cannot be set to null or empty.
The entry code for the ach transaction to be processed with.
Valid Values: TEL
, WEB
, PPD
, CCD
, ARC
, RCK
.
ONLY ON Card Account Directives.
Cannot be set to an empty list.
A list of card types that are allowed to be processed with this account directive and its associated merchant account.
Valid Values: MASTERCARD
, VISA
, DISCOVER
, AMERICAN_EXPRESS
.
Only editable on company accountDirective endpoint
The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%).
Format: #.####
An account directive to change pending payments to. When setting an
accountDirective
to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.
Not returned in response.
List of ACH
AccountDirective
Attribute
Description
The Account Directive.
The name of the Account Directive.
Only editable on company accountDirective endpoint
Whether the account directive is active. Only active account directives can be used for processing.
ONLY ON Check Account Directives
Only editable on company accountDirective endpoint. Cannot be set to null or empty.
The entry code for the ach transaction to be processed with.
Valid Values: TEL
, WEB
, PPD
, CCD
, ARC
, RCK
.
ONLY ON Card Account Directives.
Cannot be set to an empty list.
A list of card types that are allowed to be processed with this account directive and its associated merchant account.
Valid Values: MASTERCARD
, VISA
, DISCOVER
, AMERICAN_EXPRESS
.
Only editable on company accountDirective endpoint
The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%).
Format: #.####
An account directive to change pending payments to. When setting an
accountDirective
to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.
Not returned in response.
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": [
{
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"customId": "2233",
"groupId": 2323,
"locationCount": 1,
"locationIds": [
3333
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "1234-10",
"name": "PPD"
},
{
"accountDirective": "1234-11",
"name": "WEB"
},
{
"accountDirective": "1234-12",
"name": "TEL"
},
{
"accountDirective": "1234-5",
"name": "CCD"
}
],
"address": {
"city": "Here",
"country": "US",
"state": "UT",
"streetAddressOne": "1",
"zip": "88444"
},
"cardAccountDirectiveList": [
{
"accountDirective": "7777-3",
"allowedCardTypeList": [
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD",
"VISA"
],
"name": "Card present"
}
],
"dateCreated": "2020-10-15 19:53:11",
"dateModified": "2020-10-15 19:53:11",
"name": "Another Group Online"
}
}
]
}
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:
{
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"locations": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Retrieve an individual group by groupId
.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/1111
–Group Retrieval Search
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": [
{
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"customId": "2233",
"groupId": 2323,
"locationCount": 1,
"locationIds": [
3333
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "1234-10",
"name": "PPD"
},
{
"accountDirective": "1234-11",
"name": "WEB"
},
{
"accountDirective": "1234-12",
"name": "TEL"
},
{
"accountDirective": "1234-5",
"name": "CCD"
}
],
"address": {
"city": "Here",
"country": "US",
"state": "UT",
"streetAddressOne": "1",
"zip": "88444"
},
"cardAccountDirectiveList": [
{
"accountDirective": "7777-3",
"allowedCardTypeList": [
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD",
"VISA"
],
"name": "Card present"
}
],
"dateCreated": "2020-10-15 19:53:11",
"dateModified": "2020-10-15 19:53:11",
"name": "Another Group Online"
}
}
]
}
Attribute | Description |
groupName
Alphanumeric
|
Find Groups by their Name. This will search for any name that contains the search parameter.
|
groupNameOrCustomId
Alphanumeric
|
Find Groups by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
|
groupIdList
NumericListN/A
|
Retrieve all Groups with a groupId in this list.
|
customIdList
AlphaNumericListN/A
|
Retrieve all Groups with a customId in this list.
|
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:
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
|
The Settings for this Location .
|
–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:
{
"activation": true,
"customId": "123456",
"groupId": 1111,
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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 .
|
–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:
{
"activation": true,
"customId": "123456",
"groupId": 1111,
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
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
A custom unique identifier for referencing this
location
.
Boolean stating if this
Location
is Active or Deactivated.
The ID of the
Group
this location
is a part of.
The
Settings
for this Location
.
Attribute
Description
The name of the group or location for which these settings apply.
Required for Group
and Location
.
A description of the company, group or location for which these settings apply.
Address
for this location/group/company
Attribute
Description
Street Address One.
Required for Company
.
Street Address Two.
City.
Required for Company
.
State.
Required for Company
.
Zip Code.
Required for Company
.
Four digit Zip Code extension.
Country.
Required for Company
.
Text that will show on a receipt for transactions processed by this location/group/company.
Text that will show on a schedule for this location/group/company.
Fee for a card transaction processed by this location/group/company.
Fee for an ach transaction processed by this location/group/company.
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
.
List of Card
AccountDirective
Attribute
Description
The Account Directive.
The name of the Account Directive.
Only editable on company accountDirective endpoint
Whether the account directive is active. Only active account directives can be used for processing.
ONLY ON Check Account Directives
Only editable on company accountDirective endpoint. Cannot be set to null or empty.
The entry code for the ach transaction to be processed with.
Valid Values: TEL
, WEB
, PPD
, CCD
, ARC
, RCK
.
ONLY ON Card Account Directives.
Cannot be set to an empty list.
A list of card types that are allowed to be processed with this account directive and its associated merchant account.
Valid Values: MASTERCARD
, VISA
, DISCOVER
, AMERICAN_EXPRESS
.
Only editable on company accountDirective endpoint
The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%).
Format: #.####
An account directive to change pending payments to. When setting an
accountDirective
to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.
Not returned in response.
List of ACH
AccountDirective
Attribute
Description
The Account Directive.
The name of the Account Directive.
Only editable on company accountDirective endpoint
Whether the account directive is active. Only active account directives can be used for processing.
ONLY ON Check Account Directives
Only editable on company accountDirective endpoint. Cannot be set to null or empty.
The entry code for the ach transaction to be processed with.
Valid Values: TEL
, WEB
, PPD
, CCD
, ARC
, RCK
.
ONLY ON Card Account Directives.
Cannot be set to an empty list.
A list of card types that are allowed to be processed with this account directive and its associated merchant account.
Valid Values: MASTERCARD
, VISA
, DISCOVER
, AMERICAN_EXPRESS
.
Only editable on company accountDirective endpoint
The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%).
Format: #.####
An account directive to change pending payments to. When setting an
accountDirective
to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.
Not returned in response.
–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": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "1568834598",
"locationId": 16,
"settings": {
"address": {
"city": "Sweet",
"country": "US",
"state": "IN",
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "1568834598",
"zip": "11225",
"zipPlusFour": "1234"
},
"dateCreated": "2019-08-29 07:19:10",
"dateModified": "2020-06-23 04:49:57",
"description": "the #1",
"name": "Second location",
"receiptText": "Receipt Text 1568834598",
"scheduleText": "Schedule Text 1568834598"
}
},
{
"activation": true,
"customId": "898465",
"locationId": 33,
"settings": {
"dateCreated": "2019-09-10 11:53:09",
"dateModified": "2020-04-15 09:29:32",
"name": "This location name"
}
}
]
}
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:
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Retrieve an individual location by locationId
.
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/12
–Location Retrieval Search
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": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "1568834598",
"locationId": 16,
"settings": {
"address": {
"city": "Sweet",
"country": "US",
"state": "IN",
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "1568834598",
"zip": "11225",
"zipPlusFour": "1234"
},
"dateCreated": "2019-08-29 07:19:10",
"dateModified": "2020-06-23 04:49:57",
"description": "the #1",
"name": "Second location",
"receiptText": "Receipt Text 1568834598",
"scheduleText": "Schedule Text 1568834598"
}
},
{
"activation": true,
"customId": "898465",
"locationId": 33,
"settings": {
"dateCreated": "2019-09-10 11:53:09",
"dateModified": "2020-04-15 09:29:32",
"name": "This location name"
}
}
]
}
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.
–Group Effective Settings List Search
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": [
{
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"customId": "2233",
"groupId": 2323,
"locationCount": 1,
"locationIds": [
3333
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "1234-10",
"name": "PPD"
},
{
"accountDirective": "1234-11",
"name": "WEB"
},
{
"accountDirective": "1234-12",
"name": "TEL"
},
{
"accountDirective": "1234-5",
"name": "CCD"
}
],
"address": {
"city": "Here",
"country": "US",
"state": "UT",
"streetAddressOne": "1",
"zip": "88444"
},
"cardAccountDirectiveList": [
{
"accountDirective": "7777-3",
"allowedCardTypeList": [
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD",
"VISA"
],
"name": "Card present"
}
],
"dateCreated": "2020-10-15 19:53:11",
"dateModified": "2020-10-15 19:53:11",
"name": "Another Group Online"
}
}
]
}
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.
|
groupNameOrCustomId
Alphanumeric
|
Find Groups by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
|
groupIdList
NumericListN/A
|
Retrieve all Groups with a groupId in this list.
|
customIdList
AlphaNumericListN/A
|
Retrieve all Groups with a customId in this list.
|
–Location Effective Settings List Search
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": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "1568834598",
"locationId": 16,
"settings": {
"address": {
"city": "Sweet",
"country": "US",
"state": "IN",
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "1568834598",
"zip": "11225",
"zipPlusFour": "1234"
},
"dateCreated": "2019-08-29 07:19:10",
"dateModified": "2020-06-23 04:49:57",
"description": "the #1",
"name": "Second location",
"receiptText": "Receipt Text 1568834598",
"scheduleText": "Schedule Text 1568834598"
}
},
{
"activation": true,
"customId": "898465",
"locationId": 33,
"settings": {
"dateCreated": "2019-09-10 11:53:09",
"dateModified": "2020-04-15 09:29:32",
"name": "This location name"
}
}
]
}
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 (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.
|
–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 access 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:
{
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
],
"locationIdList": [
43,
45,
11297,
11298,
11299
]
}
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 (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.
|
Account Directives
–Search Account Directives
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Sample Response:
{
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209"
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments"
}
],
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"zeroCostFeePercent": "0.35"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash"
}
]
}
POST
an AccountDirectiveSearchParameters
object to retrieve a list of account directives that match the search parameters. Providing no search parameters will return a list of ALL accountDirectives
for the company.
Attribute | Description |
accountDirectiveList
ListN/A
|
Find all account directives with the account directive in the list. |
serviceNameList
ListN/A
|
Find account directives that belong to services in the list. Valid values: CARD , CHECK , CASH
|
nameList
ListN/A
|
Find account directives that have a name that matches a value in the list. |
nameWildcard
Alphanumeric20
|
Find all account directives with names that contain the nameWildcard .
|
activation
Boolean5
|
Only return ACTIVE or INACTIVE account directives. Leave null to return all account directives. |
–Edit Account Directive
PATCH :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
PATCH
an AccountDirective
object to modify an existing account directive. The account directive being modified must be in the request body. With a PATCH request, only passed in fields will be updated. Fields set to empty strings
in the request will be set empty on the object.
Attribute | Description |
accountDirective
Alphanumeric10
Readonly
|
The Account Directive. |
name
Alphanumeric20
Readonly
|
The name of the Account Directive. |
isActive
Boolean5
|
Only editable on company accountDirective endpoint Whether the account directive is active. Only active account directives can be used for processing. |
entryCode
Alpha3
Conditional
|
ONLY ON Check Account Directives Only editable on company accountDirective endpoint. Cannot be set to null or empty. The entry code for the ach transaction to be processed with. Valid Values: TEL , WEB , PPD , CCD , ARC , RCK . |
allowedCardTypeList
List4
Conditional
|
ONLY ON Card Account Directives. Cannot be set to an empty list. A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD , VISA , DISCOVER , AMERICAN_EXPRESS . |
zeroCostFeePercent
Numeric6
|
Only editable on company accountDirective endpoint The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%). Format: #.#### |
replacingAccountDirective
Alphanumeric10
|
An account directive to change pending payments to. When setting an accountDirective to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.Not returned in response. |
PUT :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
PUT
an AccountDirective
object to modify an existing account directive. The account directive being modified must be in the request body. With a PUT request, the entire object will be overridden.
As such, all required fields must be passed in the request.
Attribute | Description |
accountDirective
Alphanumeric10
Readonly
|
The Account Directive. |
name
Alphanumeric20
Readonly
|
The name of the Account Directive. |
isActive
Boolean5
|
Only editable on company accountDirective endpoint Whether the account directive is active. Only active account directives can be used for processing. |
entryCode
Alpha3
Conditional
|
ONLY ON Check Account Directives Only editable on company accountDirective endpoint. Cannot be set to null or empty. The entry code for the ach transaction to be processed with. Valid Values: TEL , WEB , PPD , CCD , ARC , RCK . |
allowedCardTypeList
List4
Conditional
|
ONLY ON Card Account Directives. Cannot be set to an empty list. A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD , VISA , DISCOVER , AMERICAN_EXPRESS . |
zeroCostFeePercent
Numeric6
|
Only editable on company accountDirective endpoint The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%). Format: #.#### |
replacingAccountDirective
Alphanumeric10
|
An account directive to change pending payments to. When setting an accountDirective to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.Not returned in response. |
–GET Company Account Directive
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/effectivesettings/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/effectivesettings/accountdirectives/{accountDirective}
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
GET
the details of an AccountDirective
. The serviceName
parameter is optional, but providing it in the URL will retrieve an account directive only if it exists for that service. This is useful for validating an account directive.
–GET Group Account Directive
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
GET
the details of an AccountDirective
. The serviceName
parameter in the URL is required and will retrieve an account directive only if it exists for that service. Valid values are CARD
, CHECK
, or CASH
.
This will get the account directive if it is explicitly set on the group, or if there are no directives set on the group and this account directive is inherited from the company.
–GET Location Account Directive
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{locationId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/{locationId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"zeroCostFeePercent": "0.025"
}
GET
the details of an AccountDirective
. The serviceName
parameter in the URL is required and will retrieve an account directive only if it exists for that service. Valid values are CARD
, CHECK
, or CASH
.
This will get the account directive if it is explicitly set on the location, or if there are no directives set on the location and this account directive is inherited from the group or company.
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
|
||||||||||||||||||||||
cashAccountDirectiveList
ListN/A
|
List of Cash 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 .
|
||||||||||||||||||||||
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.
|
groupNameOrCustomId
Alphanumeric
|
Find Groups by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
|
groupIdList
NumericListN/A
|
Retrieve all Groups with a groupId in this list.
|
customIdList
AlphaNumericListN/A
|
Retrieve all Groups with a customId 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 (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.
|
–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
|
||||||||||||||||
cashAccountDirectiveList
ListN/A
|
List of Cash AccountDirective
|
–Account Directive
Attribute | Description |
accountDirective
Alphanumeric10
Readonly
|
The Account Directive. |
name
Alphanumeric20
Readonly
|
The name of the Account Directive. |
isActive
Boolean5
|
Only editable on company accountDirective endpoint Whether the account directive is active. Only active account directives can be used for processing. |
entryCode
Alpha3
Conditional
|
ONLY ON Check Account Directives Only editable on company accountDirective endpoint. Cannot be set to null or empty. The entry code for the ach transaction to be processed with. Valid Values: TEL , WEB , PPD , CCD , ARC , RCK . |
allowedCardTypeList
List4
Conditional
|
ONLY ON Card Account Directives. Cannot be set to an empty list. A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD , VISA , DISCOVER , AMERICAN_EXPRESS . |
zeroCostFeePercent
Numeric6
|
Only editable on company accountDirective endpoint The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%). Format: #.#### |
replacingAccountDirective
Alphanumeric10
|
An account directive to change pending payments to. When setting an accountDirective to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.Not returned in response. |
–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.
|
Sample Code
This section offers some client implementation examples. Keep in mind, these are only minimalistic examples used to demonstrate the Service REST API and are not meant for production use.
– Result Status Codes
Expected Http Status codes
Status '200':
Description = 'Success.'
Status: '400':
Description = 'Malformed request. The request is either incorrectly formatted, or there are validation errors.'
Status '401':
Description = 'Invalid credentials.'
Status '403':
Description = 'Service not activated.'
Status '404':
Description = 'The requested resource was not found.'
Status '405':
Description = 'POST, GET, PUT request not supported for resource.'
Status '500':
Description = 'An internal error has occurred.'
All requests will return a status code. For example, in the case of status code 400
, check for a requestErrorList
in the response, containing information on validation failure. See RequestErrorList Object definition
–Sample Company requests
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Sample PUT
Company
request
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';
$company = [
'billing' => [
'autoBilling' => true,
'paymentMethod' => 'CARD',
'billingCard' => [
'cardToken' => 'ThisIsAToken2224',
'expirationMonth' => 12,
'expirationYear' => 25
]
],
'settings' => [
'description' => 'Updated Company Description',
'receiptText' => 'Updated Receipt Text',
'scheduleText' => 'Updated Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'username' => 'Someone',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'country' => 'US'
]
],
'billingEmails' => [
'primaryList' => ['test@test.com', 'primary@primary.com'],
'secondaryList' => ['test2@test.com', 'secondary@secondary.com']
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($company, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class Settings {
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public string username { get; set; }
public Address address { get; set; }
}
public class BillingCard {
public string cardToken { get; set; }
public int expirationMonth { get; set; }
public int expirationYear { get; set; }
}
public class Billing {
public bool autoBilling { get; set; }
public string paymentMethod { get; set; }
public string username { get; set; }
public BillingCard billingCard { get; set; }
public Address address { get; set; }
}
public class BillingEmails {
public List<string> primaryEmails { get; set; } = new List<string>();
public List<string> secondaryEmails { get; set; } = new List<string>();
}
public class Company {
public Billing billing { get; set; } = new Billing();
public Settings settings { get; set; } = new Settings();
public BillingEmails billingEmails { get; set; } = new BillingEmails();
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
Console.WriteLine("Starting");
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies";
Company company = new Company();
Billing billing = new Billing();
billing.autoBilling = true;
billing.paymentMethod = "CARD";
billing.username = "testUser@test.com";
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address.country = "US";
billing.address = address;
BillingCard billingCard = new BillingCard();
billingCard.cardToken = "thisIsAToken1234";
billingCard.expirationMonth = 12;
billingCard.expirationYear = 2025;
billing.billingCard = billingCard;
company.billing = billing;
Settings settings = new Settings();
settings.description = "Here I describe this company";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
settings.address = address;
company.settings = settings;
BillingEmails billingEmails = new BillingEmails();
billingEmails.primaryEmails.Add("test@test.com");
billingEmails.primaryEmails.Add("test2@test.com");
billingEmails.secondaryEmails.Add("testSecondary@test.com");
company.billingEmails = billingEmails;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(company, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(Company company, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(company), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
@primaryEmails = ("test@test.com", "primary@primary.com");
@secondaryEmails = ("test2@test.com", "secondary@secondary.com");
my $data = {
"billing" => {
"autoBilling" => true,
"paymentMethod" => "CARD",
"billingCard" => {
"cardToken" => "ThisIsAToken2224",
"expirationMonth" => "12",
"expirationYear" => "25"
}
},
"settings" => {
"description" => "Updated Company Description",
"receiptText" => "Updated Receipt Text",
"scheduleText" => "Updated Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"username" => "Someone",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"country" => "US"
}
},
"billingEmails" => {
"primaryList" => $primaryList,
"secondaryList" => $secondaryList
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';
my $req = HTTP::Request->new( 'PUT', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"billing": {
"autoBilling": true,
"paymentMethod": "CARD",
"billingCard": {
"cardToken": "ThisIsAToken2224",
"expirationMonth": "12",
"expirationYear": "25"
}
},
"settings": {
"description": "Updated Company Description",
"receiptText": "Updated Receipt Text",
"scheduleText": "Updated Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"username": "Someone",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"country": "US"
}
},
"billingEmails": {
"primaryList":["test@test.com", "primary@primary.com"],
"secondaryList":["test2@test.com", "secondary@secondary.com"]
}
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_put(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
PUT
to modify the existing Company
for the Authenticated User
Response
Updated Company
object
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Sample GET
Company
request
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { 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 List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string dateCreated { get; set; }
public string dateModified { get; set; }
public string hierarchyDisplaySetting { get; set; }
public HierarchyDisplay hierarchyDisplay { get; set; }
}
public class BillingCard {
public string cardToken { get; set; }
public int expirationMonth { get; set; }
public int expirationYear { get; set; }
}
public class Billing {
public bool autoBilling { get; set; }
public string paymentMethod { get; set; }
public string username { get; set; }
public BillingCard billingCard { get; set; }
public Address address { get; set; }
}
public class BillingEmails {
public List<string> primaryEmails { get; set; } = new List<string>();
public List<string> secondaryEmails { get; set; } = new List<string>();
}
public class Company {
public Billing billing { get; set; } = new Billing();
public Settings settings { get; set; } = new Settings();
public BillingEmails billingEmails { get; set; } = new BillingEmails();
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<Company> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<Company> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
Company company = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
company = JsonConvert.DeserializeObject<Company>(responseBody);
// Do something with it
Console.WriteLine("CompanyName: " + company.settings.name);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return company;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
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
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
GET
a single Company
for the Authenticated User
Response
Company
object
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies
Sample PATCH
Company
request
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';
$company = [
'billing' => [
'autoBilling' => true,
'paymentMethod' => 'CARD',
'billingCard' => [
'cardToken' => 'ThisIsAToken2224',
'expirationMonth' => 12,
'expirationYear' => 25
]
],
'settings' => [
'description' => 'Updated Company Description',
'receiptText' => 'Updated Receipt Text',
'scheduleText' => 'Updated Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1
],
'billingEmails' => [
'primaryList' => [], //This will remove all current emails in primaryList
'secondaryList' => ['another@test.com']
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($company, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
}
public class BillingCard {
public string cardToken { get; set; }
public int expirationMonth { get; set; }
public int expirationYear { get; set; }
}
public class Billing {
public bool autoBilling { get; set; }
public string paymentMethod { get; set; }
public string username { get; set; }
public BillingCard billingCard { get; set; }
public Address address { get; set; }
}
public class BillingEmails {
public List<string> primaryEmails { get; set; } = new List<string>();
public List<string> secondaryEmails { get; set; } = new List<string>();
}
public class Company {
public Billing billing { get; set; }
public Settings settings { get; set; }
public BillingEmails billingEmails { get; set; }
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies";
Company company = new Company();
Settings settings = new Settings();
settings.description = "Here I describe this company";
settings.receiptText = "Thank you for paying";
settings.cardFeeAmount = 2.25;
settings.username = "testUser@test.com";
Address address = new Address();
address.streetAddressOne = "First street";
address.country = "US";
settings.address = address;
company.settings = settings;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PATCHData(company, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PATCHData(Company company, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded companyUsername:companyPassword)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(company), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PatchAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
company = JsonConvert.DeserializeObject<Company>(responseBody);
// Do something with it
Console.WriteLine("CompanyName: " + company.settings.description);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
@primaryEmails = ();
@secondaryEmails = ("another@test.com");
my $data = {
"billing" => {
"autoBilling" => true,
"paymentMethod" => "CARD",
"billingCard" => {
"cardToken" => "ThisIsAToken2224",
"expirationMonth" => "12",
"expirationYear" => "25"
}
},
"settings" => {
"description" => "Updated Company Description",
"receiptText" => "Updated Receipt Text",
"scheduleText" => "Updated Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1
},
"billingEmails" => {
"primaryList" => $primaryList,
"secondaryList" => $secondaryList
}
};
$data = JSON::XS->new->utf8->encode($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies';
my $req = HTTP::Request->new('PATCH', $url);
$req->authorization_basic('SomeSecretUsername', 'SomeSecretPassword');
$req->content_type('application/json');
$req->content_length(length($data));
$req->content($data);
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request($req);
if ($response->is_success) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ($@) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"billing": {
"autoBilling": true,
"paymentMethod": "CARD",
"billingCard": {
"cardToken": "ThisIsAToken2224",
"expirationMonth": "12",
"expirationYear": "25"
}
},
"settings": {
"description": "Updated Company Description",
"receiptText": "Updated Receipt Text",
"scheduleText": "Updated Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1
},
"billingEmails": {
"primaryList":[],
"secondaryList":["another@test.com"]
}
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_patch(payload)
puts JSON.parse c.body_str
if c.response_code == 200
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
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/{accountDirective}
Sample PUT
AccountDirective
request
<?php
$accountDirectiveToUpdate = '123-1';
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
$accountDirective = [
'name' => 'Card not present',
'isActive' => true,
'zeroCostFeePercent' => '0.35',
'allowedCardTypeList' => ['VISA', 'MASTERCARD', 'DISCOVER', 'AMERICAN_EXPRESS'],
'replacingAccountDirective' => '123-2' //When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($accountDirective, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public string replacingAccountDirective { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
Console.WriteLine("Starting");
string accountDirectiveToUpdate = "123-2";
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/" + accountDirectiveToUpdate;
AccountDirective accountDirective = new AccountDirective();
accountDirective.name = "Card not present";
accountDirective.isActive = true;
List<string> allowedCardTypeList = new List<string>();
allowedCardTypeList.Add("VISA");
allowedCardTypeList.Add("MASTERCARD");
allowedCardTypeList.Add("DISCOVER");
allowedCardTypeList.Add("AMERICAN_EXPRESS");
accountDirective.allowedCardTypeList = allowedCardTypeList;
//If setting an account directive to inactive, provide the replacingAccountDirective to update all pending payments to
accountDirective.replacingAccountDirective = "123-1";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(accountDirective, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(AccountDirective accountDirective, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(accountDirective), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $accountDirective = {
'name' => 'Card not present',
'isActive' => false,
'zeroCostFeePercent' => '0.35',
'allowedCardTypeList' => ['VISA', 'MASTERCARD', 'DISCOVER', 'AMERICAN_EXPRESS'],
'replacingAccountDirective' => '123-2' #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
};
$data = JSON::XS->new->utf8->encode ($accountDirective);
my $accountDirectiveToUpdate = '123-1';
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
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 = {
"accountDirective": "123-1",
"name":"Card not present",
"isActive":false,
"zeroCostFeePercent":"0.35",
"replacingAccountDirective": "123-2", #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
"allowedCardTypeList":%w[VISA MASTERCARD AMERICAN_EXPRESS]
}
accountdirectivetoupdate = '123-1'
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/' + accountdirectivetoupdate
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
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
PUT
to modify an existing AccountDirective
. The account directive provided in the url is required and specifies which account directive will be edited.
When deactivating an account directive, provide a replacingAccountDirective
to update all pending payments with the replacing account directive.
Response
Updated AccountDirective
object
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/{accountDirective}
Sample PATCH
AccountDirective
request
<?php
$accountDirectiveToUpdate = '123-1';
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
//Setting the zeroCostFeePercent to empty string in the request will cause the value to be nullified on the object
$accountDirective = [
'name' => 'Card not present',
'isActive' => true,
'zeroCostFeePercent' => '',
'allowedCardTypeList' => ['VISA', 'MASTERCARD', 'DISCOVER', 'AMERICAN_EXPRESS'],
'replacingAccountDirective' => '123-2' //When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($accountDirective, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public string replacingAccountDirective { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
Console.WriteLine("Starting");
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/123-2";
AccountDirective accountDirective = new AccountDirective();
accountDirective.name = "Card not present";
accountDirective.isActive = true;
List<string> allowedCardTypeList = new List<string>();
allowedCardTypeList.Add("VISA");
allowedCardTypeList.Add("MASTERCARD");
accountDirective.allowedCardTypeList = allowedCardTypeList;
//If setting an account directive to inactive, provide the replacingAccountDirective to update all pending payments to
accountDirective.replacingAccountDirective = "123-1";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PATCHData(accountDirective, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PATCHData(AccountDirective accountDirective, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(accountDirective), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PatchAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
#Empty zeroCostFeePercent will set the field to null on the account directive
my $accountDirective = {
'name' => 'Card not present',
'isActive' => true,
'zeroCostFeePercent' => '',
'allowedCardTypeList' => [ 'VISA', 'MASTERCARD' ],
'replacingAccountDirective' => '123-2' #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
};
$data = JSON::XS->new->utf8->encode ($accountDirective);
my $accountDirectiveToUpdate = '123-1';
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
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
#Setting the zeroCostFeePercent to empty string in the request will cause the value to be nullified on the object
data = {
"accountDirective": "123-1",
"name":"Card not present",
"isActive":true,
"zeroCostFeePercent":"",
"replacingAccountDirective": "123-2", #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
"allowedCardTypeList":%w[VISA MASTERCARD AMERICAN_EXPRESS]
}
accountdirectivetoupdate = '123-1'
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/' + accountdirectivetoupdate
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
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
PATCH
to modify an existing AccountDirective
. The account directive provided in the url is required and specifies which account directive will be edited.
When deactivating an account directive, provide a replacingAccountDirective
to update all pending payments with the replacing account directive.
Response
Updated AccountDirective
object
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives
Sample POST
AccountDirectiveSearchParameters
request
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives';
//Search for active CARD account directives
$data = [
"serviceNameList" => [ "CARD" ],
"activation" => true
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirectiveSearchParameters {
public string nameWildcard { get; set; }
public bool activation { get; set; }
public List<string> nameList { get; set; }
public List<string> serviceNameList { get; set; }
public List<string> accountDirectiveList { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
}
public class AccountDirectiveList {
public List<long> locationIdList { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
Console.WriteLine("Starting");
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/accountdirectives";
//Search only for active, Card account directives
AccountDirectiveSearchParameters accountDirectiveSearchParameters = new AccountDirectiveSearchParameters();
accountDirectiveSearchParameters.activation = true;
List<string> serviceNameList = new List<string>();
serviceNameList.Add("CARD");
accountDirectiveSearchParameters.serviceNameList = serviceNameList;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirectiveList> task = POSTData(accountDirectiveSearchParameters, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirectiveList> POSTData(AccountDirectiveSearchParameters accountDirectiveSearchParameters, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
AccountDirectiveList accountDirectiveList = null;
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(accountDirectiveSearchParameters), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirectiveList = JsonConvert.DeserializeObject<AccountDirectiveList>(responseBody);
// Do something with it
Console.WriteLine("Card account directive count: " + accountDirectiveList.cardAccountDirectiveList.Count);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
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 {
#Search for active card account directives
my $data = {
"serviceNameList" => [ "CARD" ],
"activation" => true
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/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
#Search for active card account directives
data = {
"serviceNameList": %w[CARD],
"activation": true
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/lists/companies/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
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
POST
AccountDirectiveSearchParameters
to search for a list of account directives
Response
AccountDirectiveList
object containing account directives that match the search parameters
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/{accountDirective}
Sample GET
AccountDirective
request
<?php
//Get the account directive 123-4 only if it is a CARD account directive
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/123-4?serviceName=CARD';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
//Get the account directive 123-4 only if it is a CARD account directive
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/123-4?serviceName=CARD";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirective> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirective> 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));
AccountDirective accountDirective = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirective = JsonConvert.DeserializeObject<AccountDirective>(responseBody);
// Do something with it
Console.WriteLine("Account Directive name: " + accountDirective.name);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return accountDirective;
}
}
}
#!/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 {
#Get the account directive 123-4 only if it is a CARD account directive
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/123-4?serviceName=CARD';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
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
#Get accountDirective 123-4 only if it is a CARD account directive
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/companies/accountdirectives/123-4?serviceName=CARD'
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
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
GET
to get the details of the specified account directive. Include the serviceName
parameter to limit specifically to one service.
Response
AccountDirective
object
–Sample Group requests
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Sample POST
Group
request
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/';
$group = [
'locationIds' => [1],
'settings' => [
'name' => 'Group Name',
'description' => 'Group Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'receiptText' => 'Receipt Text',
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'cardAccountDirectiveList' => [
0 => [
'accountDirective' => '888-1'
],
1 => [
'accountDirective' => '888-2'
]
],
'achAccountDirectiveList' => [
0 => [
'accountDirective' => '2071-1'
],
],
'cashAccountDirectiveList' => [
0 => [
'accountDirective' => '2222-1'
],
]
],
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($group, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { 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 List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
}
public class Group {
public string customId { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups";
Group group = new Group();
Settings settings = new Settings();
settings.name = "Albuquerque Group";
settings.description = "Our offices in Albuquerque";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address.country = "US";
settings.address = address;
group.settings = settings;
group.customId = "Albuquerque offices";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = POSTData(group, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task POSTData(Group group, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(group), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(json["groupId"]);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"locationIds" => [ 1 ],
"settings" => {
"name" => "Group Name",
"description" => "Group Description",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"zipPlusFour" => "1234",
"country" => "US"
},
"receiptText" => "Receipt Text",
"scheduleText" => "Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"cardAccountDirectiveList" => [
{
"accountDirective" => "888-1"
},
{
"accountDirective" => "888-2"
}
],
"cashAccountDirectiveList" => [
{
"accountDirective" => "2222-1"
}
],
"achAccountDirectiveList" => [
{
"accountDirective" => "2071-1"
}
]
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"locationIds": [1],
"settings": {
"name": "Group Name",
"description": "Group Description",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"zipPlusFour": "1234",
"country": "US"
},
"receiptText": "Receipt Text",
"scheduleText": "Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"cardAccountDirectiveList": [
{
"accountDirective": "888-1"
},
{
"accountDirective": "888-2"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2222-1"
}
],
"achAccountDirectiveList": [
{
"accountDirective": "2071-1"
}
]
}
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
POST
to create a new Group
Response
Group
object
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Sample PUT
Group
request
<?php
$groupIdToUpdate = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $groupIdToUpdate;
$group = [
'locationIds' => [1],
'settings' => [
'name' => 'Updated Group Name',
'description' => 'Group Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'receiptText' => 'Receipt Text',
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'cardAccountDirectiveList' => [
0 => [
'accountDirective' => '888-1'
],
1 => [
'accountDirective' => '888-2'
]
],
'achAccountDirectiveList' => [
0 => [
'accountDirective' => '2071-1'
],
'cashAccountDirectiveList' => [
0 => [
'accountDirective' => '2222-1'
],
]
],
],
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($group, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { 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 List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
}
public class Group {
public string customId { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
int groupId = 1234;
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/"+groupId;
Group group = new Group();
group.customId = "Albuquerque offices";
Settings settings = new Settings();
settings.name = "Albuquerque Group";
settings.description = "Change Our offices in Albuquerque";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
/*
* Not including the address in a PUT will set the group address to null
*/
group.settings = settings;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(group, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(Group group, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var putContent = new StringContent(JsonConvert.SerializeObject(group), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, putContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(json["groupId"]);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"locationIds" => [ 1 ],
"settings" => {
"name" => "Updated Group Name",
"description" => "Group Description",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"zipPlusFour" => "1234",
"country" => "US"
},
"receiptText" => "Receipt Text",
"scheduleText" => "Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"cardAccountDirectiveList" => [
{
"accountDirective" => "888-1"
},
{
"accountDirective" => "888-2"
}
],
"cashAccountDirectiveList" => [
{
"accountDirective" => "2222-1"
}
],
"achAccountDirectiveList" => [
{
"accountDirective" => "2071-1"
}
]
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $groupIdToUpdate = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $groupIdToUpdate;
my $req = HTTP::Request->new( 'PUT', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"locationIds": [1],
"settings": {
"name": "Updated Group Name",
"description": "Group Description",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"zipPlusFour": "1234",
"country": "US"
},
"receiptText": "Receipt Text",
"scheduleText": "Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"cardAccountDirectiveList": [
{
"accountDirective": "888-1"
},
{
"accountDirective": "888-2"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2222-1"
}
],
"achAccountDirectiveList": [
{
"accountDirective": "2071-1"
}
]
}
}
groupidtoupdate = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' + groupidtoupdate
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_put(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
PUT
to modify an existing Group
by its id
Response
Updated Group
object
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups
Request
GET
a list of all Groups
Response
List of Group
objects
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Sample GET
Group
request by id
<?php
$desiredGroupId = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $desiredGroupId;
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { 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 List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string dateCreated { get; set; }
public string dateModified { get; set; }
public string hierarchyDisplaySetting { get; set; }
public HierarchyDisplay hierarchyDisplay { get; set; }
}
public class Location {
public int locationId { get; set; }
public string customId { get; set; }
public Settings settings { get; set; }
}
public class Group {
public int groupId { get; set; }
public string customId { get; set; }
public int locationCount { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
public List<Location> locations { get; set; } = new List<Location>();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
int myGroupId = 12;
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/" + myGroupId;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<Group> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<Group> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
Group group = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
group = JsonConvert.DeserializeObject<Group>(responseBody);
// Do something with it
Console.WriteLine("GroupId: " + group.groupId);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return group;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $desiredGroupId = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' . $desiredGroupId;
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
desiredgroupid = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/' + desiredgroupid
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
GET
a single Group
by its id
Response
Group
object
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search
Sample POST
Group
request with GroupSearchParameters
<?php
$groupSearchParameters = [
'groupNameOrCustomId' => 'customName'
];
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search/';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($groupSearchParameters, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { 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 List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string dateCreated { get; set; }
public string dateModified { get; set; }
public string hierarchyDisplaySetting { get; set; }
public HierarchyDisplay hierarchyDisplay { get; set; }
}
public class Location {
public int locationId { get; set; }
public string customId { get; set; }
public Settings settings { get; set; }
}
public class Group {
public int groupId { get; set; }
public string customId { get; set; }
public int locationCount { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
}
public class GroupList {
public List<Group> groupList { get; set; }
}
public class GroupSearchParameters {
public string groupName { get; set; }
public string groupNameOrCustomId { get; set; }
public List<int> groupIdList { get; set; } = new List<int>();
public List<string> customIdList { get; set; } = new List<string>();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
GroupSearchParameters groupSearchParameters = new GroupSearchParameters();
groupSearchParameters.groupNameOrCustomId = "customGroupId";
Task<GroupList> task = POSTData(groupSearchParameters, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<GroupList> POSTData(GroupSearchParameters groupSearch, string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
GroupList groups = null;
var postContent = new StringContent(JsonConvert.SerializeObject(groupSearch), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
groups = JsonConvert.DeserializeObject<GroupList>(responseBody);
// Do something with it
Console.WriteLine("Groups: " + groups.groupList.Count);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return groups;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"groupNameOrCustomId" => "Custom Name"
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"groupNameOrCustomId": "CustomID"
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/search'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
POST
to get a list of all Groups
with matching GroupSearchParameters
Response
List of Group
objects with matching GroupSearchParameters
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{id}
Request
DELETE
to delete a Group
record that does not have associated Locations
Response
Status code 200 - Successful
Status code 404 - Record could not be found
Status code 409 - Could not be deleted as there are associated Locations
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}
Sample GET
Group AccountDirective
request
<?php
//Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
//Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirective> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirective> 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));
AccountDirective accountDirective = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirective = JsonConvert.DeserializeObject<AccountDirective>(responseBody);
// Do something with it
Console.WriteLine("Account Directive name: " + accountDirective.name);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return accountDirective;
}
}
}
#!/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 {
#Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
my $url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
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
#Get accountDirective 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
c.url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD'
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
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Request
GET
to get the details of the specified account directive. The serviceName
parameter limits the request to specifically to one service.
Response
AccountDirective
object
–Sample Location requests
Test urls:
https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/CompanyAdministrationService/api/v1_0/locations
Sample POST
Location
request
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations/';
$location = [
'customId' => 'Custom Location ID',
'activation' => true,
'groupId' => 1,
'settings' => [
'name' => 'Location Name',
'description' => 'Location Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'receiptText' => 'Receipt Text',
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'cardAccountDirectiveList' => [
0 => [
'accountDirective' => '888-1'
],
1 => [
'accountDirective' => '888-2'
]
],
'achAccountDirectiveList' => [
0 => [
'accountDirective' => '2071-1'
],
],
'cashAccountDirectiveList' => [
0 => [
'accountDirective' => '2222-1'
],
]
],
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { 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 List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
}
public class Location {
public long locationId { get; set; }
public string customId { get; set; }
public bool activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/CompanyAdministrationService/api/v1_0/locations";
Location location = new Location();
location.activation = true;
location.customId = "Alb1";
Settings settings = new Settings();
settings.name = "Albuquerque Location 1";
settings.description = "First in Albuquerque";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address