Help

Vision Link API 2 Specification

Vision Link API Specification

revision 20220111 matt@winepos.com

Introduction

The Vision Link API provides secure access to the Vision POS System for 3rd party software developers. A web shopping cart can connect to our internet server and submit orders that will then be automatically relayed to the merchant's Vision system.

The Vision Link API is based on HTTP and XML, so you can interact with it from just about any programming language.

HTTP Conventions

You'll need to follow a few conventions

  1. Use the hostname sent to you in the welcome email. It should be vznlink.com
  2. Use https (http with ssl encryption on port 443).
  3. Use the POST method (as opposed to GET, PUT or DELETE).
  4. POST to the path /orders
  5. Use HTTP Basic authentication. The API username and API password were sent to you in the welcome email.
  6. Use Content-Type application/x-www-form-urlencoded

Here is a sample request to the API, including headers:

POST /orders HTTP/1.1
Authorization: Basic YWRtaW4yMTI0ODE6NGFkM2M2NzE2ZjU0OWQ5ZTk2NTdjNWU5MzA5OGYzZTcyNjE2ZjU1Yw==
Host: vznlink.com
Accept: */*
Content-Length: 246
Content-Type: application/x-www-form-urlencoded

<order><api-version>1</api-version>
<items><item><item-num>00812</item-num></item></items></order>

If successful, the reponse Status will be "201 Created". If the response is 302, double-check your authentication code, including the username and password. If the reponse is 500, look at the content of the response for the reason the order was rejected.

XML Conventions - Entities

The XML specification requires that all XML processors represent these five characters (at a minimum) as special entities. Your xml tools should include a method to "escape" them. The Vision Link XML entities do not support formatting elements such as the <sup> tag or <font> tag. If you want to submit these literal values for some reason, then they must be escaped properly.

CharacterXML Entity
&&amp;
<&lt;
>&gt;
'&apos;
"&quot;

Unescaped and Incorrect:

<notes>You & I have been "friends" a long time.</notes>

Correct:

<notes>You &amp; I have been &quot;friends&quot; a long time.</notes>

XML Conventions - Case Sensitive

The XML standard defines tags as case sensitive. The tag <order> is different from <Order> which is different from <ORDER>. All XML tags in Vision Link are in lower case.

Customer Order Creation

Example

<order>

  <api-version>2</api-version>
  <vision-customer-num>543210</vision-customer-num>
  <alt-customer-num>34a56</alt-customer-num>
  <alt-num>x123123a</alt-num>
  <source>3</source>
  <orderred>2008-01-12</orderred>
  <notes>Please rush my order.</notes>
  <customer-email>adler@vznlink.com</customer-email>
  <tax><code>NJ</code></tax>
  <first-name>John</first-name>
  <last-name>Smith</last-name>
  <phone>732-555-0909</phone>
  <birthday>1996-01-01</birthday>
  <delivery-time>2019-01-01 01:01:01-04</delivery-time>

  <billing-address>
    <address1>123 Main Street</address1>
    <address2>Apt #2</address2>
    <city>Montclair</city>
    <state>NJ</state>
    <zip-code>07042</zip-code>
    <organization>The Best Wine Club</organization>
  </billing-address>

  <shipping-address>
    <shipping-first-name>Jane</shipping-first-name>
    <shipping-last-name>Doe</shipping-last-name>
    <address1>123 River Road</address1>
    <city>Rumson</city>
    <state>NJ</state>
    <zip-code>07760</zip-code>
    <shipping-phone>732-867-5309</shipping-phone>
    <organization>The Best Wine Club</organization>
  </shipping-address>

  <items>
    <item>
      <item-num>00812</item-num>
      <size>CASE</size>
      <quantity>7</quantity>
      <price>8.95</price>
      <deposit>.5</deposit>
      <tax>
        <code>NJ</code>
        <state>.3</state>
        <county>.2</county>
        <city>.1</city>
      </tax>
    </item>
  </items>

  <tenders>
   <tender>
     <amount>14.94</amount>
     <tender-id>4</tender-id>
   </tender>
  </tenders>

  <subscriptions>
    <subscription>
      <vision_group_id>12345ABC</vision_group_id>
    </subscription>
  </subscriptions>

</order>

Tags

TagDescription
api-versionThis is required so that future updates to the api do not disrupt legacy clients. Set this to "1" for now.
customer-emailcustomer email address, important but not required
vision-customer-numoptional field for customer number in Vision system, if known. if this field is omitted then a new customer will be created in vision based on customer-email.
alt-customer-numcustomer number in web system
alt-numorder number in web system
sourceThe source ID of the order. See the "Sources" section which contains valid values for this field. If additional granularity is required, the Vision merchant can add customized source IDs to their point of sale system which you can then submit in this field.
orderredtimestamp to indicate when order was originally placed
notestext about this order, typically coming from customer and directed at merchant
first-namecustomer info if known
last-namecustomer info if known
phonecustomer info if known
birthdaycustomer birthday if known
delivery-timeThe time that the order will be or was delivered. A timezone must be included. It is best to use the timezone of the merchant. The date must be submitted in this format: "2019-05-21 10:56:51-04".
 
conveyancemethod of shipping, typically one of the following: fedex, ups, pickup, etc
 
taxgeneral tax information for this order
tax/codethe tax code that represents the unique allocation of tax collected for state, county, city entities. must match an existing vision tax code
billing-addressbilling address for order
billing-address/address1
billing-address/address2
billing-address/city
billing-address/statetwo character state abbreviation
billing-address/zip-code
billing-address/organizationThe organization or company name for this order if applicable
 
shipping-addressshipping address for order. do not need to include if same as billing
shipping-address/shipping-first-name
shipping-address/shipping-last-name
shipping-address/address1
shipping-address/address2
shipping-address/city
shipping-address/statetwo character state abbreviation
shipping-address/zip-code
shipping-address/shipping-phone
shipping-address/organizationThe organization or company name for this order if applicable
 
itemsgrouping of all line items in the order
items/itemgrouping of one line item in the order
items/item/item-numthe item number in the Vision system
items/item/sizesubmit either BOTTLE or CASE. BOTTLE is used by default if nothing is submitted
items/item/quantitythe number of either BOTTLES or CASES in this order. "1" is used by default if nothing is submitted
items/item/pricethe total price of all products in this line item (e.g. "50.00" if buying two $25 bottles)
items/item/depositthe total deposit amount of all products in this line item (e.g. ".50" if buying two bottles each with a .25 deposit)
items/item/taxthe grouping of tax allocations for this line item)
 
taxgrouping of all tax collected for one or more jurisdictions in the order
tax/statetax collected for the state of this jurisdictions for the whole order (e.g. "0.00")
tax/countytax collected for the county of this jurisdictions for the whole order (e.g. "0.00")
tax/citytax collected for the city of this jurisdictions for the whole order (e.g. "0.00")
 
preauthsgrouping of all preauths in the order (if card was preauthorized in IPCharge)
preauths/preauthgrouping of one preauth in the order
preauths/preauth/cardnumthe masked card number
preauths/preauth/expdateexpiration date in MMYY format
preauths/preauth/amountthe dollar amount preauthorized
preauths/preauth/authorized1 for yes or 0 for no
preauths/preauth/transaction-idthe TROUTD (transaction id) from the IPCharge system
preauths/preauth/response-textthe RESPONSE_TEXT from the IPCharge system
preauths/preauth/card-typeThe integer that corresponds to the card type. See the lookup table under the "Tenders" section.
 
tendersgrouping of all tenders in the order (if the customer has already paid)
tenders/tendergrouping of one tender in the order (if the customer has already paid)
tenders/tender/amountthe dollar value of the tender
tenders/tender/tender-idthe tender id from the Vision system
 
gift-cardsgrouping of all gift cards in the order
gift-cards/gift-cardgrouping of one gift card in the order
gift-cards/gift-card/balancethe dollar value of the gift card
gift-cards/gift-card/codethe text value used by the cashier to redeem the gift card in the Vision point of sale
gift-cards/gift-card/web-codethe optional text value of the unique identifier for this gift card in your application
 
subscriptionsgrouping of all subscriptions
subscriptions/subscriptiongrouping of one subscription in the order
subscriptions/subscription/vision_group_idthe value of vision_group_id from Tasty or group_id from Vision that belongs to the group to be assigned to the customer

Subscriptions

You can optionally include any number of subscriptions to assign the customer in the order to a customer group in Vision. This is useful for so called 'Wine of the Month' or other promotions that the merchant may have that require the customer to be part of a customer group in Vision.

<subscriptions>
  <subscription>
    <vision_group_id>12345ABC</vision_group_id>
  </subscription>
</subscriptions>

Shipping Charges, Gift Wrap Charges and Coupon Discounts, Subscriptions

Instead of submitting a five digit numeric value for the "item-num", you can submit the text "shipping", "gift_wrap", or "coupon". You can provide a tax amount, just like a regular item. Use the "coupon" item in order to give discounts on the balance due.

Shipping

You can include any number of "shipping" items to represent shipping charges and the associated taxes. The tax field is optional.

<item>
  <item-num>shipping</item-num>
  <price>7.99</price>
  <tax><state>.79</state></tax>
</item>

Gift_Wrap

You can include any number of "gift_wrap" items to represent gift wrap charges and the associated taxes. The tax field is optional.

<item>
  <item-num>gift_wrap</item-num>
  <price>5.99</price>
  <tax><state>0.41</state></tax>
</item>

Coupon

You can include any number of "coupon" items to provide discounts to the shopper. The balance due will be decreased by the price and the tax. The tax field is optional.

<item>
  <item-num>coupon</item-num>
  <price>10.99</price>
  <tax><state>0.76</state></tax>
</item>

Gratuity

You can include any number of "gratuity" items to add gratuity to an order. The balance due will be increased by the price and the tax. The tax field is optional.

<item>
  <item-num>gratuity</item-num>
  <price>4.00</price>
  <tax><state>0.00</state></tax>
</item>

Tenders

1Cash
4Visa
5Mastercard
6Discover
8Amex
9Gift Certificate
21Paypal
22Google Checkout

Sources

0Reserved
1Walk In
2Telephone
3Internet
4Wine of the Month
5Reserved

Gift Cards

The purchase of gift cards is supported through the Vision Link API. There is no "item" in Vision or Vision Link to represent a gift card, so your application must create this on its own and make it available for a user to purchase. Gift card purchases can be mixed with items in a single order and you may submit multiple gift cards in a single API request much like multiple items can be sent in a single request. The amount the customer has paid for a gift card must be included in a tender the same way the payment for items is submitted. Before submitting a gift card, the Tasty application should be checked to ensure that the gift card code being used is not already in use in the point of sale database. Below is an example gift-card tag containing 3 gift cards in a single order:
  <gift-cards>
    <gift-card>
      <code>wf_aaa110</code>
      <balance>10.00</balance>
      <web-code>aaa110</web-code>
    </gift-card>
    <gift-card>
      <code>wf_aaa111</code>
      <balance>0.2</balance>
      <web-code>aaa111</web-code>
    </gift-card>
    <gift-card>
      <code>333</code>
      <balance>33.33</balance>
      <web-code>333</web-code>
    </gift-card>
  </gift-cards>

Refund Creation

Refunds can be issued for existing orders if needed. Submitting refunds is optional, but will help the merchant by consolidating their order reporting into the point of sale system. The web host must first process the refund and then optionally submit a refund to
/refunds
as described below.

Example

<refund>

  <api-version>1</api-version>
  <order-alt-num>order123</order-alt-num>
  <alt-num>refund123</alt-num>
  <notes>Please rush my return.</notes>
  <source>3</source>

  <items>
    <item>
      <item-num>61110</item-num>
      <price>9.99</price>
      <size>BOTTLE</size>
      <quantity>2</quantity>
      <tax-code>AAA</tax-code>
      <state-tax>0.2</state-tax>
      <county-tax>0.1</county-tax>
      <city-tax>0.05</city-tax>
    </item>
    <item>
      <item-num>61111</item-num>
      <price>9.99</price>
      <size>BOTTLE</size>
      <quantity>2</quantity>
      <tax-code>AAA</tax-code>
      <state-tax>0.2</state-tax>
      <county-tax>0.1</county-tax>
      <city-tax>0.05</city-tax>
    </item>
  </items>

  <tenders>
    <tender>
      <amount>10.25</amount>
      <tender-id>4</tender-id>
    </tender>
    <tender>
      <amount>10.0</amount>
      <tender-id>3</tender-id>
    </tender>
  </tenders>

</refund>


Tags

TagDescription
api-versionThis is required so that future updates to the api do not disrupt legacy clients. Set this to "1" for now.
order-alt-numThis is the value of the alt-num for the order that corresponds to this refund.
alt-numrefund number in web system
sourceThe source ID of the refund. See the "Sources" section which contains valid values for this field. If additional granularity is required, the Vision merchant can add customized source IDs to their point of sale system which you can then submit in this field.
notestext about this refund, typically coming from customer and directed at merchant
 
itemsgrouping of all line items in the refund
items/itemgrouping of one line item in the refund
items/item/item-numthe item number in the Vision system
items/item/sizesubmit either BOTTLE or CASE. BOTTLE is used by default if nothing is submitted
items/item/quantitythe number of either BOTTLES or CASES in this order. "1" is used by default if nothing is submitted
items/item/pricethe total refund value of all products in this line item (e.g. "50.00" if refunding two $25 bottles)
items/item/taxthe total tax refunded on all products in this line item
items/item/tax-codecode identifying unique combination of state, county and tax jurisdictions (must match Vision tax code)
items/item/state-taxtax refunded for the state of this jurisdictions for the whole order
items/item/tax/county-taxtax refunded for the county of this jurisdictions for the whole order
items/item/tax/city-taxtax refunded for the city of this jurisdictions for the whole order
 
tendersgrouping of all tenders in the refund
tenders/tendergrouping of one tender in the refund
tenders/tender/amountthe dollar value of the tender
tenders/tender/tender-idthe tender id from the Vision system

sh/curl Sample Implementation

#!/bin/sh
LOGIN=admin123
API_PASS=4076686adcfeff4b6cfbd548b686a3dedd86eaaa
echo '<order><api-version>1</api-version><items><item><item-num>00812</item-num></item></items></order>' > in.xml
curl -s -X POST -v -u $LOGIN:$API_PASS -d @in.xml https://vznlink.com/orders
    

perl/LWP Sample Implementation

#!/usr/bin/perl

use LWP;
# also need Crypt::SSLeay for https

# this info was emailed to you
my $login='admin123';
my $api_key='4076686adcfeff4b6cfbd548b686a3dedd86eaaa';

my $host = "vznlink.com";
my $port = 443;
my $url = "https://${host}:${port}";

my $browser = LWP::UserAgent->new;
# configure "HTTP Basic" authentication with the realm "vznlink"
$browser->credentials( "${host}:$port", "vznlink", $login, $api_key );
# express preference for XML type
my $headers = HTTP::Headers->new( 'Accept' => 'application/xml' );

# your XML content will vary according to your needs
my $content = q{<order><api-version>1</api-version>
<items><item><item-num>00812</item-num></item></items></order>};

# send HTTP POST to "/orders" with XML as body
my $request = HTTP::Request->new( 'POST', $url."/orders", $headers, $content);
my $response = $browser->request($request);
die "Can't create order by posting to $url -- ", $response->status_line
    unless $response->code == 201;
my $order_url = $response->header('location');
print "created order $order_url\n";