TrustCommerce Developer's Guide 2.0

http://www.trustcommerce.com
developer@trustcommerce.com

September 14, 2001


Table of Contents

I. Introduction
II. Connecting via TCLink
III. Transaction Types
IV. Input Parameters
V. Return Parameters
VI. Credit Card Preauths and Sales
VII. Card Verification Value (CVV)
VII. Card-Present Transactions
IX. ACH
X. Postauths, Credits, and Chargebacks
XI. Billing IDs
XII. Recurring Billing
XIII. TCS Wallet
XIV. Automated Fulfillment
XV. Vault Query API
Appendix A - Test Data
Appendix B - Troubleshooting
Appendix C - Connecting via HTTPS POST
Appendix D - Currency Table

I. Introduction

This guide covers the TrustCommerce transactional processing API. It is platform- and language-neutral. If you are a developer programming processing functionality to a software package or website, then this guide is for you. If you are connecting via a pre-integrated commerce package, including shopping carts such as StoreForge, Mal's e-Commerce, PDG Cart, or AllCommerce, then you do not need this document.

Definitions of credit card processing terms and information about the Vault website are contained in the TrustCommerce User's Guide, and will not be covered here. If you are not familiar with the basics of credit card processing (such as the difference between an auth and capture), then you should probably read the User's Guide first. The User's Guide also describes use of the Vault website's reporting capabilities, which you may find useful to confirm that your test transactions are working as expected.

There are two methods of connecting to the TrustCommerce gateway at the programming level: the TCLink client software, and an HTTPS POST to the Vault server. TCLink is HIGHLY recommend, as it offers support for TrustCommerce's unique features such as automated failover and enhanced security through server certificate verification. It's available for many platforms and languages, and installation is straightforward, so you should try to use it if possible. If you are unable to use TCLink for whatever reason, the HTTPS POST method will still allow you to access most features of the TrustCommerce processing engine, but be aware that it cannot match the speed and especially the reliability of TCLink.

II. Connecting via TCLink

The TCLink API is available for download from the Vault website, in the "Downloads" section. Be sure to chose the version that matches the platform and language that you are using. In particular, Win32 developers will probably always want the COM object, which contains support for a number of different languages on the Win32 platform, including ASP, ColdFusion, and Perl.

Installation instructions specific to the TCLink version you've downloaded can be found in the readme file contained with the archive. It will also contain a version of the TCTest program specific to the language you're using. It's highly recommended that you look over this example, and even use it as the basis for your own code. In fact, you should look over the code sample first to get a feel for the API, then return to reading this document.

TCLink contains four key functions (create, pushparam, send, and response), plus a few extra helper functions. The function names used below are from the Python version of TCLink, but other APIs are very similar.

TCLink Function Names

Function Name Description
CreateLink() Create a new transaction handle.
PushParam() Push a parameter into the transaction.
Send() Submit a transaction to the gateway.
GetResponse() Retrieve a response parameter from the transaction.
GetEntireResponse() Get the entire response for the transaction, primarily use for debugging or logging.
GetVersion() Get the version string for the TCLink API in use.

These four methods map to the four stages of running a transaction: initialize, push a number of parameters describing the transaction, send the transaction to the TrustCommerce gateway for processing, and finally get details about the transaction results.

The only method which contacts the TC servers is Send(). This function will block for one or two seconds while the transaction is processed. Afterward, you can retrieve response parameters at your leisure; they are stored internally in TCLink.

III. Transaction Types

You may wish to read the section of the TCS User's Guide which describes the transaction types and the authorization/capture process, especially if you are not already familiar with credit card processing.

In terms of parameters passed, preauths and sales are almost identical. They take account data and personal information about the customer, along with a transaction amount. The transaction is authorized and the response values returned. In the case of a sale, the item is also immediately submitted for capture. Preauths are not captured until they are postauthed.

Postauths and credits are also very similar to one another. They indicate a capture or a return of funds for a previous transaction, and no personal data about the customer or their payment method is passed.

There are three other types of transaction. Store and unstore are covered in the Billing ID section of this document. Walletsale is covered under the TCS Wallet section.

IV. Input Parameters

There are a large number of parameters available for describing transactions. Not all parameters are accepted for all transaction types, and most parameters are optional. Most transactions can be sent with only a few parameters. The only parameters always required are custid, password, and action.

Parameters are carefully checked for format and size before the transaction is sent. If there are any errors in the parameters you've entered, the transaction will be aborted and detailed information about the errors will be returned. These return values are described in more detail in the next section.

The parameters presented in the following tables are used by all transaction types.

Required Parameters

Parameter NameDescription
amountAmount of the transaction, in cents. (example: "500" is $5.00)
custidYour customer ID number assigned to you by TrustCommerce.
passwordThe password for your custid as assigned by TrustCommerce.
actionThe transaction type; can be one of preauth, sale, postauth, credit, store, unstore, walletsale, or chargeback

Optional Parameters

Parameter NameDescription
amountAmount of the transaction, in cents. (example: "500" is $5.00)
demoWhen set to "y", the transaction will be a test transaction only.
ticketFree-form text field intended for storing ticket number or order number associated with the transaction, to aid merchants in order tracking and reporting.
operatorFree-form text field intended for recording the operator that entered the transaction, to aid merchants in order track and reporting.

The demo parameter is of particular note for testing. Demo transactions allow you to test your processing system without charging real money to a card, and you will not be charged and transaction fees. They are also flagged separately in the Vault database and will not appear in the regular accounting reports.

On card-not-present transactions, the ticket parameter is passed to the acquiring bank in the settlement process as the "purchase identifier." This may aid in reconciling the TrustCommerce transactions with the deposits made into the merchant bank account. If no ticket is passed, then the TrustCommerce transID will be sent to the bank instead.

V. Return Parameters

Any transaction sent will return several parameters describing the success or failure of the transaction. Properly formatted transactions will always return a transaction ID (or "transID') this is the unique identifier for this transaction, and can be used to retrieve the transaction from the Vault website, or otherwise access the transaction in the future. (For example, in order to credit a previous transaction, you will need to send the transID of said transaction.)

Transactions also always return a status parameter which describes the success or failure of the transaction. Status can be set to one of the following:

Status

Status ValueDescription
approvedThe transaction was successfully authorized.
acceptedThe transaction has been successfully accepted into the system.
declineThe transaction was declined, see declinetype for further details.
baddataInvalid parameters passed, see error for further details.
errorSystem error when processing the transaction, see errortype for details.

The difference between approved and accepted is subtle, but important. Approved means that the transaction was an authorization of some sort, and has been successfully cleared with the bank. Accepted only means that the transaction was queued into the system without errors, but may be rejected at some later time. An example of the difference is a sale versus a credit. A sale is a realtime authorization, so it returns approved on success. A credit is not realtime; there is no such thing as a "credit authorization." Instead it is queued up for processing by the bank and there is the small but non-zero posibility that it will be rejected at a later time. In practice, however, this rarely happens, so the developer need not worry unduly.

When status is set to decline, the parameter declinetype will contain one of the following:

Decline Type

Declinetype ValueDescription
declineThis is a "true" decline, it almost always is a result of insufficient funds on the card.
avsAVS failed; the address entered does not match the billing address on file at the bank.
cvvCVV failed; the number provided is not the correct verification number for the card. (See section X for details on CVV.)
callThe card must be authorized manually over the phone. You may choose to call the customer service number listed on the card and ask for an offline authcode, which can be passed in the offlineauthcode field.
carderrorCard number is invalid, usually the result of a typo in the card number.
authexpiredAttempt to postauth an expired (more than 7 days old) preauth.
dailylimitDaily limit in transaction count or amount as been reached.
weeklylimitWeekly limit in transaction count or amount as been reached.
monthlylimitMonthly limit in transaction count or amount as been reached.

A status of baddata indicates that no transaction was attempted because one or more parameters was invalid. In this case, the parameter error will indicate the problem, and the offenders parameter will list the offending input fields. The error parameter may be set to one of the following:

Bad Data

Error ValueDescription
missingfieldsSome parameters required for this transaction type were not sent.
extrafieldsParameters not allowed for this transaction type were sent.
badformatA field was improperly formatted, such as non-digit characters in a number field.
badlengthA field was longer or shorter than the server allows.
merchantcantacceptThe merchant can't accept data passed in this field. If the offender is "cc", for example, it usually means that you tried to run a card type (such as American Express or Discover) that is not supported by your account. If it was "currency", you tried to run a currency type not supported by your account.
mismatchData in one of the offending fields did not cross-check with the other offending field.

A status of error indicates the an error occurred while processing the transaction. These are almost always networking errors; see the Troubleshooting section for more. If the status is error, then the errortype parameter will be set to one of the following:

Error

Errortype ValueDescription
cantconnectCouldn't connect to the TrustCommerce gateway. Check your network connection and DNS capability.
linkfailureThe connection was established, but was severed before the transaction could complete.
failtoprocessThe bank servers are offline and unable to authorize transactions. Try again in a few minutes, or try a card from a different issuing bank.

Other parameters (such as avs or billingid) may be returned by the transaction depending on the action; see sections covering the transaction type you're running for detailed information on the specialized return values.

VI. Credit Card Preauths and Sales

The 'preauth' and 'sale' actions are identical in terms of parameters and function. The only difference is that a sale submits the item for capture as well, while preauths run the authorization only and can be postauthed at another time.

The parameters that can be passed with these action types are described in the following two tables. The first table list required fields that you must pass in order to send the transaction. The second table lists optional fields that you can pass if you wish, but are not required.

Required Parameters

Parameter NameDescription
amountAmount of the transaction, in cents. (example: "500" is $5.00)
ccCredit card number, digits only (no spaces or dashes)
expCredit card expiration date, in MMYY format

Optional Parameters

Parameter NameDefault ValueDescription
mediacc"cc" for credit card or "ach" for ACH.
currencyusdCurrency code (see section X for the table of codes)
avsyAVS requested, "y" or "n" (see notes below).
name Cardholder's name.
address1 First line of cardholder's street address.
address2 Second line of cardholder's street address.
city Cardholder's city.
state Two-character code for the cardholder's state.
zip Cardholder's zipcode, five or nine digits (no spaces or dashes).
country Cardholder's country, leave blank for US.
phone Cardholder's phone number.
email Cardholder's email address.
offlineauthcode Six-digit numeric code used to "force" the transaction (see notes below).

A note about AVS: The AVS system is a useful way to help screen for fraud, as it requires that whomever is sending the transaction know the billing address for the card in question. As a merchant, you should know that AVS is not uniformly supported by card issuers; approximately 30% of US-based credit cards will not have AVS capability, and AVS is not available with any non-US cards at all. If avs of "y" (the default) is used, it will attempt to verify the address data with AVS, but if it is unavailable, it will not cause the transaction to fail. Only if AVS is available and the address data does not match will the transaction be declined due to AVS. You may wish to screen AVS results more closely. For this reason, sales and preauths will return the AVS code in a parameter named avs. It returns a single character code, which are enumerated in the table below.

AVS Returns Codes

CodeDescription
XExact match, 9 digit zipcode.
YExact match, 5 digit zipcode.
AStreet address match only.
W9 digit zipcode match only.
Z5 digit zipcode match only.
NNo match on street address or zipcode.
UAVS unavailable on this card.
GNon-US card issuer, AVS unavailable.
RCard issuer system currently down, try again later.
EError, ineligible - not a mail/phone order.
SService not supported.
0General decline or other error.

Only the numeric parts of the address (street address and zipcode) are verified. It should also be noted that oftentimes AVS data is incorrect or not entirely up-to-date, dependent upon the card issuing bank. For these reasons, you should treat AVS as a helpful tool which should be used in combination with other methods (dependent upon your business model) for screening transactions. If you trust AVS too blindly, you may risk losing legitimate sales. Some merchants (again, dependent upon business model) choose to turn AVS off altogether. You should analyze your customer base and make the decision that will work best for your business.

A note on offlineauthcode: Some cards returned a declinetype of call. This indicates that the card cannot be automatically authorized, but if you call the card issuers, they may be able to give you a manual authorization, which will consist of a six-digit auth code. You may then push the transaction through by entering that code into the offlineauthcode field. Be warned: offlineauthcode is NOT a realtime authorization, and is not guaranteed in the same way as a normal authorization. Be careful with the use of this parameter.

Preauth/Sale Example

	tclink.CreateLink()
	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'preauth')
	tclink.PushParam('amount',    '500')
	tclink.PushParam('cc',        '4111111111111111')
	tclink.PushParam('exp',       '0404')
	tclink.PushParam('name',      'Jennifer Smith')
	tclink.PushParam('address1',  '123 Test St.')
	tclink.PushParam('city',      'Somewhere')
	tclink.PushParam('state',     'CA')
	tclink.PushParam('zip',       '90001')
	tclink.PushParam('avs',       'y')

	tclink.Send()

	status = tclink.GetResponse('status')

	if (status == 'approved'):
		print  'Transaction was successful'
	elif (status == 'decline'):
		print 'Transaction declined.  Reason: ',  tclink.GetResponse('declinetype')
	elif (status == 'baddata'):
		print 'Improperly formatted data.  Offending fields: ', tclink.GetResponse('offenders')
	else:
		print 'An error occured: ', tclink.GetResponse('error')

	print 'Here are the full details:'
	print tclink.GetEntireResponse()

VII. Card Verification Value (CVV)

Another method for cardholder verification is the CVV system. Visa cards use what is called a CVV2 code; Mastercards call it CVC2, and American Express calls it CID. CVV2 and CVC2 (Visa/MC) are located on the back of the credit card, printed in ink on the signature strip. The number is the last three digits on the righthand side of the long string of numbers on the strip. In the case of CID (AmEx), the number is a four-digit value located on the front of the card, printed just above the card number on the lefthand side. This value is passed to TCLink through the following parameter.

CVV Parameters

Parameter NameDescription
cvvA three or four digit CVV number.

The CVV value will be checked if anything is passed in this parameter. (If you don't include the parameter, no CVV test will be run.) If the CVV matches, the transaction will run as normal. If it does not, you will receive a status of decline, and a declinetype of cvv.

CVV Example

	tclink.CreateLink()

	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'preauth')
	tclink.PushParam('amount',    '500')
	tclink.PushParam('cc',        '4111111111111111')
	tclink.PushParam('exp',       '0404')
	tclink.PushParam('cvv',       '123')

	tclink.Send()

	if (tclink.GetResponse('status') == 'decline'):
		if (tclink.GetResponse('declinetype') == 'cvv'):
			print 'The CVV number is not valid.'

VII. Card-Present Transactions

In a retail environment with a card swiper, you may wish to pass magnetic stripe data along with the other credit card information on a preauth or sale. There are two parameters which you can use to send this data, named track1 and track2. Each one is for a different type of track data, and depends on the type of card reader being used.

Card-Present Parameters

Parameter NameDescription
track1Up to 79 bytes of Track 1 data.
track2Up to 40 bytes of Track 2 data.

You can include all data read from the track, but only data between the start sentinel (a '%' character) and the end sentinel ('?') will be used. Everything outside the start and end sentinels (such as the trailing LRC character) will be discarded.

The cc field is still required along with the track data, but if there is a mismatch between the information contained in the two fields it will generate a mismatch error.

Generally AVS and address data are not necessary for swiped transactions, however you may still pass these parameters as usual, if you like.

Card Present Example

	tclink.CreateLink()

	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'sale')
	tclink.PushParam('amount',    '500')
	tclink.PushParam('cc',        '4111111111111111')
	tclink.PushParam('exp',       '0404')

	track1_data = CardReader.ReadMagStripe()
	tclink.PushParam('track1',    track1_data);

	tclink.Send()

	if (tclink.GetResponse('status') == 'baddata'):
		if (tclink.GetResponse('error') == 'mismatch'):
			print 'The credit card number does not match the magnetic stripe data.'

IX. ACH

ACH, also known as electronic checks, are very different from credit cards in that they allow a direct debit or credit to a checking account. The concept of "authorization" does not exist; it is purely a money transfer. For this reason, the only transaction types available for ACH are sale and credit. ACH credits are identical to all other types of credits in the TrustCommerce system, so please refer to section X for details on issuing credits.

ACH sales take the same parameters as credit card sales, with the exception of the "cc" and "exp" fields. Instead, use the following parameters.

ACH Parameters

Parameter NameDescription
routingThe routing number of the bank being debited.
accountThe account number of the person or business being debited.

AVS is not available for ACH transactions, so the AVS setting is ignored.

There is only one declinetype returned from unsuccessful ACH sales, and that is "decline."

ACH Example

	tclink.CreateLink()

	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'sale')
	tclink.PushParam('media',     'ach')
	tclink.PushParam('amount',    '1000')
	tclink.PushParam('routing',   '123456789')
	tclink.PushParam('account',   '55544433322211')

	tclink.Send()

X. Postauths, Credits, and Chargebacks

These three transaction types are similar in that they reference a successful transaction previously executed through the TrustCommerce system. No credit card information or other personal information fields will be accepted by this transaction types; there is only one required parameter.

Required Parameters

Parameter NameDescription
transidThe transaction ID (format: nnn-nnnnnnnnnn) of the referenced transaction.

In addition, postauths and credits can take an optional amount parameter.

Optional Parameters

Parameter NameDescription
amountThe amount, in cents, to credit or postauth if it is not the same as the original amount.

If no amount is passed, the default will be to take the amount from the original transaction. If, however, you wish to credit or postauthorize less than the original amount, you may pass this parameter.

Credit Example

	tclink.CreateLink()

	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'credit')
	tclink.PushParam('transid',   '001-0000111101')

	tclink.Send()

	if (tclink.GetResponse('status') != 'accepted')
		print 'Credit unsuccesful.'

XI. Billing IDs

The Billing ID system enables you to store the billing information for your customers in the encrypted TrustCommerce database, and recall it with a single six-character alphanumeric code known as a billing ID. Besides offloading the liability of storing sensitive data such as credit card numbers from your business to TrustCommerce, it also can simplify database access on your servers.

Billing IDs add two new actions, store and unstore. These allow you to create, update, and deactivate billing IDs. Once stored, the billing ID will be passed in place of the many billing information fields for preauth and sale transactions.

The store transaction looks very similar to a preauth or sale. You may pass credit card information, billing and shipping address, or even ACH information. (Please see sections X and X for a detailed description of these parameters.) It adds one additional parameter:

Store Parameters

Parameter NameDescription
verifyWhen set to "y", a $1.00 preauth will be run on the card to ensure that it is valid.
billingidPass if you wish to update values of an existing billing ID.

The verify parameter is useful for ensuring that the card number is valid if you are not planning to bill the customer right away. It has no effect for ACH billing IDs, because there is no such thing as an ACH preauth. By default, the verification uses AVS; if you don't wish to use AVS, pass an avs of "n". Please note: normally, billing ID storage returns a status of accepted, because the card is unverified. If you use the verify parameter, however, it will return approved upon success.

The unstore action takes a single parameter:

Unstore Parameters

Parameter NameDescription
billingidThe six-character alphanumeric billing ID returned by a previous store transaction.

Unstore removes the billing ID from active use, and you won't be able to run further transactions on it. For your convenience, however, it does remain visible in Vault (flagged as an inactive ID), so you can still look up old IDs if needed.

Now, the moment of truth: to run a billing ID transaction, pass the billingid parameter to a preauth or a sale in place of all of the usual billing info fields (name, cc, exp, routing, account, etc). That's all there is to it! You'll find that your sale or preauth transactions are now only a few parameters: custid, password, billingid, and amount.

Billing ID Example

	tclink.CreateLink()

	# First, store a new ID.
	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'store')
	tclink.PushParam('cc',        '4111111111111111')
	tclink.PushParam('exp',       '0404')
	tclink.PushParam('name',      'Jennifer Smith')

	tclink.Send()

	if (tclink.GetResponse('status') == 'accepted'):
		# It was succesfully stored.  Now try running a transaction on the new ID.
		billingid = tclink.GetResponse('billingid', billingid);
		tclink.PushParam('custid',    'mycustid')
		tclink.PushParam('password',  'mypass')
		tclink.PushParam('action',    'sale')
		tclink.PushParam('billingid', billingid)
		tclink.PushParam('amount',    '995')
		tclink.Send()
		print 'Status is: ', tclink.GetResponse('status')
		# Unstore the ID now that we are done.
		tclink.PushParam('custid',    'mycustid')
		tclink.PushParam('password'  'mypass')
		tclink.PushParam('action'    'unstore')
		tclink.PushParam('billingid' billingid)
		tclink.Send()

XII. Recurring Billing

Recurring billing (sometimes also called "subscription billing") is an extension of the billing ID system. There are four parameters that are added to a store which turn the billing ID into a recurring billing ID. They are described below.

Recurring Parameters

Parameter NameRequired?Description
cycleXRepeat cycle in days, weeks, months, or years.
amountXAmount to bill in cents.
start Date to start, or else offset from current date (defaults to now).
payments Number of payments to make (defaults to infinite).

Cycle is in the format of a number followed by a character representing the timeframe: 'd' for days, 'w' for weeks, 'm' for months or 'y' for years. For example, a value of "3d" in this field would cause the charge to recur every three days, whereas a value of "2m" would cause it to recur every two months.

Amount is identical to the amount passed to a sale or a preauth, and indicates the amount of each charge made during the subscription.

Start is an optional field which allows the delay of the cycle's start. By default, the cycle starts the day the billing ID is stored. If it is specified in the format YYYY-MM-DD, it indicates a date when the first payment should be made. (For example, "2005-02-01" would be February 1, 2005.) If it is in the same format as the cycle (a number followed by a character), it indicates an offset from the current date. (For example, "1d" would start the billing tomorrow.) Note: recurring transactions will appear at the end of the business day they are billed on, so the first transaction for new subscriptions will not appear in the Vault until that time.

Payments is also optional; left blank or set to zero it will continue the billing cycle until it is manually interrupted by an unstore, or by updating the billing ID with cycle set to "null". Once the final payment is made, the billing ID will be unstored.

Recurring Billing Example

	tclink.CreateLink()

	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'store')
	tclink.PushParam('cc',        '4111111111111111')
	tclink.PushParam('exp',       '0404')
	tclink.PushParam('name',      'Jennifer Smith')
	tclink.PushParam('amount',    '1200')

	mode = ChooseSubscriptionMode();

	if (mode == 1):
		# Make a payment every day, infinitely (or until someone manually disables it)
		tclink.PushParam('cycle',   '1d')
	elif (mode == 2):
		# Make a payment once a month for one year
		tclink.PushParam('cycle',   '1m')
		tclink.PushParam('payments','12')
	elif (mode == 3):
		# Make a payment every six weeks, starting one week from now
		tclink.PushParam('cycle',   '6w')
		tclink.PushParam('start',   '1w')
	elif (mode == 4):
		# Make anual payments, and don't start until September 1, 2002
		tclink.PushParam('cycle',   '1y')
		tclink.PushParam('start',   '2003-09-02')

	tclink.Send()

XIII. TCS Wallet

The TCS Wallet is an additional service offered by the TrustCommerce gateway that allows you to run many small micropayments which are later lumped together and submitted as a single, large payment. This can offer a substantial savings for the merchant in transaction fees, as merchant account providers tend to penalize merchants that run small payments.

The Wallet is an extension of the billing ID system. It adds three new parameters to the store action, described below.

Wallet Parameters

Parameter NameDescription
wallet"y" to enable the wallet.
walletsizeAccumulated amount, in cents, before the wallet is submitted for capture.
walletexposureLength of time to wait before capturing the wallet.

In order to enable wallets for the billing ID that you are storing, set the "wallet" parameter to "y". The other two parameters are optional, as there are default values attached to your TC account. If you wish to change these values (which are normally $10.00 and 72 hours) please contact TrustCommerce. If you wish to change the values for an individual billing ID without changing your defaults, include these parameters.

Once the billing ID is stored, it is possible to use a new action type on the ID called walletsale. It is identical to a sale in all ways, except that it can only be used on wallet-enabled billing IDs, and it can accept amounts anywhere from $0.01 up to the size of the wallet. Walletsale will usually return "approved", but it may return "decline" if the stored credit card fails to re-authorize when the current wallet is exceeded. Except for these two modifications (the wallet parameters on the store, and changing sales to walletsales), there is no extra development to be done client-side to make wallets work. Captures happen automatically after walletexposure has expired or the walletamount has been used up; reauthorizations also happen automatically.

Wallet Example

	tclink.CreateLink()

	# First, store a new ID with the wallet enabled.
	tclink.PushParam('custid',    'mycustid')
	tclink.PushParam('password',  'mypass')
	tclink.PushParam('action',    'store')
	tclink.PushParam('cc',        '4111111111111111')
	tclink.PushParam('exp',       '0404')
	tclink.PushParam('name',      'Jennifer Smith')
	tclink.PushParam('wallet',    'y')

	tclink.Send()

	if (tclink.GetResponse('status') == 'approved'):
		# We have a new wallet at our disposal.  Run a micropayment on it.
		billingid = tclink.GetResponse('billingid');
		tclink.PushParam('custid',    'mycustid')
		tclink.PushParam('password',  'mypass')
		tclink.PushParam('action',    'walletsale')
		tclink.PushParam('billingid', billingid);
		tclink.PushParam('amount',    '995')
		tclink.Send()

XIV. Automated Fulfillment

TrustCommerce offers the unique feature of automated fulfillment, by which orders submitted through the TCLink API can contain parameters describing product information. This information is then passed on to your fulfillment house, which ships the products automatically.

First, it is necessary to specify the shipping address for the customer. If it is the same as the billing address, you need not duplicate it, but rather just send the shiptosame parameter set to y. The table below enumerates the shipping parameters.

ShipTo Parameters

Parameter NameDescription
shiptosamey or n (defaults to n). If "y", then no other shipto_ parameters should be passed.
shipto_nameName of the product recipient.
shipto_address1First line of shipping address.
shipto_address2Second line (if any) of shipping address.
shipto_cityCity.
shipto_stateState.
shipto_zipZipcode, five or nine digits (no spaces or dashes).
shipto_countryCountry, leave blank for US.

Second, some additional data about the order as a whole should be passed in the form of the following parameters.

Order Header Parameters

Parameter NameDescription
shippingcodeThree character code indicating shipping method to use.
shippinghandlingThe total cost of shipping and handling, in cents.
numitemsTotal number of distinct items (product codes) in the order.

Finally, a number of parameters which describe the details of each type of item must be passed. In the table below, the 'X' character in the parameter name should be replaced with a digit indicating which item it applies to. For example, if numitems is set to three, then you should pass three product codes, in the form of productcode1, productcode2, and productcode3.

Order Detail Parameters

Parameter NameDescription
productcodeXThe alphanumeric product code defined by the fulfillment house.
quantityXThe number of items of this type to be shipped.
priceXThe price of all items of this type not including sales tax or shipping, in cents.
taxXTotal tax charged for all items of this product code.
shippinghandlingXTotal shipping and handling charged for all items of this product code.

Please note: the shippinghandling field and the shippinghandlingX fields are mutually exclusive. Use one or the other, but not both. If you're not sure which to use, please contact your fulfillment house.

Fulfillment Example

	tclink.CreateLink()

	tclink.PushParam('custid',           'mycustid')
	tclink.PushParam('password',         'mypass')
	tclink.PushParam('action',           'preauth')
	tclink.PushParam('cc',               '4111111111111111')
	tclink.PushParam('exp',              '0404')
	tclink.PushParam('amount',           '1883')    # Total of items, tax, and shipping
	tclink.PushParam('name',             'Jennifer Smith')
	tclink.PushParam('address1',         '123 Test St.')
	tclink.PushParam('city',             'Somewhere')
	tclink.PushParam('state',            'CA')
	tclink.PushParam('zip',              '90001')
	tclink.PushParam('shiptosame',       'y')     # Shipping address is same as billing address

	tclink.PushParam('numitems',         '2')     # Two total product codes will be described
	tclink.PushParam('shippingcode',     'OVRNGT')
	tclink.PushParam('shippinghandling', '695')

	tclink.PushParam('productcode1',     'PCODE1')
	tclink.PushParam('quantity1',        '3')
	tclink.PushParam('price1',           '600')   # Item 1 costs $2.00, and there are 3 of them
	tclink.PushParam('tax1',             '48')    # Tax of 8%

	tclink.PushParam('productcode2',     'PCODE2')
	tclink.PushParam('quantity2',        '1')
	tclink.PushParam('price2',           '500')   # Item 1 costs $5.00, there's only one
	tclink.PushParam('tax2',             '40')    # Tax of 8%

	tclink.Send()

XV. Vault Query API

The Vault website serves as a web-based interface for merchant reconciliation. On the backend, it is a complex database that tracks all transactional data for your TrustCommerce account. The information contained in the Vault can be accessed at the API level using a standard CGI query over HTTPS.

The query API returns data in CSV (comma separated value) format, which is just a flat text file with fields separated by commas, and records separated by newlines. (You can also request the data returned in an HTML table, which is useful for debugging.) The first line of the file contains the name of each field that will be returned in subsequent records.

The parameters that the query interface accepts are described in the table below.

Required Parameters

Parameter NameRequred?Description
custidXTrustCommerce customer ID number.
passwordXThe password for your custID.
format Set to "html" for human-readable HTML output, or "text" (default) for CSV text output.
querytypeXPossible values are: chain, transaction, summary, or billingid, corresponding to the equivalent reports on the Vault website. Read the User's Guide for further description of each report type.
media Set to "cc" (default) or "ach" for media type.
begindate Begin date for query, format: MM-DD-YYYY HH:MM:SS
enddate End date for query, format: MM-DD-YYYY HH:MM:SS
chain Narrow search to a single chain of transactions.
transid Narrow search to a single transaction ID.
billingid Narrow search to a single billing ID.
action Narrow search by action (preauth, sale, credit, etc).
status Narrow search by status (approved, accepted, decline, etc).
name Narrow search by cardholder name, partial or complete.
cc Narrow search by credit card number.
limit Do not allow size of result set to exceed this number of records.
offset Report result set starting from this offset. Use this parameter in conjunction with limit in order to page through a large result set.
showcount Show the number of records returned on the last line of the result set.

The sample HTML code shown below illustrates the functionality of the query API. It can be pasted into a file and loaded on your web browser in order to try out some queries before you even begin to write your code.

Query Example HTML

<html>
<head> <title> TrustCommerce Query Interface </title> </head>
<body>
<h2> TrustCommerce Query Interface </h2>
<form action=https://vault.trustcommerce.com/query/>
	<table align=center border=1>
	<tr>
		<td> custid </td>
		<td> <input type=text name=custid> </td>
		<td> This is your TrustCommerce custid (required) </td>
	</tr>
	<tr>
		<td> password </td>
		<td> <input type=password name=password> </td>
		<td> This is your TrustCommerce password (required) </td>
	</tr>
	<tr>
		<td> format </td>
		<td> <select name=output> <option value=text>text</option>
				<option value=html>html</option></select></td>
		<td> Human readable (html) or computer readable (text) results</td>
	</tr>
	<tr>
		<td> Query type </td>
		<td> <select name=querytype> 
		<option value=chain>chain</option>
		<option value=transaction>transaction</option>
		<option value=summary>summary</option>
		<option value=billingid>billingid</option>
		</select></td>
		<td> Type of query </td>
	</tr>
	<tr>
		<td> media </td>
		<td> <input type=text name=media value=cc> </td>
		<td> For now this must be cc </td>
	</tr>
	<tr>
		<td> begindate MM-DD-YYYY HH:MM:SS </td>
		<td> <input type=text name=begindate> </td>
		<td> Query begins at this date</td>
	</tr>
	<tr>
		<td> enddate MM-DD-YYYY HH:MM:SS </td>
		<td> <input type=text name=enddate> </td>
		<td> Query ends at this date</td>
	</tr>
	<tr>
		<td> chain </td>
		<td> <input type=text name=chain> </td>
		<td> Narrow search to a single chain of transactions </td>
	</tr>
	<tr>
		<td> transid </td>
		<td> <input type=text name=transid> </td>
		<td> Narrow search to a single transactions </td>
	</tr>
	<tr>
		<td> billingid </td>
		<td> <input type=text name=transid> </td>
		<td> Narrow search to a single billingid </td>
	</tr>
	<tr>
		<td> action </td>
		<td> <input type=text name=action> </td>
		<td> Narrow search by action. (example: preauth,postauth) </td>
	</tr>
	<tr>
		<td> status </td>
		<td> <input type=text name=status> </td>
		<td> Narrow search by status. (example: approved,accepted) </td>
	</tr>
	<tr>
		<td> name </td>
		<td> <input type=text name=name> </td>
		<td> Narrow search by name. </td>
	</tr>
	<tr>
		<td> cc </td>
		<td> <input type=text name=cc> </td>
		<td> Narrow search by credit card field. </td>
	</tr>
	<tr>
		<td> limit </td>
		<td> <input type=text name=limit value=20> </td>
		<td> Limit results to this number of fields (not used for summary)</td>
	</tr>
	<tr>
		<td> offset </td>
		<td> <input type=text name=offset value=0> </td>
		<td> Report results at this offset (used with limit to page through results)</td>
	</tr>
	<tr>
		<td> showcount </td>
		<td> <select name=showcount> 
		<option value=y>yes</option>
		<option value=n>no</option>
		</select></td>
		<td> Show the number of not-limited rows on the last line of the result</td>
	</tr>
	<tr>
		<td colspan=3> <input type=submit> </td>
	</tr>
	</table>
</form>
</body>
</html>

Appendix A - Test Data

While testing, you may wish to experiment with the different responses that the gateway can generate. The following test card numbers will produce an approval, and have address data as listed, for testing AVS. If you wish to test CVV, the code listed int he right-hand column is the correct CVV code, Other valid credit cards will work, but will produce a 'U' AVS code. All of these cards accept "0404" as the expiration date.

TCLink Function Names

Card NumberExpAddressCityStateZipCVV
411111111111111104/04123 Test St.SomewhereCA90001123
541111111111111504/044000 Main St.AnytownAZ85001777
601111111111111704/046789 Green Ave.NowhereMA12345606
34111111111111104/0412 Colorado Blvd.ElsewhereIL543214000

The following card numbers will generate a decline, with the declinetype listed as follows. You may use this to test code which takes different paths dependant upon the type of decline.

TCLink Function Names

Card NumberExpDeclineType
401234567890904/04decline
555544443333222604/04call
444411114444111104/04carderror

You should also test your code to make sure it properly handles all baddata and error cases as listed in section X. Simply pass bad values in order to generate these situations.

Appendix B - Troubleshooting

Details about installing and troubleshooting TCLink specific to your development platform can be found in the documentation included with the TCLink archive.

Once you are able to connect to the TC gateway, you should be able to diagnose parameter-related issues using the status, error, declinetype, and errortype parameters returned by the gateway. There is one response which indicates a more generic error, and that's an error of cantconnect. A few common reasons for cantconnect errors are described below.

First, check the computer's network connection; can you ping machines on the Internet, by IP or by name?

One common network connectivity error is that your target computer may be behind a firewall. TCLink uses the HTTPS port (443/tcp) for network communications; you can check whether this port is open from the target machine by typing "telnet vault.trustcommerce.com 443" at a UNIX command prompt, or else by loading a web browser on the target machine and attempting to visit https://vault.trustcommerce.com directly. If you timeout attempting to make the connection, but your Internet connection is working otherwise, then you may be firewalled. Speak to your network administrator about allowing outbound TCP traffic on port 443.

Another common problem is the lack of domain name (DNS) resolution. The target machine must be able to resolve the trustcommerce.com domain; try typing "host trustcommerce.com" from a UNIX command prompt. If you don't get a response, or get an error, then the machine cannot resolve DNS information and TCLink will not be able to connect to the TC gateway. Speak to your sysadmin about making domain name resolution available to your target host.

Appendix C - Connecting via HTTPS POST

This method should only be used if a TCLink client install is not an option. It does not have the failover capability (and thus the processing uptime is not guaranteed to be 100%), or some of the enhanced security features of TCLink. In addition, transactions may be slightly slower, by an extra half second or so. It does, however support all other features available through TCLink, including all parameters and transaction types.

This is the URL:

https://vault.trustcommerce.com/trans/

The transaction should be sent as a standard POST, with CGI parameters, URL encoded. The parameters are otherwise identical to those used through TCLink.

Response parameters are returned as name-value pairs separated by newlines.

Appendix D - Currency Table

Currency Codes

CodeCurrency TypeCodeCurrency Type
usdUS DollarsjpyJapan Yen
eurEurojodJordan Dinar
cadCanadian DollarskrwKorea (South) Won
gbpUK PoundslbpLebanon Pounds
demGerman DeutschemarkslufLuxembourg Francs
frfFrench FrancsmyrMalaysia Ringgit
jpyJapanese YenmxpMexico Pesos
nlgDutch GuildersnlgNetherlands Guilders
itlItalian LiranzdNew Zealand Dollars
chfSwitzerland FrancsnokNorway Kroner
dzdAlgeria DinarspkrPakistan Rupees
arpArgentina PesosxpdPalladium Ounces
audAustralia DollarsphpPhilippines Pesos
atsAustria SchillingsxptPlatinum Ounces
bsdBahamas DollarsplzPoland Zloty
bbdBarbados DollarsptePortugal Escudo
befBelgium FrancsrolRomania Leu
bmdBermuda DollarsrurRussia Rubles
brrBrazil RealsarSaudi Arabia Riyal
bglBulgaria LevxagSilver Ounces
cadCanada DollarssgdSingapore Dollars
clpChile PesosskkSlovakia Koruna
cnyChina Yuan RenmimbizarSouth Africa Rand
cypCyprus PoundskrwSouth Korea Won
cskCzech Republic KorunaespSpain Pesetas
dkkDenmark KronerxdrSpecial Drawing Right (IMF)
nlgDutch GuilderssddSudan Dinar
xcdEastern Caribbean DollarssekSweden Krona
egpEgypt PoundschfSwitzerland Francs
eurEurotwdTaiwan Dollars
fjdFiji DollarsthbThailand Baht
fimFinland MarkkattdTrinidad and Tobago Dollars
frfFrance FrancstrlTurkey Lira
demGermany Deutsche MarksgbpUnited Kingdom Pounds
xauGold OuncesusdUnited States Dollars
grdGreece DrachmasvebVenezuela Bolivar
hkdHong Kong DollarszmkZambia Kwacha
hufHungary ForinteurEuro
iskIceland KronaxcdEastern Caribbean Dollars
inrIndia RupeesxdrSpecial Drawing Right (IMF)
idrIndonesia RupiahxagSilver Ounces
iepIreland PuntxauGold Ounces
ilsIsrael New ShekelsxpdPalladium Ounces
itlItaly LiraxptPlatinum Ounces
jmdJamaica Dollars  


Copyright © 2001 TrustCommerce