Introduction (JS API v2)

The UltraCart Javascript API v2.0 was retired at version 2.1. It is in maintenance mode only. If you are using v2 of the JSAPI, please consider migrating to the REST Checkout API, which is actively supported.

Please visit the Developer Tools section of secure.ultracart.com for more information.

New Features

The difference between v1 and v2 of the JS API can be likened to the difference between the C Programming Language and the C++ Programming Language. Version 1 of the JS API was a set of remote calls that could be strung together in a procedural fashion. Version 2 is an object oriented approach designed to do the heavy lifting behind the scenes and result minimal code needed to use the API.

New Features:

  • Auto bind address fields for easy updating
  • Events for cart changes to allow on demand rendering (the examples shows how easy this is)
  • Shipping Methods now have a default flag and shipping tax (if applicable).

Not Supported/In the Works

  • Item Options
  • Gift Certificates
  • Currency Codes/Foreign Currencies
  • Affiliate IDs
  • Customer Profiles
  • Preorder (and ETAs)

Requirements

jQuery 1.4.2+
jQuery json plugin 2.2+

Browser Support

For support, we looked at any browser version with significant market share.

Browser

Version

Comments

Firefox

3.5-4.0

 

Chrome

10-11

Internet Explorer

6-9

version 6 is twitchy.

Safari

5

 

Opera

11

 

Installation

  • proxy script
  • javascript files
  • template
Proxy Script

UltraCart has written a php script that can be installed on your local web server and relays remote calls to our API server. This file is critical to work around cross domain limitations. Simply put, your web pages, originating from your web server, cannot make javascript ajax calls to the UltraCart server. The proxy script sits on your server and relays the calls. Once installed, getting the remote calls work is easy. The v1.1 docs have some more detail.

Download the script at https://github.com/UltraCart/legacy_javascript/blob/master/example/proxy.php
If your site is being hosted by a third party, chances are everything is already configured for use. The only php requirement is to have curl enabled, but it's our experience that most hosting companies have that enabled by default.

Install the php file in your root directory for simplicity. If you put it elsewhere, just remember to adjust your settings in the js file (only one line changes).

Javascript Files

The github example has links to download the jQuery files needed. Or you may download them from the links above.

Template

The github example has links to download the template files as well. The base template is a stripped down page designed to look like the single page checkout with minimal mark up allowing for complete customization. Unlike the single page checkout, which is table based, the template relies on div tags for nearly all layout. This makes custom rearrangements easy.

Tutorials