POST api/paymentservice/cc/validateandcharge

Validates and charges a credit card.

Request Information

URI Parameters

None.

Body Parameters

A request containing the details of the credit card to validate and charge.

PaymentServiceValidateAndChargeCreditCardPaymentRequest
NameDescriptionTypeAdditional information
WorkOrderId

Represents the Id of the work order to attach a successful payment to

integer

Minimum value: 1

CompanyId

Represents the Id of the company the payment will be placed for.

integer

Required

Minimum value: 1

ExpiryDate

Expiration date of the credit card. Only month and year are used.

date

Required

BillingAddress

The billing address of the credit card being validated.
Testing conditions.
AVS rejection codes in test environment:

CodeMeaning
AStreet Address matches, Zip code does not
WZip code matches, Street Address does not
Z5 digit ZIP code match only
NNo Address or ZIP Code match
UAddress information is unavailable for that account number, or the card issuer does not support AVS.
RSystem unavailable, retry later
SService not supported
QBill to address did not pass edit checks
5Cardholder name incorrect, billing address and postal code match
6Cardholder name incorrect, billing postal code matches
7Cardholder name incorrect, billing address matches
8Cardholder name, billing address and postal code are all incorrect

Address

Required

CardHolderName

The name on the card.

string

Required

String length: inclusive between 1 and 30

CardNumber

The account number on the credit card. Must be a valid AMEX, Visa, MC, or Discover account number
Testing conditions.

string

Required

Cvv2

The CVV2 code for the credit card.
Testing conditions.
CVV2 rejection codes in test environment:

First CharacterResponse
2CVV2 does not match
3Card expiration not provided for card does not have valid CVD code

string

Required

String length: inclusive between 1 and 4

PhoneNumber

PhoneNumber associated with the credit card

string

Required

Must be an acceptably formed phone number

String length: inclusive between 0 and 14

PhoneType

Type of phone number provided

PhoneType

Required

EmailAddress

Email address of the person responsible for the credit card.

string

Required

String length: inclusive between 0 and 30

CurrencyCode

What currency to make the charge in.

string

Required

Username

Name of user authorizing the charge

string

Required

String length: inclusive between 1 and 100

ChargeAmountNatural

Amount to charge on the card in CurrencyCode currency.
Testing conditions.

decimal number

Required

Range: inclusive between 0.01 and 999999.99

SecurityKey

Security key for this transaction. Base64 encoding of the MD5 hash of "UserName:PrivateKey:MMddyyyy" in UTF8.

  • UserName is your username that you log into the API with.
  • Contact an administrator for your private key.
  • MMddyyyy is DateTime.UtcNow.Date formatted with MMddyyyy.

"WEB-API-USER:WEB-API-SECRET:08092017" would result in "YnQXrdS22L03ftjKHaExBg==" for a SecurityKey.

string

Required

Request Formats

application/json, text/json

Sample:
{
  "WorkOrderId": 1,
  "CompanyId": 1,
  "ExpiryDate": "2024-12-25T09:28:58.7753466-05:00",
  "BillingAddress": {
    "Street1": "sample string 1",
    "Street2": "sample string 2",
    "City": "sample string 3",
    "Region": "sample string 4",
    "Postalcode": "sample string 5",
    "PostalZip4": "sample string 6",
    "CountryCode": "sample string 7"
  },
  "CardHolderName": "sample string 3",
  "CardNumber": "sample string 4",
  "Cvv2": "sample string 5",
  "PhoneNumber": "sample string 6",
  "PhoneType": 68,
  "EmailAddress": "sample string 7",
  "CurrencyCode": "sample string 8",
  "Username": "sample string 9",
  "ChargeAmountNatural": 10.0,
  "SecurityKey": "sample string 11"
}

application/xml, text/xml

Sample:
<PaymentServiceValidateAndChargeCreditCardPaymentRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <WorkOrderId>1</WorkOrderId>
  <CompanyId>1</CompanyId>
  <ExpiryDate>2024-12-25T09:28:58.7753466-05:00</ExpiryDate>
  <BillingAddress>
    <Street1>sample string 1</Street1>
    <Street2>sample string 2</Street2>
    <City>sample string 3</City>
    <Region>sample string 4</Region>
    <Postalcode>sample string 5</Postalcode>
    <PostalZip4>sample string 6</PostalZip4>
    <CountryCode>sample string 7</CountryCode>
  </BillingAddress>
  <CardHolderName>sample string 3</CardHolderName>
  <CardNumber>sample string 4</CardNumber>
  <Cvv2>sample string 5</Cvv2>
  <PhoneNumber>sample string 6</PhoneNumber>
  <PhoneType>Day</PhoneType>
  <EmailAddress>sample string 7</EmailAddress>
  <CurrencyCode>sample string 8</CurrencyCode>
  <Username>sample string 9</Username>
  <ChargeAmountNatural>10</ChargeAmountNatural>
  <SecurityKey>sample string 11</SecurityKey>
</PaymentServiceValidateAndChargeCreditCardPaymentRequest>

application/x-www-form-urlencoded

Sample:

Sample not available.

Response Information

Resource Description

A response containing validity data and information resulting from charging the card.

PaymentServiceValidateAndChargeCreditCardPaymentResponse
NameDescriptionTypeAdditional information
ValidationResult

Result of the validation of the information.

ResultType

None.

ChargeResult

Result of the charge.

ResultType

None.

ConfirmationNumber

Confirmation number of the charge

string

None.

ChargedAmount

Amount charged to the card

string

None.

ServiceChargeAmount

Amount of surcharge added to the requested amount.
“We impose a surcharge on credit cards that is not greater than our cost of acceptance”

string

None.

ChargedAccountDisplay

Masked version of the card charged

string

None.

UserErrorMessage

Error message if charging was unsuccessful

string

None.

CardTypeDisplay

Type of card charged

string

None.

CardType

Type of card charged

CreditCardType

None.

Response Formats

application/json, text/json

Sample:
{
  "ValidationResult": 0,
  "ChargeResult": 0,
  "ConfirmationNumber": "sample string 1",
  "ChargedAmount": "sample string 2",
  "ServiceChargeAmount": "sample string 3",
  "ChargedAccountDisplay": "sample string 4",
  "UserErrorMessage": "sample string 5",
  "CardTypeDisplay": "sample string 6",
  "CardType": 1
}

application/xml, text/xml

Sample:
<PaymentServiceValidateAndChargeCreditCardPaymentResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ValidationResult>Unknown</ValidationResult>
  <ChargeResult>Unknown</ChargeResult>
  <ConfirmationNumber>sample string 1</ConfirmationNumber>
  <ChargedAmount>sample string 2</ChargedAmount>
  <ServiceChargeAmount>sample string 3</ServiceChargeAmount>
  <ChargedAccountDisplay>sample string 4</ChargedAccountDisplay>
  <UserErrorMessage>sample string 5</UserErrorMessage>
  <CardTypeDisplay>sample string 6</CardTypeDisplay>
  <CardType>Visa</CardType>
</PaymentServiceValidateAndChargeCreditCardPaymentResponse>