Technical References - order file

File Formats - Order File/Shopping Cart in WebDNA

WebDNA automatically creates and maintains order files with fixed (and transparent) fieldnames. The following fieldname information is necessary when you need third-parties to interpret order files, such as when you connect to a credit card processor. Use [addlineitem], [setlineitem], [removelineitem], [clearlineitems], and [setheader] to manipulate the contents of an order file.

The shopping cart (and order file) format is a tab-delimited text file of the following format:

H tab Version tab Date tab Time tab Email tab PayMethod tab AccountNum tab ExpMonth tab ExpYear tab Name tab Company tab Address1 tab Address2 tab City tab State tab Zip tab Phone tab TaxRate tab ShipVia tab ShipCost tab Header1 tab Header2 tab Header3 tab Header4 tab Header5 tab country tab ShipToEmail tab ShipToName  tab ShipToCompany tab ShipToAddress1 tab ShipToAddress2 tab ShipToCity tab ShipToState tab ShipToZip tab ShipToCountry tab ShipToPhone tab Header6 tab ... tab Header40 tab NonTaxableTotal tab TaxableTotal tab TaxTotal tab ShippingTotal tab CartIPAddress tab CartUsername tab CartPassword tab Precision tab TaxableShipping tab AuthNumber tab ResponseText tab Status tab BatchNumber tab ReferenceNumber tab SequenceNumber tab ItemNumber tab bankRoutingNumber tab bankAccountNumber tab bankAccountType tab bankName tab bankAccountName tab CCID tab currencyCode tab recurringBillingCode  tab fax tab ShipTofax tab customerID tab invoiceNumber  tab poNumber tab description tab customerType tab customerTaxID  tab driversLicenseNumber tab driversLicenseState tab driversLicenseDOB tab lastName  tab ShipTolastname tab Comment tab SameAsShipping tab AVS  tab MD5Hash tab taxExempt tab resellerNumber tab transactionIndex  tab relatedTransaction return


Followed by multiple line items (one per sku, tab-delimited, return at end):

L tab sku tab quantity tab price tab taxable tab canEmail tab unitshipCost tab textA tab ... tab textZ return


WebDNA saves Shopping Cart files in a folder you specify via preferences. If the ShoppingCartFolder preference is "ShoppingCarts/" then WebDNA looks for a folder called "ShoppingCarts" in the same folder as the displayed template. If the preference is "../ShoppingCarts/" then WebDNA looks for the folder one level up from the template. You can, however, specify any location and folder name for your carts when you write to the cart. See the relevant [addlineitem], etc. tags for more information.)

Shopping Cart files stay in the ShoppingCarts folder until they expire (24 hours of inactivity), or until the visitor completes the sale, and the file is moved to the Orders folder defined in preferences. In a typical setting, the WebMerchant templates will pick up the orders appearing in the Orders folder and process them accordingly. (Note that this automated process only applies to the folders specified in preferences. If you steer WebDNA to a custom folder via the [addlineitems] tag, then abandoned carts will pile up over time. You can, however create your own trigger to weed them out. You will also need to write a simple [movefile] context to move the cart into your custom order folder.)

WebDNA never clears out the files saved in the Orders folder. If you have a huge volume of orders, you will occasionally need to erase (or archive) older files so you do not fill up your hard disk. We purposely never touch these files because they can provide a valuable "electronic paper trail" for you. The files are named the same as the cart at the time of purchase.



Header fields, in the order in which they are used. Maximum characters shown in parentheses. The first field is an internal identifier, whose value is H (for Header). It is not listed in the table.
FieldnameDescription
VersionVersion of WebMerchant
DateDate the order was placed
TimeTime the order was placed
EmailCustomer's email address (99)
PayMethodCC - Credit Card (WebDNA performs a checksum to make sure the number is reasonable)
AC - ACcount number (purchase order) (WebDNA performs no validation, but WebMerchant AccountAuthorizer later does custom authorization)
BK - Book this order (verify funds, but do not deposit money). Handled by WebMerchant
SH - Ship this order (only from a previous BK order. Deposits money that was verified earlier). Handled by WebMerchant
(If your cart system is not handled by WebMerchant, you can put anything or nothing in this field.)
AccountNumCredit card number
ExpMonthCredit card expiration month
ExpYearCredit card expiration year
NameCustomer's name (99)
CompanyCompany name (99)
Address1Customer's address line 1 (99)
Address2Customer's address line 2 (99)
CityCustomer's city (49)
StateCustomer's state (49)
ZipCustomer's zip code (19)
PhoneCustomer's phone (24)
TaxRateTax rate (do not include "%")
ShipViaemail, web, USPS, UPS, etc. (63)
ShipCostShipping cost per order (see line items for unit ship cost)
Header1Anything you want it to be (255)
Header2Same as Header 1
Header3Same as Header 1
Header4Same as Header 1
Header5Same as Header 1
CountryCustomer's country (49)
ShipToEmailUse ShipTo fields if billing differs from shipping (99)
ShipToName (99)
ShipToCompany (99)
ShipToAddress1 (99)
ShipToAddress2 (99)
ShipToCity (49)
ShipToState (19)
ShipToZip (19)
ShipToCountry (49)
ShipToPhone (24)
Header6Same as Header 1
Header7 ... Header40Same as Header 1
NonTaxableTotalAutomatically derived from non-taxable line items, but can be over-ridden in a context (must include password).
TaxableTotalAutomatically derived from taxable line items, but can be over-ridden in a context (must include password).
TaxTotalAutomatically calculated, but can be over-ridden in a context (must include password).
ShippingTotalAutomatically calculated from unit ship costs and order ship costs, but can be over-ridden in a context (must include password).
CartIPAddressNot automatically set, but available for use (15)
CartUsernameNot automatically set, but available for use (63)
CartPasswordNot automatically set, but available for use (63)
PrecisionInternational support: number of digits after the decimal that are considered important for tax, subtotal, grandtotal calculations. In the U.S., 2 digits is the normal precision. For Japan, 0 causes all calculations to round off at integer values. You can change this on a cart-by-cart basis with [setheader]
TaxableShippingIf set to T, causes shipping to be taxed. The tax and grand total are increased by [taxRate]*[shippingTotal]. Default value is F. Varies by location.
AuthNumberWebMerchant: Authorization # returned from bank network. With custom carts, match this field to the authorization number returned. (63)
ResponseTextWebMerchant: Response text returned from bank network. With custom carts, match this field to the Response text returned. (149)
StatusWebMerchant: Status returned from bank network (approved, declined, etc). With custom carts, match this field to the status returned. (63)
BatchNumberWebMerchant: batch # from bank network (approved, declined, etc). With custom carts, match this field to the batch # returned. (63)
ReferenceNumberAs above, bank network field you may or may not choose to use (63)
SequenceNumberAs above, bank network field you may or may not choose to use (63)
ItemNumberAs above, bank network field you may or may not choose to use (63)
bankRoutingNumberTypically required with e-Check transactions. (63)
bankAccountNumberTypically required with e-Check transactions. (63)
bankAccountTypeTypically required with e-Check transactions. (31)
bankNameTypically required with e-Check transactions. (99)
bankAccountNameTypically required with e-Check transactions. (99)
CCIDSecurity code on back of credit card (15)
currencyCode(15)
recurringBillingCodeCan be used to designate a weekly, monthly, yearly, etc... billing cycle. (15)
fax'Bill To' fax number. (15)
ShipTofax'Ship To' fax number. (15)
customerID(31)
invoiceNumber(63)
poNumber(63)
description(255)
customerType(15)
customerTaxID(31)
driversLicenseNumber(31)
driversLicenseState(49)
driversLicenseDOB(15)
lastName'Bill To' last name. (99)
ShipTolastname'Ship To' last name. (99)
Comment(255)
SameAsShipping'T' or 'F'. 'T' if billing information is the same as the shipping information.
AVSAddress Verification Code' (31)
MD5HashUsed to store the Hash code returned by some Payment Processors. (127)
taxExemptT' or 'F'. 'T' if order is exempt from taxing.
resellerNumber(127)
transactionIndexCan be used to store the 'rank' in a related set of orders. (63)
relatedTransactionCan be used to store a 'related' order id. (63)


Line Item fields, in the order in which they are used. Maximum characters shown in parentheses. The first field is an internal identifier, whose value is L (for LineItem). It is not listed in the table.
FieldnameDescription
skuunique identifier for product. Should match up with
quantity How many of this SKU should be added to the cart. This quantity is used when calculating totals, unitShipCost, etc.
priceThis value comes from the product database, or from a formula in formulas.db. To prevent "hacking" this value cannot be set via the form submission.
taxableT or F, derived the same as the price field.
canEmailT or F. Whether the product is deliverable via email, derived the same as the price field.
unitshipCostShip cost per unit, derived the same as the price field. ShipTotal and GrandTotal use this number (multiplied by quantity) to determine the total shipping and grand total.
textAAnything you want it to be (255)
textB ... textZSame as textA

DOWNLOAD WEBDNA NOW!

Top Articles:

WebDNA Libraries

A list of available libraries for WebDNA...

F.A.Q

A compilation of some user's questions...

Download WebDNA Applications

WebDNA applications...

WebDNA Modules

A list of the currently available modules...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Tips and Tricks

A list of user-submitted tips ...

Related Readings:

[platform]

...

[SQL]

Performs a SQL statement on an ODBC data source...

[listwords]

Breaks a string of text into separate words...

[xmlparse]

Enable the WebDNA programmer to input XML data into a WebDNA variable...

[deletefolder]

Deletes a folder from your website...

[lastautonumber]

displays the last auto-generated number...