checkout
/checkout
The checkout API provides all the necessary functionality to implement custom checkouts with UltraCart.
/checkout
The checkout API provides all the necessary functionality to implement custom checkouts with UltraCart.
To make working with our API easier, we package an SDK in the languages listed to the right. Select the language that you are interested in and sample code with additional commentary will be available. All of our APIs are available on GitHub at:
http://www.github.com/UltraCart/
By using an SDK you receive a number of important benefits.
There are four steps to instantiating the API.
The checkout REST API has the capability to expand everything related to the cart. By default, when you read
a cart, a limited object is returned. If you specify the _expand
parameter, additional properties of the cart
object are returned. We encourage you to limit the amount of information that you query for carts
to the minimal amount possible to have optimal communication. The following expansion operations are
available.
Register an affiliate click. Used by custom checkouts that are completely API based and do not perform checkout handoff.
SDK Function Name: registerAffiliateClick
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
register_affiliate_click_request | Register affiliate click request | body | RegisterAffiliateClickRequest | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class RegisterAffiliateClick
{
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Records an affiliate click.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
RegisterAffiliateClickRequest clickRequest = new RegisterAffiliateClickRequest();
// Note: In C#, you'll need to get these values from your HttpContext
// This is a simplified example - implement proper request handling in your application
string ipAddress = "127.0.0.1"; // Replace with actual implementation to get IP
string userAgent = ""; // Replace with actual implementation to get user agent
string refererUrl = ""; // Replace with actual implementation to get referer URL
clickRequest.IpAddress = ipAddress;
clickRequest.UserAgent = userAgent;
clickRequest.ReferrerUrl = refererUrl;
clickRequest.Affid = 123456789; // you should know this from your UltraCart affiliate system.
clickRequest.Subid = "TODO:SupplyThisValue";
// clickRequest.LandingPageUrl = null; // if you have landing page url.
RegisterAffiliateClickResponse apiResponse = checkoutApi.RegisterAffiliateClick(clickRequest);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(apiResponse, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.RegisterAffiliateClickRequest;
import com.ultracart.admin.v2.models.RegisterAffiliateClickResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class RegisterAffiliateClick {
public static void execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Records an affiliate click.
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
RegisterAffiliateClickRequest clickRequest = new RegisterAffiliateClickRequest();
// Note: In Java, you'll need to get these values from your HttpContext
// This is a simplified example - implement proper request handling in your application
String ipAddress = "127.0.0.1"; // Replace with actual implementation to get IP
String userAgent = ""; // Replace with actual implementation to get user agent
String refererUrl = ""; // Replace with actual implementation to get referer URL
clickRequest.setIpAddress(ipAddress);
clickRequest.setUserAgent(userAgent);
clickRequest.setReferrerUrl(refererUrl);
clickRequest.setAffid(123456789); // you should know this from your UltraCart affiliate system.
clickRequest.setSubid("TODO:SupplyThisValue");
// clickRequest.setLandingPageUrl(null); // if you have landing page url.
try {
RegisterAffiliateClickResponse apiResponse = checkoutApi.registerAffiliateClick(clickRequest, null);
System.out.println(apiResponse.toString());
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import {checkoutApi} from '../api.js';
export class RegisterAffiliateClick {
/**
* Records an affiliate click.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
static async execute() {
try {
// Note: In TypeScript, you'll need to get these values from your request context
// This is a simplified example - implement proper request handling in your application
const ipAddress = "127.0.0.1"; // Replace with actual implementation to get IP
const userAgent = ""; // Replace with actual implementation to get user agent
const refererUrl = ""; // Replace with actual implementation to get referer URL
const clickRequest = {
ip_address: ipAddress,
user_agent: userAgent,
referrer_url: refererUrl,
affid: 123456789, // you should know this from your UltraCart affiliate system
subid: "TODO:SupplyThisValue",
// landingPageUrl: undefined, // if you have landing page url
};
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.registerAffiliateClick(clickRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
console.log(JSON.stringify(apiResponse, null, 2));
} catch (error) {
console.error("Error registering affiliate click:", error);
}
}
}
<?php /** @noinspection DuplicatedCode */
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Records an affiliate click.
use ultracart\v2\models\RegisterAffiliateClickRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$clickRequest = new RegisterAffiliateClickRequest();
$clickRequest->setIpAddress($_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR']);
$clickRequest->setUserAgent($_SERVER['HTTP_USER_AGENT'] ?? '');
$clickRequest->setReferrerUrl($_SERVER['HTTP_REFERER'] ?? '');
$clickRequest->setAffid(123456789); // you should know this from your UltraCart affiliate system.
$clickRequest->setSubid('TODO:SupplyThisValue');
// $clickRequest->setLandingPageUrl(null); // if you have landing page url.
$api_response = $checkout_api->registerAffiliateClick($clickRequest);
var_dump($api_response);
from flask import request
from ultracart.apis import CheckoutApi
from ultracart.models import RegisterAffiliateClickRequest
from samples import api_client
# Initialize the checkout API
checkout_api = CheckoutApi(api_client())
# Create affiliate click request
click_request = RegisterAffiliateClickRequest(
ip_address=request.headers.get('X-Forwarded-For', request.remote_addr),
user_agent=request.headers.get('User-Agent', ''),
referrer_url=request.referrer or '',
affid=123456789, # you should know this from your UltraCart affiliate system
subid='TODO:SupplyThisValue'
# landing_page_url=None # if you have landing page url
)
# Register the affiliate click
api_response = checkout_api.register_affiliate_click(click_request)
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Records an affiliate click.
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
click_request = UltracartClient::RegisterAffiliateClickRequest.new
click_request.ip_address = ENV['HTTP_X_FORWARDED_FOR'] || ENV['REMOTE_ADDR']
click_request.user_agent = ENV['HTTP_USER_AGENT'] || ''
click_request.referrer_url = ENV['HTTP_REFERER'] || ''
click_request.affid = 123_456_789 # You should know this from your UltraCart affiliate system.
click_request.subid = 'TODO:SupplyThisValue'
# click_request.landing_page_url = nil # If you have a landing page URL.
api_response = checkout_api.register_affiliate_click(click_request)
puts api_response.inspect
import {checkoutApi} from '../api';
import {
RegisterAffiliateClickRequest,
RegisterAffiliateClickResponse
} from 'ultracart_rest_api_v2_typescript';
export class RegisterAffiliateClick {
/**
* Records an affiliate click.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static async execute(): Promise<void> {
try {
// Note: In TypeScript, you'll need to get these values from your request context
// This is a simplified example - implement proper request handling in your application
const ipAddress = "127.0.0.1"; // Replace with actual implementation to get IP
const userAgent = ""; // Replace with actual implementation to get user agent
const refererUrl = ""; // Replace with actual implementation to get referer URL
const clickRequest: RegisterAffiliateClickRequest = {
ip_address: ipAddress,
user_agent: userAgent,
referrer_url: refererUrl,
affid: 123456789, // you should know this from your UltraCart affiliate system
subid: "TODO:SupplyThisValue",
// landingPageUrl: undefined, // if you have landing page url
};
const apiResponse: RegisterAffiliateClickResponse = await checkoutApi.registerAffiliateClick({registerAffiliateClickRequest: clickRequest});
console.log(JSON.stringify(apiResponse, null, 2));
} catch (error) {
console.error("Error registering affiliate click:", error);
}
}
}
Lookup the allowed countries for this merchant id
SDK Function Name: getAllowedCountries
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using Newtonsoft.Json;
namespace SdkSample.checkout
{
public class GetAllowedCountries
{
/// <summary>
/// A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
CheckoutAllowedCountriesResponse apiResponse = checkoutApi.GetAllowedCountries();
List<Country> allowedCountries = apiResponse.Countries;
foreach (Country country in allowedCountries)
{
Console.WriteLine(JsonConvert.SerializeObject(country, new JsonSerializerSettings { Formatting = Formatting.Indented}));
}
}
}
}
package checkout;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.CheckoutAllowedCountriesResponse;
import com.ultracart.admin.v2.models.Country;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.util.List;
public class GetAllowedCountries {
/**
* Populates the country list with all countries the merchant has configured to accept
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
try {
CheckoutAllowedCountriesResponse apiResponse = checkoutApi.getAllowedCountries();
List<Country> allowedCountries = apiResponse.getCountries();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
for (Country country : allowedCountries) {
System.out.println(gson.toJson(country));
}
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
export class GetAllowedCountries {
/// <summary>
/// A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
/// </summary>
static async Execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
try {
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getAllowedCountries(function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const allowedCountries = apiResponse.countries || [];
allowedCountries.forEach(country => {
console.log(JSON.stringify(country, null, 2));
});
} catch (error) {
console.error('Error retrieving allowed countries:', error);
}
}
}
<?php /** @noinspection DuplicatedCode */
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
require_once '../vendor/autoload.php';
require_once '../constants.php';
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$api_response = $checkout_api->getAllowedCountries();
$allowed_countries = $api_response->getCountries();
foreach ($allowed_countries as $country) {
var_dump($country); // contains both iso2code and name
}
from ultracart.apis import CheckoutApi
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
checkout_api = CheckoutApi(api_client())
api_response = checkout_api.get_allowed_countries()
allowed_countries = api_response.countries
for country in allowed_countries:
print(country) # contains both iso2code and name
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
require 'ultracart_api'
require_relative '../constants'
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
api_response = checkout_api.get_allowed_countries
allowed_countries = api_response.countries
allowed_countries.each do |country|
puts country.inspect # contains both iso2code and name
end
import { checkoutApi } from '../api';
import {
CheckoutAllowedCountriesResponse,
Country
} from 'ultracart_rest_api_v2_typescript';
export class GetAllowedCountries {
/// <summary>
/// A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
/// </summary>
public static async Execute(): Promise<void> {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
try {
const apiResponse: CheckoutAllowedCountriesResponse = await checkoutApi.getAllowedCountries();
const allowedCountries: Country[] = apiResponse.countries || [];
allowedCountries.forEach(country => {
console.log(JSON.stringify(country, null, 2));
});
} catch (error) {
console.error('Error retrieving allowed countries:', error);
}
}
}
Setup a browser key authenticated application with checkout permissions. This REST call must be made with an authentication scheme that is not browser key. The new application will be linked to the application that makes this call. If this application is disabled / deleted, then so will the application setup by this call. The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
SDK Function Name: setupBrowserKey
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
browser_key_request | Setup browser key request | body | CheckoutSetupBrowserKeyRequest | required |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class SetupBrowserKey
{
public static void Execute()
{
/*
This is a checkout api method. It creates a browser key for use in a client side checkout. This call must be
made server side with a Simple API Key or an OAuth access_token.
*/
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
CheckoutSetupBrowserKeyRequest keyRequest = new CheckoutSetupBrowserKeyRequest();
keyRequest.AllowedReferrers = new List<string> { "https://www.mywebsite.com" };
string browserKey = checkoutApi.SetupBrowserKey(keyRequest).BrowserKey;
Console.WriteLine("<html lang=\"en\"><body><pre>");
Console.WriteLine(browserKey);
Console.WriteLine("</pre></body></html>");
}
}
}
package checkout;
import java.util.Collections;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class SetupBrowserKey {
public static void execute() {
/*
This is a checkout api method. It creates a browser key for use in a client side checkout. This call must be
made server side with a Simple API Key or an OAuth access_token.
*/
try {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
CheckoutSetupBrowserKeyRequest keyRequest = new CheckoutSetupBrowserKeyRequest();
keyRequest.setAllowedReferrers(Collections.singletonList("https://www.mywebsite.com"));
String browserKey = checkoutApi.setupBrowserKey(keyRequest).getBrowserKey();
System.out.println("<html lang=\"en\"><body><pre>");
System.out.println(browserKey);
System.out.println("</pre></body></html>");
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import {checkoutApi} from '../api.js';
export class SetupBrowserKey {
/**
* Creates a browser key for use in a client-side checkout.
*
* This call must be made server-side with a Simple API Key or an OAuth access token.
*/
static async execute() {
try {
// Prepare the browser key request
const keyRequest = {
allowed_referrers: ["https://www.mywebsite.com"]
};
// Setup the browser key
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.setupBrowserKey(keyRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const browserKey = apiResponse.browser_key || "";
// Output the browser key
console.log(browserKey);
} catch (error) {
console.error("Error setting up browser key:", error);
}
}
}
<?php
/*
This is a checkout api method. It creates a browser key for use in a client side checkout. This call must be
made server side with a Simple API Key or an OAuth access_token.
*/
use ultracart\v2\api\CheckoutApi;
use ultracart\v2\models\CheckoutSetupBrowserKeyRequest;
require_once '../vendor/autoload.php';
$checkout_api = CheckoutApi::usingApiKey(Constants::API_KEY);
$keyRequest = new CheckoutSetupBrowserKeyRequest();
$keyRequest->setAllowedReferrers(["https://www.mywebsite.com"]);
$browser_key = $checkout_api->setupBrowserKey($keyRequest)->getBrowserKey();
echo '<html lang="en"><body><pre>';
var_dump($browser_key);
echo '</pre></body></html>';
from ultracart.apis import CheckoutApi
from ultracart.models import CheckoutSetupBrowserKeyRequest
from samples import api_client
# Initialize the checkout API
checkout_api = CheckoutApi(api_client())
# Create browser key request
key_request = CheckoutSetupBrowserKeyRequest(allowed_referrers=["https://www.mywebsite.com"])
# Get browser key
browser_key = checkout_api.setup_browser_key(key_request).browser_key
require 'ultracart_api'
require_relative '../constants'
# This is a checkout API method. It creates a browser key for use in a client-side checkout.
# This call must be made server-side with a Simple API Key or an OAuth access token.
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
key_request = UltracartClient::CheckoutSetupBrowserKeyRequest.new
key_request.allowed_referrers = ["https://www.mywebsite.com"]
browser_key = checkout_api.setup_browser_key(key_request).browser_key
puts browser_key.inspect
import {checkoutApi} from '../api';
import {
CheckoutSetupBrowserKeyRequest,
CheckoutSetupBrowserKeyResponse
} from 'ultracart_rest_api_v2_typescript';
export class SetupBrowserKey {
/**
* Creates a browser key for use in a client-side checkout.
*
* This call must be made server-side with a Simple API Key or an OAuth access token.
*/
public static async execute(): Promise<void> {
try {
// Prepare the browser key request
const keyRequest: CheckoutSetupBrowserKeyRequest = {
allowed_referrers: ["https://www.mywebsite.com"]
};
// Setup the browser key
const apiResponse: CheckoutSetupBrowserKeyResponse = await checkoutApi.setupBrowserKey({browserKeyRequest: keyRequest});
const browserKey: string = apiResponse.browser_key || "";
// Output the browser key
console.log(browserKey);
} catch (error) {
console.error("Error setting up browser key:", error);
}
}
}
If the cookie is set on the browser making the request then it will return their active cart. Otherwise it will create a new cart.
SDK Function Name: getCart
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
UltraCartShoppingCartID | Cart ID passed as a cookie (primary tracking method) | cookie | string | optional |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Web;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using RestSharp;
namespace SdkSample.checkout
{
public class GetCart
{
/// <summary>
/// Retrieves a cart either by creating a new one or getting an existing one by cart ID
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
string expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
string cartId = null; // no cart id yet. GetCart will return a new cart.
CartResponse apiResponse = checkoutApi.GetCart(expansion);
Cart cart = apiResponse.Cart;
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
HttpCookie cookie = new HttpCookie(Constants.CartIdCookieName);
cookie.Value = cart.CartId;
cookie.Expires = DateTime.Now.AddDays(14); // 1209600 seconds = 14 days
cookie.Path = "/";
// HttpContext.Current.Response.Cookies.Add(cookie);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(cart, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class GetCart {
/**
* Retrieves a cart either by creating a new one or getting an existing one by cart ID
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
* depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
* carts, getCartByCartId($cart_id) is used.
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
try {
String cartId = null; // no cart id yet. GetCart will return a new cart.
CartResponse apiResponse = checkoutApi.getCart(expansion);
Cart cart = apiResponse.getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// Note: In Java, cookie handling is framework-specific. The following is a conceptual representation.
// HttpCookie cookie = new HttpCookie(Constants.CART_ID_COOKIE_NAME);
// cookie.setValue(cart.getCartId());
// cookie.setMaxAge(1209600); // 1209600 seconds = 14 days
// cookie.setPath("/");
// HttpContext.getCurrentResponse().addCookie(cookie);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(cart));
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
import { DateTime } from 'luxon';
export class GetCart {
/// <summary>
/// Retrieves a cart either by creating a new one or getting an existing one by cart ID
/// </summary>
static async Execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
const expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
try {
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand: expansion}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const cart = apiResponse.cart;
if (!cart || !cart.cart_id) {
throw new Error('No cart retrieved');
}
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// In TypeScript/browser environment, this would typically be handled using document.cookie or browser storage APIs
this.setCookie(
"UltraCartShoppingCartID",
cart.cart_id,
DateTime.now().plus({days: 14}).toJSDate()
);
console.log(JSON.stringify(cart, null, 2));
} catch (error) {
console.error('Error retrieving cart:', error);
}
}
/// <summary>
/// Sets a cookie with the given name, value, and expiration
/// </summary>
static setCookie(name, value, expires) {
const cookieValue = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; expires=${expires.toUTCString()}; path=/`;
document.cookie = cookieValue;
}
}
<?php /** @noinspection DuplicatedCode */
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
$cart_id = null;
if(isset($_COOKIE[Constants::CART_ID_COOKIE_NAME])){
$cart_id = $_COOKIE[Constants::CART_ID_COOKIE_NAME];
}
$cart = null;
if(is_null($cart_id)){
$api_response = $checkout_api->getCart($expansion);
} else {
$api_response = $checkout_api->getCartByCartId($cart_id, $expansion);
}
$cart = $api_response->getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
setcookie(Constants::CART_ID_COOKIE_NAME, $cart->getCartId(), time() + 1209600, "/");
echo '<html lang="en"><body><pre>';
var_dump($cart);
echo '</pre></body></html>';
from ultracart.apis import CheckoutApi
from samples import api_client
from flask import request, make_response
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
# depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
# carts, getCartByCartId(cart_id) is used.
checkout_api = CheckoutApi(api_client())
expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
"""
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
"""
inside_web_context = False
try:
cart_id = request.cookies.get("UltraCartShoppingCartID")
inside_web_context = True
except Exception as e:
# Log the error if needed
print(f"Error getting cart ID: {e}")
# Set a default value or handle the error situation
cart_id = None
# Execution continues from here
if cart_id is None:
api_response = checkout_api.get_cart(expand=expand)
else:
api_response = checkout_api.get_cart_by_cart_id(cart_id, expand=expand)
cart = api_response.cart
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
if inside_web_context:
response = make_response(str(cart))
response.set_cookie("UltraCartShoppingCartID", cart.cart_id, max_age=1209600, path="/")
print(cart)
# frozen_string_literal: true
require 'json'
require 'yaml'
require 'ultracart_api'
require_relative '../constants'
api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
# this example is the same for both get_cart.rb and get_cart_by_id.rb. They work as a pair and are called
# depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
# carts, getCartByCartId(cart_id) is used.
expansion = 'items' # for this example, we're just getting a cart to insert some items into it.
# do you have the cart id from a cookie or some other server side state engine?
cart_id = nil
# run this example once to get a cart id, then you can add it here to test.
# the cart id below will not work for you.
# cart_id = 'C6A8693A3C78C6017FDA7A50EE380100'
api_response = if cart_id.nil?
api.get_cart({ '_expand': expansion })
else
api.get_cart_by_cart_id(cart_id, { '_expand': expansion })
end
cart = api_response.cart
puts cart.to_yaml
import {checkoutApi} from '../api';
import {
Cart,
CartResponse
} from 'ultracart_rest_api_v2_typescript';
import {DateTime} from 'luxon';
export class GetCart {
/// <summary>
/// Retrieves a cart either by creating a new one or getting an existing one by cart ID
/// </summary>
public static async Execute(): Promise<void> {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
const expansion: string = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
try {
const apiResponse: CartResponse = await checkoutApi.getCart({expand: expansion});
const cart: Cart | undefined = apiResponse.cart;
if (!cart || !cart.cart_id) {
throw new Error('No cart retrieved');
}
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// In TypeScript/browser environment, this would typically be handled using document.cookie or browser storage APIs
this.setCookie(
"UltraCartShoppingCartID",
cart.cart_id,
DateTime.now().plus({days: 14}).toJSDate()
);
console.log(JSON.stringify(cart, null, 2));
} catch (error) {
console.error('Error retrieving cart:', error);
}
}
/// <summary>
/// Sets a cookie with the given name, value, and expiration
/// </summary>
private static setCookie(name: string, value: string, expires: Date): void {
const cookieValue = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; expires=${expires.toUTCString()}; path=/`;
document.cookie = cookieValue;
}
}
Update the cart.
SDK Function Name: updateCart
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
cart | Cart | body | Cart | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class UpdateCart
{
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example uses the getCart.php code as a starting point, because we must get a cart to update a cart.
// getCart.php code start ----------------------------------------------------------------------------
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId(cart_id) is used.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
string expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
// In C# web applications, you'd retrieve the cookie from the HttpContext
string cartId = null;
// Example of how you might retrieve a cookie in ASP.NET:
// if (HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME] != null)
// {
// cartId = HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME].Value;
// }
Cart cart = null;
if (cartId == null)
{
CartResponse apiResponse = checkoutApi.GetCart(expansion);
cart = apiResponse.Cart;
}
else
{
CartResponse apiResponse = checkoutApi.GetCartByCartId(cartId, expansion);
cart = apiResponse.Cart;
}
// getCart.php code end ----------------------------------------------------------------------------
// for this simple example, items will be added to the cart. so our expansion variable is simply 'items' above.
// Get the items array on the cart, creating it if it doesn't exist.
List<CartItem> items = cart.Items;
// If null, go ahead and initialize it to an empty list
if (items == null)
{
items = new List<CartItem>();
}
// Create a new item
CartItem item = new CartItem();
item.ItemId = "BASEBALL"; // TODO: Adjust the item id
item.Quantity = 1; // TODO: Adjust the quantity
// TODO: If your item has options then you need to create a new CartItemOption object and add it to the list.
List<CartItemOption> options = new List<CartItemOption>();
item.Options = options;
// Add the item to the items list
items.Add(item);
// Make sure to update the cart with the new list
cart.Items = items;
// Push the cart up to save the item
CartResponse cartResponse = checkoutApi.UpdateCart(cart, expansion);
// Extract the updated cart from the response
cart = cartResponse.Cart;
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// Example of how you might set a cookie in ASP.NET:
// HttpCookie cookie = new HttpCookie(Constants.CART_ID_COOKIE_NAME);
// cookie.Value = cart.CartId;
// cookie.Expires = DateTime.Now.AddDays(14); // 2 weeks
// cookie.Path = "/";
// HttpContext.Current.Response.Cookies.Add(cookie);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(cart, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.Cart;
import com.ultracart.admin.v2.models.CartItem;
import com.ultracart.admin.v2.models.CartItemOption;
import com.ultracart.admin.v2.models.CartResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class UpdateCart {
public static void execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example uses the getCart method as a starting point, because we must get a cart to update a cart.
// this example is the same for both getCart and getCartByCartId. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used.
// For existing carts, getCartByCartId(cart_id) is used.
try {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
// In Java web applications, you'd retrieve the cookie from the HttpServletRequest
String cartId = null;
// Example of how you might retrieve a cookie in a Servlet:
// Cookie[] cookies = request.getCookies();
// if (cookies != null) {
// for (Cookie cookie : cookies) {
// if (Constants.CART_ID_COOKIE_NAME.equals(cookie.getName())) {
// cartId = cookie.getValue();
// break;
// }
// }
// }
Cart cart;
if (cartId == null) {
CartResponse apiResponse = checkoutApi.getCart(expansion);
cart = apiResponse.getCart();
} else {
CartResponse apiResponse = checkoutApi.getCartByCartId(cartId, expansion);
cart = apiResponse.getCart();
}
// for this simple example, items will be added to the cart. so our expansion variable is simply 'items' above.
// Get the items array on the cart, creating it if it doesn't exist.
List<CartItem> items = cart.getItems();
// If null, go ahead and initialize it to an empty list
if (items == null) {
items = new ArrayList<>();
}
// Create a new item
CartItem item = new CartItem();
item.setItemId("BASEBALL"); // TODO: Adjust the item id
item.setQuantity(BigDecimal.valueOf(1)); // TODO: Adjust the quantity
// TODO: If your item has options then you need to create a new CartItemOption object and add it to the list.
List<CartItemOption> options = new ArrayList<>();
item.setOptions(options);
// Add the item to the items list
items.add(item);
// Make sure to update the cart with the new list
cart.setItems(items);
// Push the cart up to save the item
CartResponse cartResponse = checkoutApi.updateCart(cart, expansion);
// Extract the updated cart from the response
cart = cartResponse.getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// Example of how you might set a cookie in a Servlet:
// Cookie cookie = new Cookie(Constants.CART_ID_COOKIE_NAME, cart.getCartId());
// cookie.setMaxAge(14 * 24 * 60 * 60); // 2 weeks in seconds
// cookie.setPath("/");
// response.addCookie(cookie);
System.out.println(cart.toString());
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
import { DateTime } from 'luxon';
/**
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example uses the getCart.php code as a starting point, because we must get a cart to update a cart.
* This example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
* depending on the presence of an existing cart id or not. For new carts, getCart() is used.
* For existing carts, getCartByCartId(cart_id) is used.
*/
export class UpdateCart {
static async execute() {
// For this example, we're just getting a cart to insert some items into it.
const expand = "items";
// In web applications, you'd retrieve the cookie from the browser context
let cartId = undefined;
// Example of how you might retrieve a cookie in a web application:
// cartId = document.cookie.split('; ').find(row => row.startsWith('UltraCartShoppingCartID='))?.split('=')[1];
let cart;
if (cartId === undefined) {
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = apiResponse.cart;
} else {
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByCartId(cartId, {_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = apiResponse.cart;
}
// Get the items array on the cart, creating it if it doesn't exist
let items = cart?.items ?? [];
// Create a new item
const item = {
item_id: "BASEBALL", // TODO: Adjust the item id
quantity: 1, // TODO: Adjust the quantity
// TODO: If your item has options then you need to create a new CartItemOption object and add it to the list.
options: []
};
// Add the item to the items list
items.push(item);
// Make sure to update the cart with the new list
if (cart) {
cart.items = items;
// Push the cart up to save the item
const cartResponse = await new Promise((resolve, reject) => {
checkoutApi.updateCart(cart, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Extract the updated cart from the response
cart = cartResponse.cart;
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Example of how you might set a cookie in a web application:
// document.cookie = `UltraCartShoppingCartID=${cart.cartId}; expires=${new Date(Date.now() + 14 * 24 * 60 * 60 * 1000).toUTCString()}; path=/`;
// In a real-world scenario, you might want to log or handle the updated cart
console.log(JSON.stringify(cart, null, 2));
}
}
}
<?php /** @noinspection DuplicatedCode */
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example uses the getCart.php code as a starting point, because we must get a cart to update a cart.
// getCart.php code start ----------------------------------------------------------------------------
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
$cart_id = null;
if(isset($_COOKIE[Constants::CART_ID_COOKIE_NAME])){
$cart_id = $_COOKIE[Constants::CART_ID_COOKIE_NAME];
}
$cart = null;
if(is_null($cart_id)){
$api_response = $checkout_api->getCart($expansion);
} else {
$api_response = $checkout_api->getCartByCartId($cart_id, $expansion);
}
$cart = $api_response->getCart();
// getCart.php code end ----------------------------------------------------------------------------
// for this simple example, items will be added to the cart. so our expansion variable is simply 'items' above.
// Get the items array on the cart, creating it if it doesn't exist.
$items = $cart->getItems();
// If null, go ahead and initialize it to an empty array
if ($items == null) {
$items = array();
}
// Create a new item
$item = new ultracart\v2\models\CartItem();
$item->setItemId("BASEBALL"); // TODO: Adjust the item id
$item->setQuantity(1); // TODO: Adjust the quantity
// TODO: If your item has options then you need to create a new ultracart\v2\models\CartItemOption object and push it into the array.
$options = array();
$item->setOptions($options);
// Add the item to the $items array
array_push($items, $item);
// Make sure to update the $cart with the new array
$cart->setItems($items);
// Push the cart up to save the item
$cart_response = $checkout_api->updateCart($cart, $expansion);
// Extract the updated cart from the response
$cart = $cart_response->getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
setcookie(Constants::CART_ID_COOKIE_NAME, $cart->getCartId(), time() + 1209600, "/");
echo '<html lang="en"><body><pre>';
var_dump($cart);
echo '</pre></body></html>';
from flask import request
from ultracart.apis import CheckoutApi
from ultracart.models import CartItem
from samples import api_client
# Initialize the checkout API
checkout_api = CheckoutApi(api_client())
# Set expansion to retrieve items
expand = "items"
# Check for existing cart ID in cookies
# cart_id = request.cookies.get("UltraCartShoppingCartID")
cart_id = '48E2F76C5BD1BB0196476FAACF800100'
# Get cart based on whether we have an existing cart ID
inside_web_context = False
if cart_id is None:
api_response = checkout_api.get_cart(expand=expand)
inside_web_context = True
else:
api_response = checkout_api.get_cart_by_cart_id(cart_id, expand=expand)
cart = api_response.cart
# Get items array from cart, initialize if needed
items = cart.items or []
# Create new item
item = CartItem(
item_id="BASEBALL", # TODO: Adjust the item id
quantity=1.0, # TODO: Adjust the quantity
options=[] # TODO: If item has options, create CartItemOption objects and add to this list
)
# Add item to items array
items.append(item)
# Update cart with new items
cart.items = items
# Save updated cart
cart_response = checkout_api.update_cart(cart, expand=expand)
cart = cart_response.cart
# if inside_web_context:
# # Create response with updated cart
# response = {'cart': cart}
#
# # Set cookie for cart ID - Using Flask's response object
# @app.after_request
# def add_cart_cookie(response):
# response.set_cookie(
# "UltraCartShoppingCartID",
# cart.cart_id,
# max_age=1209600, # Two weeks in seconds
# path="/"
# )
# return response
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
expansion = 'items' # For this example, we're just getting a cart to insert some items into it.
cart_id = nil
cart_id = ENV['HTTP_COOKIE'].to_s[/#{Constants::CART_ID_COOKIE_NAME}=([^;]+)/, 1] if ENV['HTTP_COOKIE']
cart = if cart_id.nil?
checkout_api.get_cart({_expand: expansion}).cart
else
checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
end
# Get the items array on the cart, creating it if it doesn't exist.
items = cart.items || []
# Create a new item
item = UltracartClient::CartItem.new
item.item_id = 'BASEBALL' # TODO: Adjust the item id
item.quantity = 1 # TODO: Adjust the quantity
# TODO: If your item has options, then you need to create a new UltracartClient::CartItemOption object and push it into the array.
options = []
item.options = options
# Add the item to the items array
items << item
# Update the cart with the new items
cart.items = items
# Push the cart up to save the item
cart_response = checkout_api.update_cart(cart, {_expand: expansion})
# Extract the updated cart from the response
cart = cart_response.cart
# TODO: Set or reset the cart cookie if this is part of a multi-page process. Two weeks is a generous cart ID time.
puts "Set-Cookie: #{Constants::CART_ID_COOKIE_NAME}=#{cart.cart_id}; Path=/; Max-Age=1209600"
puts cart.inspect
import {checkoutApi} from '../api';
import {DateTime} from 'luxon';
import {
Cart,
CartResponse,
CartItem,
CartItemOption
} from 'ultracart_rest_api_v2_typescript';
/**
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example uses the getCart.php code as a starting point, because we must get a cart to update a cart.
* This example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
* depending on the presence of an existing cart id or not. For new carts, getCart() is used.
* For existing carts, getCartByCartId(cart_id) is used.
*/
export class UpdateCart {
public static async execute(): Promise<void> {
// For this example, we're just getting a cart to insert some items into it.
const expand = "items";
// In TypeScript web applications, you'd retrieve the cookie from the browser context
let cartId: string | undefined = undefined;
// Example of how you might retrieve a cookie in a web application:
// cartId = document.cookie.split('; ').find(row => row.startsWith('UltraCartShoppingCartID='))?.split('=')[1];
let cart: Cart | undefined;
if (cartId === undefined) {
const apiResponse: CartResponse = await checkoutApi.getCart({expand});
cart = apiResponse.cart;
} else {
const apiResponse: CartResponse = await checkoutApi.getCartByCartId({cartId, expand});
cart = apiResponse.cart;
}
// Get the items array on the cart, creating it if it doesn't exist
let items: CartItem[] = cart?.items ?? [];
// Create a new item
const item: CartItem = {
item_id: "BASEBALL", // TODO: Adjust the item id
quantity: 1, // TODO: Adjust the quantity
// TODO: If your item has options then you need to create a new CartItemOption object and add it to the list.
options: []
};
// Add the item to the items list
items.push(item);
// Make sure to update the cart with the new list
if (cart) {
cart.items = items;
// Push the cart up to save the item
const cartResponse: CartResponse = await checkoutApi.updateCart({cart, expand});
// Extract the updated cart from the response
cart = cartResponse.cart;
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Example of how you might set a cookie in a web application:
// document.cookie = `UltraCartShoppingCartID=${cart.cartId}; expires=${new Date(Date.now() + 14 * 24 * 60 * 60 * 1000).toUTCString()}; path=/`;
// In a real-world scenario, you might want to log or handle the updated cart
console.log(JSON.stringify(cart, null, 2));
}
}
}
Finalize the cart into an order. This method can not be called with browser key authentication. It is ONLY meant for server side code to call.
SDK Function Name: finalizeOrder
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
finalize_request | Finalize request | body | CartFinalizeOrderRequest | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class FinalizeOrder
{
/// <summary>
/// Finalizes an order from a cart
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Note: You probably should NOT be using this method. Use handoffCart() instead.
// This method is a server-side only (no browser key allowed) method for turning a cart into an order.
// It exists for merchants who wish to provide their own upsells, but again, a warning, using this method
// will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
// Still, some merchants need this functionality, so here it is. If you're unsure, you don't need it. Use handoff.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
String cartId = "123456789123456789123456789123456789"; // get the cart id from session or cookie. beyond this sample scope.
CartResponse cartResponse = checkoutApi.GetCartByCartId(cartId, expansion);
Cart cart = cartResponse.Cart;
// TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
CartFinalizeOrderRequest finalizeRequest = new CartFinalizeOrderRequest();
finalizeRequest.Cart = cart;
CartFinalizeOrderRequestOptions finalizeOptions = new CartFinalizeOrderRequestOptions(); // Lots of options here. Contact support if you're unsure what you need.
finalizeRequest.Options = finalizeOptions;
CartFinalizeOrderResponse orderResponse = checkoutApi.FinalizeOrder(finalizeRequest);
// orderResponse.Successful;
// orderResponse.Errors;
// orderResponse.OrderId;
// orderResponse.Order;
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(orderResponse, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class FinalizeOrder {
/**
* Finalizes an order from a cart
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* Note: You probably should NOT be using this method. Use handoffCart() instead.
* This method is a server-side only (no browser key allowed) method for turning a cart into an order.
* It exists for merchants who wish to provide their own upsells, but using this method
* will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// Possible Expansion Variables documented at https://www.ultracart.com/api/#resource_checkout.html
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
String cartId = "123456789123456789123456789123456789"; // get the cart id from session or cookie
try {
CartResponse cartResponse = checkoutApi.getCartByCartId(cartId, expansion);
Cart cart = cartResponse.getCart();
// TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
CartFinalizeOrderRequest finalizeRequest = new CartFinalizeOrderRequest();
finalizeRequest.cart(cart);
CartFinalizeOrderRequestOptions finalizeOptions = new CartFinalizeOrderRequestOptions();
finalizeRequest.options(finalizeOptions);
CartFinalizeOrderResponse orderResponse = checkoutApi.finalizeOrder(finalizeRequest);
// orderResponse.isSuccessful();
// orderResponse.getErrors();
// orderResponse.getOrderId();
// orderResponse.getOrder();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(orderResponse));
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
export class FinalizeOrder {
/// <summary>
/// Finalizes an order from a cart
/// </summary>
static async Execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Note: You probably should NOT be using this method. Use handoffCart() instead.
// This method is a server-side only (no browser key allowed) method for turning a cart into an order.
// It exists for merchants who wish to provide their own upsells, but again, a warning, using this method
// will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
// Still, some merchants need this functionality, so here it is. If you're unsure, you don't need it. Use handoff.
const expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
const cartId = "123456789123456789123456789123456789"; // get the cart id from session or cookie. beyond this sample scope.
try {
const cartResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByCartId(cartId, {_expand: expansion}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const cart = cartResponse.cart;
// TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
if (!cart) {
throw new Error('Cart not found');
}
const finalizeRequest = {
cart: cart,
options: {} // Lots of options here. Contact support if you're unsure what you need.
};
const orderResponse = await new Promise((resolve, reject) => {
checkoutApi.finalizeOrder(finalizeRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// orderResponse.successful;
// orderResponse.errors;
// orderResponse.orderId;
// orderResponse.order;
console.log(JSON.stringify(orderResponse, null, 2));
} catch (error) {
console.error('Error finalizing order:', error);
}
}
}
<?php /** @noinspection DuplicatedCode */
use ultracart\v2\models\CartFinalizeOrderRequest;
use ultracart\v2\models\CartFinalizeOrderRequestOptions;
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Note: You probably should NOT be using this method. Use handoffCart() instead.
// This method is a server-side only (no browser key allowed) method for turning a cart into an order.
// It exists for merchants who wish to provide their own upsells, but again, a warning, using this method
// will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
// Still, some merchants need this functionality, so here it is. If you're unsure, you don't need it. Use handoff.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
$cart_id = null;
if(isset($_COOKIE[Constants::CART_ID_COOKIE_NAME])){
$cart_id = $_COOKIE[Constants::CART_ID_COOKIE_NAME];
}
$cart = null;
if(is_null($cart_id)){
$api_response = $checkout_api->getCart($expansion);
} else {
$api_response = $checkout_api->getCartByCartId($cart_id, $expansion);
}
$cart = $api_response->getCart();
// TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
$finalizeRequest = new CartFinalizeOrderRequest();
$finalizeRequest->setCart($cart);
$finalizeOptions = new CartFinalizeOrderRequestOptions(); // Lots of options here. Contact support if you're unsure what you need.
$finalizeRequest->setOptions($finalizeOptions);
$api_response = $checkout_api->finalizeOrder($finalizeRequest);
// $api_response->getSuccessful();
// $api_response->getErrors();
// $api_response->getOrderId();
// $api_response->getOrder();
echo '<html lang="en"><body><pre>';
var_dump($api_response);
echo '</pre></body></html>';
from ultracart.apis import CheckoutApi
from ultracart.models import CartFinalizeOrderRequest, CartFinalizeOrderRequestOptions
from samples import api_client
from flask import request, redirect
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Note: You probably should NOT be using this method. Use handoffCart() instead.
# This method is a server-side only (no browser key allowed) method for turning a cart into an order.
# It exists for merchants who wish to provide their own upsells, but again, a warning, using this method
# will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
# Still, some merchants need this functionality, so here it is. If you're unsure, you don't need it. Use handoff.
checkout_api = CheckoutApi(api_client())
expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
"""
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
"""
# Assuming you have a function to get cookies in your Python framework
cart_id = request.cookies.get('UltraCartShoppingCartID') # Replace with your actual cookie handling
if cart_id is None:
api_response = checkout_api.get_cart(expand=expand)
else:
api_response = checkout_api.get_cart_by_cart_id(cart_id, expand=expand)
cart = api_response.cart
# TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
finalize_request = CartFinalizeOrderRequest()
finalize_request.cart = cart
finalize_options = CartFinalizeOrderRequestOptions() # Lots of options here. Contact support if you're unsure what you need.
finalize_request.options = finalize_options
api_response = checkout_api.finalize_order(finalize_request)
# Available properties:
# api_response.successful
# api_response.errors
# api_response.order_id
# api_response.order
print(api_response)
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Note: You probably should NOT be using this method. Use handoff_cart() instead.
# This method is a server-side only (no browser key allowed) method for turning a cart into an order.
# It exists for merchants who wish to provide their own upsells, but again, a warning, using this method
# will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
# Still, some merchants need this functionality, so here it is. If you're unsure, you don't need it. Use handoff.
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
# affiliate checkout customer_profile
# billing coupons gift
# gift_certificate items.attributes items.multimedia
# items items.multimedia.thumbnails items.physical
# marketing payment settings.gift
# settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
# settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
# settings.terms shipping taxes
# summary upsell_after
cart_id = nil
cart_id = cookies[Constants::CART_ID_COOKIE_NAME] if cookies[Constants::CART_ID_COOKIE_NAME]
cart = nil
if cart_id.nil?
api_response = checkout_api.get_cart(_expand: expansion)
else
api_response = checkout_api.get_cart_by_cart_id(cart_id, _expand: expansion)
end
cart = api_response.cart
# TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
finalize_request = UltracartClient::CartFinalizeOrderRequest.new
finalize_request.cart = cart
finalize_options = UltracartClient::CartFinalizeOrderRequestOptions.new # Lots of options here. Contact support if you're unsure what you need.
finalize_request.options = finalize_options
api_response = checkout_api.finalize_order(finalize_request)
# api_response.successful
# api_response.errors
# api_response.order_id
# api_response.order
puts api_response.inspect
import {checkoutApi} from '../api';
import {
Cart,
CartResponse,
CartFinalizeOrderRequest,
CartFinalizeOrderResponse
} from 'ultracart_rest_api_v2_typescript';
export class FinalizeOrder {
/// <summary>
/// Finalizes an order from a cart
/// </summary>
public static async Execute(): Promise<void> {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Note: You probably should NOT be using this method. Use handoffCart() instead.
// This method is a server-side only (no browser key allowed) method for turning a cart into an order.
// It exists for merchants who wish to provide their own upsells, but again, a warning, using this method
// will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
// Still, some merchants need this functionality, so here it is. If you're unsure, you don't need it. Use handoff.
const expansion: string = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
const cartId: string = "123456789123456789123456789123456789"; // get the cart id from session or cookie. beyond this sample scope.
try {
const cartResponse: CartResponse = await checkoutApi.getCartByCartId({cartId, expand: expansion});
const cart: Cart | undefined = cartResponse.cart;
// TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
if (!cart) {
throw new Error('Cart not found');
}
const finalizeRequest: CartFinalizeOrderRequest = {
cart: cart,
options: {} // Lots of options here. Contact support if you're unsure what you need.
};
const orderResponse: CartFinalizeOrderResponse = await checkoutApi.finalizeOrder({finalizeRequest});
// orderResponse.successful;
// orderResponse.errors;
// orderResponse.orderId;
// orderResponse.order;
console.log(JSON.stringify(orderResponse, null, 2));
} catch (error) {
console.error('Error finalizing order:', error);
}
}
}
Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
SDK Function Name: handoffCart
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
handoff_request | Handoff request | body | CheckoutHandoffRequest | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Web;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class HandoffCart
{
/// <summary>
/// Hands off a cart to the UltraCart engine for further processing
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example uses the getCart.php code as a starting point, because we must get a cart to handoff a cart.
// here, we are handing off the cart to the ultracart engine with an operation of 'view', meaning that we
// simply added some items to the cart and wish for UltraCart to gather the remaining customer information
// as part of a normal checkout operation.
// valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
// Besides "view", the other operations are finalizers.
// "checkout": finalize the transaction using a customer's personal credit card (traditional checkout)
// "paypal": finalize the transaction by sending the customer to PayPal
// getCart.php code start ----------------------------------------------------------------------------
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
String cartId = null;
// get the cartId from session or cookie.
// if (HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME] != null)
// {
// cartId = HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME].Value;
// }
Cart cart = null;
CartResponse apiResponse;
if (cartId == null)
{
apiResponse = checkoutApi.GetCart(expansion);
}
else
{
apiResponse = checkoutApi.GetCartByCartId(cartId, expansion);
}
cart = apiResponse.Cart;
// getCart.php code end ----------------------------------------------------------------------------
// Although the above code checks for a cookie and retrieves or creates a cart based on the cookie presence, typically
// a php script calling the handoff() method will have an existing cart, so you may wish to check for a cookie and
// redirect if there isn't one. However, it is possible that you wish to create a cart, update it, and hand it off
// to UltraCart all within one script, so we've left the conditional cart creation calls intact.
CheckoutHandoffRequest handoffRequest = new CheckoutHandoffRequest();
handoffRequest.Cart = cart;
handoffRequest.Operation = CheckoutHandoffRequest.OperationEnum.View;
handoffRequest.ErrorReturnUrl = "/some/page/on/this/php/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart.php";
handoffRequest.ErrorParameterName = "uc_error"; // name this whatever the script supplied in ->setErrorReturnUrl() will check for in the $_GET object.
handoffRequest.SecureHostName = "mystorefront.com"; // set to desired storefront. some merchants have multiple storefronts.
CheckoutHandoffResponse handoffResponse = checkoutApi.HandoffCart(handoffRequest, expansion);
if (handoffResponse.Errors != null && handoffResponse.Errors.Count > 0)
{
// TODO: handle errors that might happen before handoff and manage those
}
else
{
String redirectUrl = handoffResponse.RedirectToUrl;
Console.WriteLine(redirectUrl);
// Issue the redirect to the customer.
// HttpContext.Current.Response.Redirect(redirectUrl);
}
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.Cart;
import com.ultracart.admin.v2.models.CartResponse;
import com.ultracart.admin.v2.models.CheckoutHandoffRequest;
import com.ultracart.admin.v2.models.CheckoutHandoffResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class HandoffCart {
/**
* Hands off a cart to the UltraCart engine for further processing
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static void execute() throws ApiException {
// this example uses the getCart method as a starting point, because we must get a cart to handoff a cart.
// here, we are handing off the cart to the ultracart engine with an operation of 'view', meaning that we
// simply added some items to the cart and wish for UltraCart to gather the remaining customer information
// as part of a normal checkout operation.
// valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
// Besides "view", the other operations are finalizers.
// "checkout": finalize the transaction using a customer's personal credit card (traditional checkout)
// "paypal": finalize the transaction by sending the customer to PayPal
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
String cartId = null;
// get the cartId from session or cookie.
// if (HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME] != null)
// {
// cartId = HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME].Value;
// }
Cart cart;
CartResponse apiResponse;
if (cartId == null) {
apiResponse = checkoutApi.getCart(expansion);
} else {
apiResponse = checkoutApi.getCartByCartId(cartId, expansion);
}
cart = apiResponse.getCart();
// Although the above code checks for a cookie and retrieves or creates a cart based on the cookie presence, typically
// a php script calling the handoff() method will have an existing cart, so you may wish to check for a cookie and
// redirect if there isn't one. However, it is possible that you wish to create a cart, update it, and hand it off
// to UltraCart all within one script, so we've left the conditional cart creation calls intact.
CheckoutHandoffRequest handoffRequest = new CheckoutHandoffRequest();
handoffRequest.setCart(cart);
handoffRequest.setOperation(CheckoutHandoffRequest.OperationEnum.VIEW);
handoffRequest.setErrorReturnUrl("/some/page/on/this/php/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart.php");
handoffRequest.setErrorParameterName("uc_error"); // name this whatever the script supplied in ->setErrorReturnUrl() will check for in the $_GET object.
handoffRequest.setSecureHostName("mystorefront.com"); // set to desired storefront. some merchants have multiple storefronts.
CheckoutHandoffResponse handoffResponse = checkoutApi.handoffCart(handoffRequest, expansion);
if (handoffResponse.getErrors() != null && !handoffResponse.getErrors().isEmpty()) {
// TODO: handle errors that might happen before handoff and manage those
} else {
String redirectUrl = handoffResponse.getRedirectToUrl();
System.out.println(redirectUrl);
// Issue the redirect to the customer.
// HttpContext.Current.Response.Redirect(redirectUrl);
}
}
}
import { checkoutApi } from '../api.js';
/// <summary>
/// Hands off a cart to the UltraCart engine for further processing
/// </summary>
export class HandoffCart {
/// <summary>
/// Hands off a cart to the UltraCart engine for further processing
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
///
/// This example uses the getCart code as a starting point, because we must get a cart to handoff a cart.
/// Here, we are handing off the cart to the ultracart engine with an operation of 'view', meaning that we
/// simply added some items to the cart and wish for UltraCart to gather the remaining customer information
/// as part of a normal checkout operation.
///
/// Valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
/// Besides "view", the other operations are finalizers.
/// "checkout": finalize the transaction using a customer's personal credit card (traditional checkout)
/// "paypal": finalize the transaction by sending the customer to PayPal
/// </summary>
static async execute() {
try {
// expand parameter to include items in the cart
const expand = "items";
// Get cart ID from cookie (commented out in original code)
// In a real application, you'd replace this with your actual cookie/session management
const cartId = undefined;
// Retrieve cart - either by existing cart ID or create a new one
let cart;
let apiResponse;
if (!cartId) {
apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
} else {
apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByCartId(cartId, {_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
}
cart = apiResponse.cart;
// Prepare handoff request
const handoffRequest = {
cart: cart,
operation: "View",
error_return_url: "/some/page/on/this/php/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart.php",
error_parameter_name: "uc_error", // name this whatever the script supplied in ->setErrorReturnUrl() will check for in the $_GET object.
secure_host_name: "mystorefront.com" // set to desired storefront. some merchants have multiple storefronts.
};
// Perform cart handoff
const handoffResponse = await new Promise((resolve, reject) => {
checkoutApi.handoffCart(handoffRequest, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Handle response
if (handoffResponse.errors && handoffResponse.errors.length > 0) {
// TODO: handle errors that might happen before handoff and manage those
console.error("Errors during cart handoff:", handoffResponse.errors);
} else {
const redirectUrl = handoffResponse.redirect_to_url;
console.log(redirectUrl);
// In a web application, you would typically redirect the user
// This could be done via window.location.href or a routing mechanism
// window.location.href = redirectUrl;
}
} catch (error) {
console.error("Error during cart handoff:", error);
}
}
}
// Optional: If you want to call the method
// HandoffCart.execute().catch(console.error);
<?php /** @noinspection DuplicatedCode */
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example uses the getCart.php code as a starting point, because we must get a cart to handoff a cart.
// here, we are handing off the cart to the ultracart engine with an operation of 'view', meaning that we
// simply added some items to the cart and wish for UltraCart to gather the remaining customer information
// as part of a normal checkout operation.
// valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
// Besides "view", the other operations are finalizers.
// "checkout": finalize the transaction using a customer's personal credit card (traditional checkout)
// "paypal": finalize the transaction by sending the customer to PayPal
// getCart.php code start ----------------------------------------------------------------------------
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
$cart_id = null;
if(isset($_COOKIE[Constants::CART_ID_COOKIE_NAME])){
$cart_id = $_COOKIE[Constants::CART_ID_COOKIE_NAME];
}
$cart = null;
if(is_null($cart_id)){
$api_response = $checkout_api->getCart($expansion);
} else {
$api_response = $checkout_api->getCartByCartId($cart_id, $expansion);
}
$cart = $api_response->getCart();
// getCart.php code end ----------------------------------------------------------------------------
// Although the above code checks for a cookie and retrieves or creates a cart based on the cookie presence, typically
// a php script calling the handoff() method will have an existing cart, so you may wish to check for a cookie and
// redirect if there isn't one. However, it is possible that you wish to create a cart, update it, and hand it off
// to UltraCart all within one script, so we've left the conditional cart creation calls intact.
$handoff_request = new \ultracart\v2\models\CheckoutHandoffRequest();
$handoff_request->setCart($cart);
$handoff_request->setOperation("view");
$handoff_request->setErrorReturnUrl("/some/page/on/this/php/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart.php");
$handoff_request->setErrorParameterName("uc_error"); // name this whatever the script supplied in ->setErrorReturnUrl() will check for in the $_GET object.
$handoff_request->setSecureHostName("mystorefront.com"); // set to desired storefront. some merchants have multiple storefronts.
$api_response = $checkout_api->handoffCart($handoff_request, $expansion);
if(!is_null($api_response->getErrors()) && !empty($api_response->getErrors())){
// TODO: handle errors that might happen before handoff and manage those
} else {
$redirect_url = $api_response->getRedirectToUrl();
header('Location: '. $redirect_url);
}
from flask import request, redirect
from ultracart.apis import CheckoutApi
from ultracart.models import CheckoutHandoffRequest
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# This example uses the getCart code as a starting point, because we must get a cart to handoff a cart.
# Here, we are handing off the cart to the ultracart engine with an operation of 'view', meaning that we
# simply added some items to the cart and wish for UltraCart to gather the remaining customer information
# as part of a normal checkout operation.
# Valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
# Besides "view", the other operations are finalizers.
# "checkout": finalize the transaction using a customer's personal credit card (traditional checkout)
# "paypal": finalize the transaction by sending the customer to PayPal
checkout_api = CheckoutApi(api_client())
expand = "items" # for this example, we're just getting a cart to insert some items into it.
cart_id = request.cookies.get('UltraCartShoppingCartID')
if cart_id is None:
api_response = checkout_api.get_cart(expand=expand)
else:
api_response = checkout_api.get_cart_by_cart_id(cart_id, expand=expand)
cart = api_response.cart
handoff_request = CheckoutHandoffRequest()
handoff_request.cart = cart
handoff_request.operation = "view"
handoff_request.error_return_url = "/some/page/on/this/python/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart"
handoff_request.error_parameter_name = "uc_error" # name this whatever the script supplied in error_return_url will check for in request.args
handoff_request.secure_host_name = "mystorefront.com" # set to desired storefront. some merchants have multiple storefronts
api_response = checkout_api.handoff_cart(handoff_request, expand=expand)
if api_response.errors:
# TODO: handle errors that might happen before handoff and manage those
pass
else:
redirect_url = api_response.redirect_to_url
# return redirect(redirect_url)
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# This example uses the get_cart.rb code as a starting point because we must get a cart to hand off a cart.
# Here, we are handing off the cart to the UltraCart engine with an operation of 'view', meaning that we
# simply added some items to the cart and wish for UltraCart to gather the remaining customer information
# as part of a normal checkout operation.
# Valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
# Besides "view", the other operations are finalizers.
# "checkout": Finalize the transaction using a customer's personal credit card (traditional checkout)
# "paypal": Finalize the transaction by sending the customer to PayPal
# get_cart.rb code start ----------------------------------------------------------------------------
# This example is the same for both get_cart.rb and get_cart_by_cart_id.rb. They work as a pair and are called
# depending on the presence of an existing cart ID or not. For new carts, get_cart() is used. For existing
# carts, get_cart_by_cart_id(cart_id) is used.
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
expansion = "items" # For this example, we're just getting a cart to insert some items into it.
cart_id = nil
cart_id = ENV['HTTP_COOKIE'].scan(/UltraCartShoppingCartID=([^;]+)/).flatten.first if ENV['HTTP_COOKIE']
cart = nil
if cart_id.nil?
api_response = checkout_api.get_cart(expansion: expansion)
else
api_response = checkout_api.get_cart_by_cart_id(cart_id, expansion: expansion)
end
cart = api_response.cart
# get_cart.rb code end ----------------------------------------------------------------------------
# Although the above code checks for a cookie and retrieves or creates a cart based on the cookie presence, typically
# a Ruby script calling the handoff() method will have an existing cart, so you may wish to check for a cookie and
# redirect if there isn't one. However, it is possible that you wish to create a cart, update it, and hand it off
# to UltraCart all within one script, so we've left the conditional cart creation calls intact.
handoff_request = UltracartClient::CheckoutHandoffRequest.new
handoff_request.cart = cart
handoff_request.operation = "view"
handoff_request.error_return_url = "/some/page/on/this/ruby/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart.rb"
handoff_request.error_parameter_name = "uc_error" # Name this whatever the script supplied in ->setErrorReturnUrl() will check for in the params.
handoff_request.secure_host_name = "mystorefront.com" # Set to desired storefront. Some merchants have multiple storefronts.
api_response = checkout_api.handoff_cart(handoff_request, { '_expand' => expansion })
if !api_response.errors.nil? && !api_response.errors.empty?
# TODO: Handle errors that might happen before handoff and manage those
else
redirect_url = api_response.redirect_to_url
puts "Location: #{redirect_url}\n\n"
end
import { checkoutApi } from '../api';
import {
Cart,
CartResponse,
CheckoutHandoffRequest, CheckoutHandoffRequestOperationEnum,
CheckoutHandoffResponse
} from 'ultracart_rest_api_v2_typescript';
/// <summary>
/// Hands off a cart to the UltraCart engine for further processing
/// </summary>
export class HandoffCart {
/// <summary>
/// Hands off a cart to the UltraCart engine for further processing
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
///
/// This example uses the getCart code as a starting point, because we must get a cart to handoff a cart.
/// Here, we are handing off the cart to the ultracart engine with an operation of 'view', meaning that we
/// simply added some items to the cart and wish for UltraCart to gather the remaining customer information
/// as part of a normal checkout operation.
///
/// Valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
/// Besides "view", the other operations are finalizers.
/// "checkout": finalize the transaction using a customer's personal credit card (traditional checkout)
/// "paypal": finalize the transaction by sending the customer to PayPal
/// </summary>
public static async execute(): Promise<void> {
try {
// expand parameter to include items in the cart
const expand = "items";
// Get cart ID from cookie (commented out in original code)
// In a real application, you'd replace this with your actual cookie/session management
const cartId: string | undefined = undefined;
// Retrieve cart - either by existing cart ID or create a new one
let cart: Cart | undefined;
let apiResponse: CartResponse;
if (!cartId) {
apiResponse = await checkoutApi.getCart({expand});
} else {
apiResponse = await checkoutApi.getCartByCartId({cartId, expand});
}
cart = apiResponse.cart;
// Prepare handoff request
const handoffRequest: CheckoutHandoffRequest = {
cart: cart,
operation: CheckoutHandoffRequestOperationEnum.View,
error_return_url: "/some/page/on/this/php/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart.php",
error_parameter_name: "uc_error", // name this whatever the script supplied in ->setErrorReturnUrl() will check for in the $_GET object.
secure_host_name: "mystorefront.com" // set to desired storefront. some merchants have multiple storefronts.
};
// Perform cart handoff
const handoffResponse: CheckoutHandoffResponse = await checkoutApi.handoffCart({handoffRequest, expand: expand});
// Handle response
if (handoffResponse.errors && handoffResponse.errors.length > 0) {
// TODO: handle errors that might happen before handoff and manage those
console.error("Errors during cart handoff:", handoffResponse.errors);
} else {
const redirectUrl = handoffResponse.redirect_to_url;
console.log(redirectUrl);
// In a web application, you would typically redirect the user
// This could be done via window.location.href or a routing mechanism
// window.location.href = redirectUrl;
}
} catch (error) {
console.error("Error during cart handoff:", error);
}
}
}
// Optional: If you want to call the method
// HandoffCart.execute().catch(console.error);
Login in to the customer profile specified by cart.billing.email and password
SDK Function Name: login
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
login_request | Login request | body | CartProfileLoginRequest | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Linq;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class Login
{
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// This example logs a user into the UltraCart system.
// This example assumes you already have a shopping cart object created.
// For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
// Note: customer_profile is a required expansion for login to work properly
string expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
Cart cart = checkoutApi.GetCart(expansion).Cart;
string email = "test@test.com"; // collect this from user.
string password = "ABC123"; // collect this from user.
cart.Billing = new CartBilling();
cart.Billing.Email = email;
CartProfileLoginRequest loginRequest = new CartProfileLoginRequest();
loginRequest.Cart = cart; // will look for billing.email
loginRequest.Password = password;
CartProfileLoginResponse apiResponse = checkoutApi.Login(loginRequest);
// Store the updated cart variable.
cart = apiResponse.Cart;
if (apiResponse.Errors?.Any() == true)
{
// notify customer login failed.
}
else
{
// proceed with successful login.
}
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.Cart;
import com.ultracart.admin.v2.models.CartBilling;
import com.ultracart.admin.v2.models.CartProfileLoginRequest;
import com.ultracart.admin.v2.models.CartProfileLoginResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class Login {
/**
* Logs a user into the UltraCart system
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static void execute() throws ApiException {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// Note: customer_profile is a required expansion for login to work properly
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
Cart cart = checkoutApi.getCart(expansion).getCart();
String email = "test@test.com"; // collect this from user.
String password = "ABC123"; // collect this from user.
cart.setBilling(new CartBilling());
cart.getBilling().setEmail(email);
CartProfileLoginRequest loginRequest = new CartProfileLoginRequest();
loginRequest.setCart(cart); // will look for billing.email
loginRequest.setPassword(password);
// TODO: Make your expand variable whatever you need to populate your cart.
CartProfileLoginResponse apiResponse = checkoutApi.login(loginRequest, null);
// Store the updated cart variable.
cart = apiResponse.getCart();
if (apiResponse.getErrors() != null && !apiResponse.getErrors().isEmpty()) {
// notify customer login failed.
} else {
// proceed with successful login.
}
}
}
import {checkoutApi} from '../api.js';
/// <summary>
/// Handles user login in the UltraCart system
/// </summary>
export class Login {
/// <summary>
/// Logs a user into the UltraCart system
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
///
/// This example assumes you already have a shopping cart object created.
/// For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
///
/// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
/// </summary>
static async execute() {
try {
// Note: customer_profile is a required expand for login to work properly
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Create a new cart
let cart = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
}).then(data => data.cart);
if (!cart) {
console.error("Could not get a cart from ultracart, cannot continue.");
return {success: false};
}
// Collect these from user input in a real application
const email = "test@test.com";
const password = "ABC123";
// Prepare billing information
cart.billing = {
email: email
};
// Prepare login request
const loginRequest = {
cart: cart, // will look for billing.email
password: password
};
// Perform login
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.login(loginRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Update cart with response
cart = apiResponse.cart;
// Check for errors
if (apiResponse.errors && apiResponse.errors.length > 0) {
console.error("Login failed:", apiResponse.errors);
return {success: false};
}
// Successful login
return {
success: true,
cart: cart
};
} catch (error) {
console.error("Error during login process:", error);
return {success: false};
}
}
}
// Optional: If you want to call the method
// Login.execute().then(result => {
// if (result.success) {
// console.log("Login successful", result.cart);
// } else {
// console.log("Login failed");
// }
// });
<?php /** @noinspection DuplicatedCode */
use ultracart\v2\models\CartBilling;
use ultracart\v2\models\CartProfileLoginRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// This example logs a user into the UltraCart system.
// This example assumes you already have a shopping cart object created.
// For new carts, getCart() is used. For existing carts, getCartByCartId($cart_id) is used.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
// Note: customer_profile is a required expansion for login to work properly
$expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
$cart = $checkout_api->getCart($expansion)->getCart();
$email = 'test@test.com'; // collect this from user.
$password = 'ABC123'; // collect this from user.
$cart->setBilling(new CartBilling());
$cart->getBilling()->setEmail($email);
$loginRequest = new CartProfileLoginRequest();
$loginRequest->setCart($cart); // will look for billing.email
$loginRequest->setPassword($password);
$api_response = $checkout_api->login($loginRequest);
$cart = $api_response->getCart();
if($api_response->getSuccess()){
// proceed with successful login.
} else {
// notify customer login failed.
}
from ultracart.apis import CheckoutApi
from ultracart.models import CartBilling, CartProfileLoginRequest
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# This example logs a user into the UltraCart system.
# This example assumes you already have a shopping cart object created.
# For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
checkout_api = CheckoutApi(api_client())
# Note: customer_profile is a required expansion for login to work properly
expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
# create a new cart (change this to an existing if you have one)
api_response = checkout_api.get_cart(expand=expand)
cart = api_response.cart
email = 'test@test.com' # collect this from user
password = 'ABC123' # collect this from user
cart.billing = CartBilling()
cart.billing.email = email
login_request = CartProfileLoginRequest()
login_request.cart = cart # will look for billing.email
login_request.password = password
api_response = checkout_api.login(login_request)
cart = api_response.cart
if api_response.success:
# proceed with successful login.
pass
else:
# notify customer login failed.
pass
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# This example logs a user into the UltraCart system.
# This example assumes you already have a shopping cart object created.
# For new carts, get_cart() is used. For existing carts, get_cart_by_cart_id(cart_id) is used.
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
# Note: customer_profile is a required expansion for login to work properly
expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
# Create a new cart (change this to an existing if you have one)
cart = checkout_api.get_cart(expansion: expansion).cart
email = 'test@test.com' # Collect this from user.
password = 'ABC123' # Collect this from user.
cart.billing = UltracartClient::CartBilling.new
cart.billing.email = email
login_request = UltracartClient::CartProfileLoginRequest.new
login_request.cart = cart # Will look for billing.email
login_request.password = password
api_response = checkout_api.login(login_request)
cart = api_response.cart
if api_response.success
# Proceed with successful login.
else
# Notify customer login failed.
end
import {checkoutApi} from '../api';
import {
Cart,
CartBilling,
CartProfileLoginRequest,
CartProfileLoginResponse
} from 'ultracart_rest_api_v2_typescript';
/// <summary>
/// Handles user login in the UltraCart system
/// </summary>
export class Login {
/// <summary>
/// Logs a user into the UltraCart system
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
///
/// This example assumes you already have a shopping cart object created.
/// For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
///
/// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
/// </summary>
public static async execute(): Promise<{ success: boolean, cart?: Cart }> {
try {
// Note: customer_profile is a required expand for login to work properly
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Create a new cart
let cart: Cart | undefined = (await checkoutApi.getCart({expand})).cart;
if (!cart) {
console.error("Could not get a cart from ultracart, cannot continue.");
return {success: false};
}
// Collect these from user input in a real application
const email = "test@test.com";
const password = "ABC123";
// Prepare billing information
cart.billing = {
email: email
};
// Prepare login request
const loginRequest: CartProfileLoginRequest = {
cart: cart, // will look for billing.email
password: password
};
// Perform login
const apiResponse: CartProfileLoginResponse = await checkoutApi.login({loginRequest});
// Update cart with response
cart = apiResponse.cart;
// Check for errors
if (apiResponse.errors && apiResponse.errors.length > 0) {
console.error("Login failed:", apiResponse.errors);
return {success: false};
}
// Successful login
return {
success: true,
cart: cart
};
} catch (error) {
console.error("Error during login process:", error);
return {success: false};
}
}
}
// Optional: If you want to call the method
// Login.execute().then(result => {
// if (result.success) {
// console.log("Login successful", result.cart);
// } else {
// console.log("Login failed");
// }
// });
Log the cart out of the current profile. No error will occur if they are not logged in.
SDK Function Name: logout
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
cart | Cart | body | Cart | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Linq;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class Logout
{
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// This example logs a user OUT of the UltraCart system.
// It assumes the shopping cart has already had a successful login.
// see login sdk_sample for logging in help.
// For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
// Note: customer_profile is a required expansion for login to work properly
string expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
Cart cart = checkoutApi.GetCart(expansion).Cart;
string email = "test@test.com"; // collect this from user.
string password = "ABC123"; // collect this from user.
cart.Billing = new CartBilling();
cart.Billing.Email = email;
CartProfileLoginRequest loginRequest = new CartProfileLoginRequest();
loginRequest.Cart = cart; // will look for billing.email
loginRequest.Password = password;
CartProfileLoginResponse apiResponse = checkoutApi.Login(loginRequest);
cart = apiResponse.Cart;
if (apiResponse.Errors?.Any() == true)
{
// notify customer login failed. Until they login, you can't logout.
}
else
{
checkoutApi.Logout(cart, expansion); // <-- Here is the logout call.
}
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.Cart;
import com.ultracart.admin.v2.models.CartBilling;
import com.ultracart.admin.v2.models.CartProfileLoginRequest;
import com.ultracart.admin.v2.models.CartProfileLoginResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class Logout {
/**
* Logs a user OUT of the UltraCart system
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static void execute() throws ApiException {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// Note: customer_profile is a required expansion for login to work properly
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
Cart cart = checkoutApi.getCart(expansion).getCart();
String email = "test@test.com"; // collect this from user.
String password = "ABC123"; // collect this from user.
cart.setBilling(new CartBilling());
cart.getBilling().setEmail(email);
CartProfileLoginRequest loginRequest = new CartProfileLoginRequest();
loginRequest.setCart(cart); // will look for billing.email
loginRequest.setPassword(password);
CartProfileLoginResponse apiResponse = checkoutApi.login(loginRequest, null);
cart = apiResponse.getCart();
if (apiResponse.getErrors() != null && !apiResponse.getErrors().isEmpty()) {
// notify customer login failed. Until they login, you can't logout.
} else {
checkoutApi.logout(cart, expansion); // <-- Here is the logout call.
}
}
}
import { checkoutApi } from '../api.js';
/// <summary>
/// Handles user logout in the UltraCart system
/// </summary>
export class Logout {
/// <summary>
/// Logs a user OUT of the UltraCart system
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
///
/// This example assumes the shopping cart has already had a successful login.
/// See login SDK sample for logging in help.
/// For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
///
/// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
/// </summary>
static async execute() {
try {
// Note: customer_profile is a required expand for login to work properly
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Create a new cart
let cart = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
}).then(data => data.cart);
if (!cart) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return {success: false};
}
// Collect these from user input in a real application
const email = "test@test.com";
const password = "ABC123";
// Prepare billing information
cart.billing = {
email: email
};
// Prepare login request
const loginRequest = {
cart: cart, // will look for billing.email
password: password
};
// Perform login
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.login(loginRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = apiResponse.cart;
// Check for login errors
if (apiResponse.errors && apiResponse.errors.length > 0) {
console.error("Login failed:", apiResponse.errors);
return { success: false };
}
if (!cart) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return {success: false};
}
// Perform logout
await new Promise((resolve, reject) => {
checkoutApi.logout(cart, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
return { success: true };
} catch (error) {
console.error("Error during logout process:", error);
return { success: false };
}
}
}
// Optional: If you want to call the method
// Logout.execute().then(result => {
// if (result.success) {
// console.log("Logout successful");
// } else {
// console.log("Logout failed");
// }
// });
<?php /** @noinspection DuplicatedCode */
use ultracart\v2\models\CartBilling;
use ultracart\v2\models\CartProfileLoginRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// This example logs a user OUT of the UltraCart system.
// It assumes the shopping cart has already had a successful login.
// see login sdk_sample for logging in help.
// For new carts, getCart() is used. For existing carts, getCartByCartId($cart_id) is used.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
// Note: customer_profile is a required expansion for login to work properly
$expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
$cart = $checkout_api->getCart($expansion)->getCart();
$email = 'test@test.com'; // collect this from user.
$password = 'ABC123'; // collect this from user.
$cart->setBilling(new CartBilling());
$cart->getBilling()->setEmail($email);
$loginRequest = new CartProfileLoginRequest();
$loginRequest->setCart($cart); // will look for billing.email
$loginRequest->setPassword($password);
$api_response = $checkout_api->login($loginRequest);
$cart = $api_response->getCart();
if($api_response->getSuccess()){
$checkout_api->logout($cart, $expansion); // <-- Here is the logout call.
} else {
// notify customer login failed. Until they login, you can't logout.
}
from ultracart.apis import CheckoutApi
from ultracart.models import CartBilling, CartProfileLoginRequest
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# This example logs a user OUT of the UltraCart system.
# It assumes the shopping cart has already had a successful login.
# see login sdk_sample for logging in help.
# For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
checkout_api = CheckoutApi(api_client())
# Note: customer_profile is a required expansion for login to work properly
expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
# create a new cart (change this to an existing if you have one)
api_response = checkout_api.get_cart(expand=expand)
cart = api_response.cart
email = 'test@test.com' # collect this from user
password = 'ABC123' # collect this from user
cart.billing = CartBilling()
cart.billing.email = email
login_request = CartProfileLoginRequest()
login_request.cart = cart # will look for billing.email
login_request.password = password
api_response = checkout_api.login(login_request)
cart = api_response.cart
if api_response.success:
checkout_api.logout(cart, expand=expand) # <-- Here is the logout call.
else:
# notify customer login failed. Until they login, you can't logout.
pass
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# This example logs a user OUT of the UltraCart system.
# It assumes the shopping cart has already had a successful login.
# See login sdk_sample for logging in help.
# For new carts, get_cart() is used. For existing carts, get_cart_by_cart_id(cart_id) is used.
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
# Note: customer_profile is a required expansion for login to work properly
expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
# Create a new cart (change this to an existing if you have one)
cart = checkout_api.get_cart(expansion: expansion).cart
email = 'test@test.com' # Collect this from user.
password = 'ABC123' # Collect this from user.
cart.billing = UltracartClient::CartBilling.new
cart.billing.email = email
login_request = UltracartClient::CartProfileLoginRequest.new
login_request.cart = cart # Will look for billing.email
login_request.password = password
api_response = checkout_api.login(login_request)
cart = api_response.cart
if api_response.success
checkout_api.logout(cart, { '_expand' => expansion }) # <-- Here is the logout call.
else
# Notify customer login failed. Until they log in, you can't log them out.
end
import { checkoutApi } from '../api';
import {
Cart,
CartProfileLoginRequest,
CartProfileLoginResponse
} from 'ultracart_rest_api_v2_typescript';
/// <summary>
/// Handles user logout in the UltraCart system
/// </summary>
export class Logout {
/// <summary>
/// Logs a user OUT of the UltraCart system
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
///
/// This example assumes the shopping cart has already had a successful login.
/// See login SDK sample for logging in help.
/// For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
///
/// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
/// </summary>
public static async execute(): Promise<{ success: boolean }> {
try {
// Note: customer_profile is a required expand for login to work properly
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Create a new cart
let cart: Cart|undefined = (await checkoutApi.getCart({expand})).cart;
if (!cart) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return {success: false};
}
// Collect these from user input in a real application
const email = "test@test.com";
const password = "ABC123";
// Prepare billing information
cart.billing = {
email: email
};
// Prepare login request
const loginRequest: CartProfileLoginRequest = {
cart: cart, // will look for billing.email
password: password
};
// Perform login
const apiResponse: CartProfileLoginResponse = await checkoutApi.login({loginRequest});
cart = apiResponse.cart;
// Check for login errors
if (apiResponse.errors && apiResponse.errors.length > 0) {
console.error("Login failed:", apiResponse.errors);
return { success: false };
}
if (!cart) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return {success: false};
}
// Perform logout
await checkoutApi.logout({cart, expand});
return { success: true };
} catch (error) {
console.error("Error during logout process:", error);
return { success: false };
}
}
}
// Optional: If you want to call the method
// Logout.execute().then(result => {
// if (result.success) {
// console.log("Logout successful");
// } else {
// console.log("Logout failed");
// }
// });
Register a new customer profile. Requires the cart.billing object to be populated along with the password.
SDK Function Name: register
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
register_request | Register request | body | CartProfileRegisterRequest | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Linq;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class Register
{
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Registers a user in your merchant system. This will create a customer profile.
// For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
// Note: customer_profile is a required expansion for login to work properly
string expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
Cart cart = checkoutApi.GetCart(expansion).Cart;
string email = "test@test.com"; // collect this from user.
string password = "ABC123"; // collect this from user.
cart.Billing = new CartBilling();
cart.Billing.Email = email; // this is the username.
CartProfileRegisterRequest registerRequest = new CartProfileRegisterRequest();
registerRequest.Cart = cart; // will look for billing.email
registerRequest.Password = password;
CartProfileRegisterResponse apiResponse = checkoutApi.Register(registerRequest);
cart = apiResponse.Cart; // Important! Get the cart from the response.
if (apiResponse.Errors?.Any() == true)
{
foreach (string error in apiResponse.Errors)
{
Console.WriteLine(error);
}
}
else
{
Console.WriteLine("Successfully registered new customer profile!");
}
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.Cart;
import com.ultracart.admin.v2.models.CartBilling;
import com.ultracart.admin.v2.models.CartProfileRegisterRequest;
import com.ultracart.admin.v2.models.CartProfileRegisterResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class Register {
/**
* Registers a user in your merchant system. This will create a customer profile.
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static void execute() throws ApiException {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// Note: customer_profile is a required expansion for login to work properly
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
Cart cart = checkoutApi.getCart(expansion).getCart();
String email = "test@test.com"; // collect this from user.
String password = "ABC123"; // collect this from user.
cart.setBilling(new CartBilling());
cart.getBilling().setEmail(email); // this is the username.
CartProfileRegisterRequest registerRequest = new CartProfileRegisterRequest();
registerRequest.setCart(cart); // will look for billing.email
registerRequest.setPassword(password);
CartProfileRegisterResponse apiResponse = checkoutApi.register(registerRequest, null);
cart = apiResponse.getCart(); // Important! Get the cart from the response.
if (apiResponse.getErrors() != null && !apiResponse.getErrors().isEmpty()) {
for (String error : apiResponse.getErrors()) {
System.out.println(error);
}
} else {
System.out.println("Successfully registered new customer profile!");
}
}
}
import {checkoutApi} from '../api.js';
export class Register {
/**
* Registers a user in your merchant system. This will create a customer profile.
* For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
static async execute() {
try {
// Note: customer_profile is a required expansion for login to work properly
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// create a new cart (change this to an existing if you have one)
const cartResponse = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const cart = cartResponse.cart;
if (!cart) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
const email = "test@test.com"; // collect this from user
const password = "ABC123"; // collect this from user
cart.billing = {
email: email // this is the username
};
const registerRequest = {
cart: cart, // will look for billing.email
password: password
};
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.register(registerRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const updatedCart = apiResponse.cart; // Important! Get the cart from the response
if (apiResponse.errors && apiResponse.errors.length > 0) {
apiResponse.errors.forEach(error => {
console.log(error);
});
} else {
console.log("Successfully registered new customer profile!");
}
} catch (error) {
console.error("Error during registration:", error);
}
}
}
<?php /** @noinspection DuplicatedCode */
use ultracart\v2\models\CartBilling;
use ultracart\v2\models\CartProfileRegisterRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Registers a user in your merchant system. This will create a customer profile.
// For new carts, getCart() is used. For existing carts, getCartByCartId($cart_id) is used.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
// Note: customer_profile is a required expansion for login to work properly
$expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
// create a new cart (change this to an existing if you have one)
$cart = $checkout_api->getCart($expansion)->getCart();
$email = 'test@test.com'; // collect this from user.
$password = 'ABC123'; // collect this from user.
$cart->setBilling(new CartBilling());
$cart->getBilling()->setEmail($email); // this is the username.
$registerRequest = new CartProfileRegisterRequest();
$registerRequest->setCart($cart); // will look for billing.email
$registerRequest->setPassword($password);
$api_response = $checkout_api->register($registerRequest);
$cart = $api_response->getCart(); // Important! Get the cart from the response.
if($api_response->getSuccess()){
echo 'Successfully registered new customer profile!<br>';
} else {
foreach ($api_response->getErrors() as $error) {
var_dump($error);
}
}
from ultracart.apis import CheckoutApi
from ultracart.models import CartBilling, CartProfileRegisterRequest
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Registers a user in your merchant system. This will create a customer profile.
# For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
checkout_api = CheckoutApi(api_client())
# Note: customer_profile is a required expansion for login to work properly
expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
# create a new cart (change this to an existing if you have one)
api_response = checkout_api.get_cart(expand=expand)
cart = api_response.cart
email = 'test@test.com' # collect this from user
password = 'ABC123' # collect this from user
cart.billing = CartBilling()
cart.billing.email = email # this is the username
register_request = CartProfileRegisterRequest()
register_request.cart = cart # will look for billing.email
register_request.password = password
api_response = checkout_api.register(register_request)
cart = api_response.cart # Important! Get the cart from the response.
if api_response.success:
print('Successfully registered new customer profile!')
else:
for error in api_response.errors:
print(error)
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Registers a user in your merchant system. This will create a customer profile.
# For new carts, get_cart() is used. For existing carts, get_cart_by_cart_id(cart_id) is used.
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
# Note: customer_profile is a required expansion for login to work properly
expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
# Create a new cart (change this to an existing if you have one)
cart = checkout_api.get_cart(expansion: expansion).cart
email = 'test@test.com' # Collect this from user.
password = 'ABC123' # Collect this from user.
cart.billing = UltracartClient::CartBilling.new
cart.billing.email = email # This is the username.
register_request = UltracartClient::CartProfileRegisterRequest.new
register_request.cart = cart # Will look for billing.email
register_request.password = password
api_response = checkout_api.register(register_request)
cart = api_response.cart # Important! Get the cart from the response.
if api_response.success
puts 'Successfully registered new customer profile!'
else
api_response.errors.each { |error| puts error.inspect }
end
import {checkoutApi} from '../api';
import {
CartBilling,
CartProfileRegisterRequest,
CartProfileRegisterResponse
} from 'ultracart_rest_api_v2_typescript';
export class Register {
/**
* Registers a user in your merchant system. This will create a customer profile.
* For new carts, getCart() is used. For existing carts, getCartByCartId(cart_id) is used.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static async execute(): Promise<void> {
try {
// Note: customer_profile is a required expansion for login to work properly
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// create a new cart (change this to an existing if you have one)
const cartResponse = await checkoutApi.getCart({expand});
const cart = cartResponse.cart;
if (!cart) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
const email = "test@test.com"; // collect this from user
const password = "ABC123"; // collect this from user
cart.billing = {
email: email // this is the username
} as CartBilling;
const registerRequest: CartProfileRegisterRequest = {
cart: cart, // will look for billing.email
password: password
};
const apiResponse: CartProfileRegisterResponse = await checkoutApi.register({registerRequest});
const updatedCart = apiResponse.cart; // Important! Get the cart from the response
if (apiResponse.errors && apiResponse.errors.length > 0) {
apiResponse.errors.forEach(error => {
console.log(error);
});
} else {
console.log("Successfully registered new customer profile!");
}
} catch (error) {
console.error("Error during registration:", error);
}
}
}
Validate the cart for errors. Specific checks can be passed and multiple validations can occur throughout your checkout flow.
SDK Function Name: validateCart
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
validation_request | Validation request | body | CartValidationRequest | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class ValidateCart
{
public static void Execute()
{
/*
This is a checkout api method. It can be used both server side or client side. This example is a server side
call using a Simple API Key. See the JavaScript sdk samples if you wish to see a browser key implementation.
validateCart passes a shopping cart to UltraCart for validation.
*/
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
string cartId = "123456789123456789123456789123456789"; // usually this would be retrieved from a session variable or cookie.
string expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html) also see getCart() example
Cart cart = checkoutApi.GetCartByCartId(cartId, expansion).Cart;
CartValidationRequest validationRequest = new CartValidationRequest();
validationRequest.Cart = cart;
// validationRequest.Checks = null; // leave this null for all validations
// Possible Checks
/*
All,Advertising Source Provided,Billing Address Provided,
Billing Destination Restriction,Billing Phone Numbers Provided,Billing State Abbreviation Valid,Billing Validate City State Zip,
Coupon Zip Code Restriction,Credit Card Shipping Method Conflict,Customer Profile Does Not Exist.,CVV2 Not Required,
Electronic Check Confirm Account Number,Email confirmed,Email provided if required,Gift Message Length,Item Quantity Valid,
Item Restrictions,Items Present,Merchant Specific Item Relationships,One per customer violations,Options Provided,
Payment Information Validate,Payment Method Provided,Payment Method Restriction,Pricing Tier Limits,Quantity requirements met,
Referral Code Provided,Shipping Address Provided,Shipping Destination Restriction,Shipping Method Provided,
Shipping Needs Recalculation,Shipping State Abbreviation Valid,Shipping Validate City State Zip,Special Instructions Length,
Tax County Specified,Valid Delivery Date,Valid Ship On Date,Auth Test Credit Card
*/
// This method also does an update in the process, so pass in a good expansion and grab the return cart variable.
CartValidationResponse apiResponse = checkoutApi.ValidateCart(validationRequest, expansion);
cart = apiResponse.Cart;
Console.WriteLine("<html lang=\"en\"><body><pre>");
Console.WriteLine("Validation Errors:");
if (apiResponse.Errors != null)
{
foreach (string error in apiResponse.Errors)
{
Console.WriteLine(error);
}
}
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(cart, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.Cart;
import com.ultracart.admin.v2.models.CartValidationRequest;
import com.ultracart.admin.v2.models.CartValidationResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class ValidateCart {
public static void execute() {
/*
This is a checkout api method. It can be used both server side or client side. This example is a server side
call using a Simple API Key. See the JavaScript sdk samples if you wish to see a browser key implementation.
validateCart passes a shopping cart to UltraCart for validation.
*/
try {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String cartId = "123456789123456789123456789123456789"; // usually this would be retrieved from a session variable or cookie.
String expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html) also see getCart() example
Cart cart = checkoutApi.getCartByCartId(cartId, expansion).getCart();
CartValidationRequest validationRequest = new CartValidationRequest();
validationRequest.setCart(cart);
// validationRequest.setChecks(null); // leave this null for all validations
// Possible Checks
/*
All,Advertising Source Provided,Billing Address Provided,
Billing Destination Restriction,Billing Phone Numbers Provided,Billing State Abbreviation Valid,Billing Validate City State Zip,
Coupon Zip Code Restriction,Credit Card Shipping Method Conflict,Customer Profile Does Not Exist.,CVV2 Not Required,
Electronic Check Confirm Account Number,Email confirmed,Email provided if required,Gift Message Length,Item Quantity Valid,
Item Restrictions,Items Present,Merchant Specific Item Relationships,One per customer violations,Options Provided,
Payment Information Validate,Payment Method Provided,Payment Method Restriction,Pricing Tier Limits,Quantity requirements met,
Referral Code Provided,Shipping Address Provided,Shipping Destination Restriction,Shipping Method Provided,
Shipping Needs Recalculation,Shipping State Abbreviation Valid,Shipping Validate City State Zip,Special Instructions Length,
Tax County Specified,Valid Delivery Date,Valid Ship On Date,Auth Test Credit Card
*/
// This method also does an update in the process, so pass in a good expansion and grab the return cart variable.
CartValidationResponse apiResponse = checkoutApi.validateCart(validationRequest, expansion);
cart = apiResponse.getCart();
System.out.println("<html lang=\"en\"><body><pre>");
System.out.println("Validation Errors:");
if (apiResponse.getErrors() != null) {
for (String error : apiResponse.getErrors()) {
System.out.println(error);
}
}
System.out.println(cart.toString());
System.out.println("</pre></body></html>");
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
/**
* This is a checkout api method. It can be used both server side or client side.
* This example is a server side call using a Simple API Key.
* See the JavaScript sdk samples if you wish to see a browser key implementation.
*
* validateCart passes a shopping cart to UltraCart for validation.
*/
export class ValidateCart {
static async execute() {
// Usually this would be retrieved from a session variable or cookie.
const cartId = "123456789123456789123456789123456789";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
// also see getCart() example
const expand = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Retrieve the cart
const retrievedCartResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByCartId(cartId, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const cart = retrievedCartResponse.cart;
// Create validation request
const validationRequest = {
cart: cart
// validationRequest.checks = undefined; // leave this undefined for all validations
};
/**
* Possible Checks:
* All,Advertising Source Provided,Billing Address Provided,
* Billing Destination Restriction,Billing Phone Numbers Provided,Billing State Abbreviation Valid,
* Billing Validate City State Zip,Coupon Zip Code Restriction,Credit Card Shipping Method Conflict,
* Customer Profile Does Not Exist.,CVV2 Not Required,Electronic Check Confirm Account Number,
* Email confirmed,Email provided if required,Gift Message Length,Item Quantity Valid,
* Item Restrictions,Items Present,Merchant Specific Item Relationships,One per customer violations,
* Options Provided,Payment Information Validate,Payment Method Provided,Payment Method Restriction,
* Pricing Tier Limits,Quantity requirements met,Referral Code Provided,Shipping Address Provided,
* Shipping Destination Restriction,Shipping Method Provided,Shipping Needs Recalculation,
* Shipping State Abbreviation Valid,Shipping Validate City State Zip,Special Instructions Length,
* Tax County Specified,Valid Delivery Date,Valid Ship On Date,Auth Test Credit Card
*/
// This method also does an update in the process, so pass in a good expansion and grab the return cart variable.
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.validateCart(validationRequest, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const updatedCart = apiResponse.cart;
// Logging validation results
console.log("Validation Errors:");
if (apiResponse.errors) {
apiResponse.errors.forEach(error => {
console.log(error);
});
}
console.log(JSON.stringify(updatedCart, null, 2));
}
}
<?php
/*
This is a checkout api method. It can be used both server side or client side. This example is a server side
call using a Simple API Key. See the JavaScript sdk samples if you wish to see a browser key implementation.
validateCart passes a shopping cart to UltraCart for validation.
*/
use ultracart\v2\api\CheckoutApi;
use ultracart\v2\models\CartValidationRequest;
require_once '../vendor/autoload.php';
$checkout_api = CheckoutApi::usingApiKey(Constants::API_KEY);
$cart_id = '123456789123456789123456789123456789'; // usually this would be retrieved from a session variable or cookie.
$expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html) also see getCart() example
$cart = $checkout_api->getCartByCartId($cart_id, $expansion)->getCart();
$validationRequest = new CartValidationRequest();
$validationRequest->setCart($cart);
// $validationRequest->setChecks(); // leave this null for all validations
// Possible Checks
/*
All,Advertising Source Provided,Billing Address Provided,
Billing Destination Restriction,Billing Phone Numbers Provided,Billing State Abbreviation Valid,Billing Validate City State Zip,
Coupon Zip Code Restriction,Credit Card Shipping Method Conflict,Customer Profile Does Not Exist.,CVV2 Not Required,
Electronic Check Confirm Account Number,Email confirmed,Email provided if required,Gift Message Length,Item Quantity Valid,
Item Restrictions,Items Present,Merchant Specific Item Relationships,One per customer violations,Options Provided,
Payment Information Validate,Payment Method Provided,Payment Method Restriction,Pricing Tier Limits,Quantity requirements met,
Referral Code Provided,Shipping Address Provided,Shipping Destination Restriction,Shipping Method Provided,
Shipping Needs Recalculation,Shipping State Abbreviation Valid,Shipping Validate City State Zip,Special Instructions Length,
Tax County Specified,Valid Delivery Date,Valid Ship On Date,Auth Test Credit Card
*/
// This method also does an update in the process, so pass in a good expansion and grab the return cart variable.
$api_response = $checkout_api->validateCart($validationRequest, $expansion);
$cart = $api_response->getCart();
echo '<html lang="en"><body><pre>';
echo 'Validation Errors:';
var_dump($api_response->getErrors());
echo '</pre></body></html>';
from ultracart.apis import CheckoutApi
from ultracart.models import CartValidationRequest
from samples import api_client
# Initialize the checkout API
checkout_api = CheckoutApi(api_client())
# Cart ID would normally come from session or cookie
cart_id = '123456789123456789123456789123456789'
# Define expansion string for detailed cart information
expand = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Get the cart
cart = checkout_api.get_cart_by_cart_id(cart_id, expand=expand).cart
# Create validation request
validation_request = CartValidationRequest(cart=cart)
# validation_request.checks = None # leave as None for all validations
# Possible checks:
"""
All, Advertising Source Provided, Billing Address Provided,
Billing Destination Restriction, Billing Phone Numbers Provided, Billing State Abbreviation Valid, Billing Validate City State Zip,
Coupon Zip Code Restriction, Credit Card Shipping Method Conflict, Customer Profile Does Not Exist., CVV2 Not Required,
Electronic Check Confirm Account Number, Email confirmed, Email provided if required, Gift Message Length, Item Quantity Valid,
Item Restrictions, Items Present, Merchant Specific Item Relationships, One per customer violations, Options Provided,
Payment Information Validate, Payment Method Provided, Payment Method Restriction, Pricing Tier Limits, Quantity requirements met,
Referral Code Provided, Shipping Address Provided, Shipping Destination Restriction, Shipping Method Provided,
Shipping Needs Recalculation, Shipping State Abbreviation Valid, Shipping Validate City State Zip, Special Instructions Length,
Tax County Specified, Valid Delivery Date, Valid Ship On Date, Auth Test Credit Card
"""
# Validate cart and get updated cart in response
api_response = checkout_api.validate_cart(validation_request, expand=expand)
cart = api_response.cart
# Handle validation errors
validation_errors = api_response.errors
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
cart_id = '123456789123456789123456789123456789' # Usually this would be retrieved from a session variable or cookie.
expansion = 'items,billing,shipping,coupons,checkout,payment,summary,taxes'
cart = checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
validation_request = UltracartClient::CartValidationRequest.new
validation_request.cart = cart
# Possible Checks (you can set these as needed, or leave as default):
# validation_request.set_checks(["All", "Item Quantity Valid", "Payment Information Validate"])
api_response = checkout_api.validate_cart(validation_request, {_expand: expansion})
cart = api_response.cart
puts "Validation Errors:"
puts api_response.errors.inspect
import {checkoutApi} from '../api';
import {
Cart,
CartValidationRequest,
CartValidationResponse
} from 'ultracart_rest_api_v2_typescript';
/**
* This is a checkout api method. It can be used both server side or client side.
* This example is a server side call using a Simple API Key.
* See the JavaScript sdk samples if you wish to see a browser key implementation.
*
* validateCart passes a shopping cart to UltraCart for validation.
*/
export class ValidateCart {
public static async execute(): Promise<void> {
// Usually this would be retrieved from a session variable or cookie.
const cartId = "123456789123456789123456789123456789";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
// also see getCart() example
const expand = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Retrieve the cart
const retrievedCartResponse = await checkoutApi.getCartByCartId({cartId, expand});
const cart = retrievedCartResponse.cart;
// Create validation request
const validationRequest: CartValidationRequest = {
cart: cart
// validationRequest.checks = undefined; // leave this undefined for all validations
};
/**
* Possible Checks:
* All,Advertising Source Provided,Billing Address Provided,
* Billing Destination Restriction,Billing Phone Numbers Provided,Billing State Abbreviation Valid,
* Billing Validate City State Zip,Coupon Zip Code Restriction,Credit Card Shipping Method Conflict,
* Customer Profile Does Not Exist.,CVV2 Not Required,Electronic Check Confirm Account Number,
* Email confirmed,Email provided if required,Gift Message Length,Item Quantity Valid,
* Item Restrictions,Items Present,Merchant Specific Item Relationships,One per customer violations,
* Options Provided,Payment Information Validate,Payment Method Provided,Payment Method Restriction,
* Pricing Tier Limits,Quantity requirements met,Referral Code Provided,Shipping Address Provided,
* Shipping Destination Restriction,Shipping Method Provided,Shipping Needs Recalculation,
* Shipping State Abbreviation Valid,Shipping Validate City State Zip,Special Instructions Length,
* Tax County Specified,Valid Delivery Date,Valid Ship On Date,Auth Test Credit Card
*/
// This method also does an update in the process, so pass in a good expansion and grab the return cart variable.
const apiResponse: CartValidationResponse = await checkoutApi.validateCart({validationRequest, expand});
const updatedCart = apiResponse.cart;
// Logging validation results
console.log("Validation Errors:");
if (apiResponse.errors) {
apiResponse.errors.forEach(error => {
console.log(error);
});
}
console.log(JSON.stringify(updatedCart, null, 2));
}
}
Get a cart specified by the cart_id parameter.
SDK Function Name: getCartByCartId
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
cart_id | Cart ID to retrieve | path | string | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Web;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using RestSharp;
namespace SdkSample.checkout
{
public class GetCartByCartId
{
/// <summary>
/// Retrieves a cart either by creating a new one or getting an existing one by cart ID
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
String cartId = "123456780123456780123456780123456780"; // get from session or cookie.
CartResponse apiResponse = checkoutApi.GetCartByCartId(cartId, expansion);
Cart cart = apiResponse.Cart;
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
HttpCookie cookie = new HttpCookie(Constants.CartIdCookieName);
cookie.Value = cart.CartId;
cookie.Expires = DateTime.Now.AddDays(14); // 1209600 seconds = 14 days
cookie.Path = "/";
// HttpContext.Current.Response.Cookies.Add(cookie);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(cart, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class GetCartByCartId {
/**
* Retrieves a cart either by creating a new one or getting an existing one by cart ID
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
* depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
* carts, getCartByCartId($cart_id) is used.
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// for this example, we're just getting a cart to insert some items into it.
String expansion = "items";
try {
// get cart ID from session or cookie.
String cartId = "123456780123456780123456780123456780";
CartResponse apiResponse = checkoutApi.getCartByCartId(cartId, expansion);
Cart cart = apiResponse.getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// Note: In Java, cookie handling is framework-specific. The following is a conceptual representation.
// HttpCookie cookie = new HttpCookie(Constants.CART_ID_COOKIE_NAME);
// cookie.setValue(cart.getCartId());
// cookie.setMaxAge(1209600); // 1209600 seconds = 14 days
// cookie.setPath("/");
// HttpContext.getCurrentResponse().addCookie(cookie);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(cart));
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
import { DateTime } from 'luxon';
/**
* Retrieves a cart either by creating a new one or getting an existing one by cart ID
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
* depending on the presence of an existing cart id or not. For new carts, getCart() is used.
* For existing carts, getCartByCartId($cart_id) is used.
*/
export async function execute() {
// For this example, we're just getting a cart to insert some items into it.
const expansion = "items";
// Get from session or cookie.
const cartId = "123456780123456780123456780123456780";
try {
// Perform the API call
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByCartId(cartId, {_expand: expansion}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const cart = apiResponse.cart;
if (cart) {
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Note: In a browser environment, you would use document.cookie or browser-specific cookie management
document.cookie = `UltraCartShoppingCartID=${cart.cart_id}; expires=${DateTime.now().plus({days: 14}).toHTTP()}; path=/;`;
// Log the cart details
console.log(JSON.stringify(cart, null, 2));
}
} catch (error) {
// Error handling
console.error('Error retrieving cart:', error);
}
}
<?php /** @noinspection DuplicatedCode */
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
// depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
// carts, getCartByCartId($cart_id) is used.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "items"; // for this example, we're just getting a cart to insert some items into it.
$cart_id = null;
if(isset($_COOKIE[Constants::CART_ID_COOKIE_NAME])){
$cart_id = $_COOKIE[Constants::CART_ID_COOKIE_NAME];
}
$cart = null;
if(is_null($cart_id)){
$api_response = $checkout_api->getCart($expansion);
} else {
$api_response = $checkout_api->getCartByCartId($cart_id, $expansion);
}
$cart = $api_response->getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
setcookie(Constants::CART_ID_COOKIE_NAME, $cart->getCartId(), time() + 1209600, "/");
echo '<html lang="en"><body><pre>';
var_dump($cart);
echo '</pre></body></html>';
from ultracart.apis import CheckoutApi
from samples import api_client
from flask import request, make_response
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# this example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
# depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
# carts, getCartByCartId(cart_id) is used.
checkout_api = CheckoutApi(api_client())
expand = "items" # for this example, we're just getting a cart to insert some items into it.
cart_id = request.cookies.get("UltraCartShoppingCartID")
if cart_id is None:
api_response = checkout_api.get_cart(expand=expand)
else:
api_response = checkout_api.get_cart_by_cart_id(cart_id, expand=expand)
cart = api_response.cart
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
response = make_response(str(cart))
response.set_cookie("UltraCartShoppingCartID", cart.cart_id, max_age=1209600, path="/")
print(cart)
# frozen_string_literal: true
require 'json'
require 'yaml'
require 'ultracart_api'
require_relative '../constants'
api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
# this example is the same for both get_cart.rb and get_cart_by_id.rb. They work as a pair and are called
# depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
# carts, getCartByCartId(cart_id) is used.
expansion = 'items' # for this example, we're just getting a cart to insert some items into it.
# do you have the cart id from a cookie or some other server side state engine?
cart_id = nil
# run this example once to get a cart id, then you can add it here to test.
# the cart id below will not work for you.
# cart_id = 'C6A8693A3C78C6017FDA7A50EE380100'
api_response = if cart_id.nil?
api.get_cart({ '_expand': expansion })
else
api.get_cart_by_cart_id(cart_id, { '_expand': expansion })
end
cart = api_response.cart
puts cart.to_yaml
import {CheckoutApi} from 'ultracart_rest_api_v2_typescript';
import {CartResponse, Cart} from 'ultracart_rest_api_v2_typescript';
import {checkoutApi} from '../api';
import {DateTime} from 'luxon';
/**
* Retrieves a cart either by creating a new one or getting an existing one by cart ID
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example is the same for both getCart.php and getCartByCartId.php. They work as a pair and are called
* depending on the presence of an existing cart id or not. For new carts, getCart() is used.
* For existing carts, getCartByCartId($cart_id) is used.
*/
export async function execute(): Promise<void> {
// For this example, we're just getting a cart to insert some items into it.
const expansion = "items";
// Get from session or cookie.
const cartId = "123456780123456780123456780123456780";
try {
// Perform the API call
const apiResponse: CartResponse = await checkoutApi.getCartByCartId({cartId, expand: expansion});
const cart: Cart | undefined = apiResponse.cart;
if (cart) {
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Note: In a browser environment, you would use document.cookie or browser-specific cookie management
document.cookie = `UltraCartShoppingCartID=${cart.cart_id}; expires=${DateTime.now().plus({days: 14}).toHTTP()}; path=/;`;
// Log the cart details
console.log(JSON.stringify(cart, null, 2));
}
} catch (error) {
// Error handling
console.error('Error retrieving cart:', error);
}
}
Get a Affirm checkout object for the specified cart_id parameter.
SDK Function Name: getAffirmCheckout
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
cart_id | Cart ID to retrieve | path | string | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class GetAffirmCheckout
{
/// <summary>
/// For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
/// needed to proceed with an Affirm checkout.
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
// needed to proceed with an Affirm checkout. See https://www.affirm.com/ for details about Affirm.
// This sample does not show the construction of the affirm checkout widgets. See the affirm api for those examples.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String cartId = "123456789123456789123456789123456789"; // this should be retrieved from a session or cookie
CartAffirmCheckoutResponse apiResponse = checkoutApi.GetAffirmCheckout(cartId);
if (apiResponse.Errors != null && apiResponse.Errors.Count > 0)
{
// TODO: display errors to customer about the failure
foreach (String error in apiResponse.Errors)
{
Console.WriteLine(error);
}
}
else
{
Console.WriteLine(apiResponse.CheckoutJson); // this is the object to send to Affirm.
}
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.CartAffirmCheckoutResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class GetAffirmCheckout {
/**
* Returns Affirm checkout JSON for a given cart ID
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
* See https://www.affirm.com/ for Affirm details
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String cartId = "123456789123456789123456789123456789"; // retrieve from session or cookie
try {
CartAffirmCheckoutResponse apiResponse = checkoutApi.getAffirmCheckout(cartId);
if (apiResponse.getErrors() != null && !apiResponse.getErrors().isEmpty()) {
// Display errors to customer about the failure
for (String error : apiResponse.getErrors()) {
System.out.println(error);
}
} else {
System.out.println(apiResponse.getCheckoutJson()); // object to send to Affirm
}
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
export class GetAffirmCheckout {
/// <summary>
/// For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
/// needed to proceed with an Affirm checkout.
/// </summary>
static async Execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
// needed to proceed with an Affirm checkout. See https://www.affirm.com/ for details about Affirm.
// This sample does not show the construction of the affirm checkout widgets. See the affirm api for those examples.
const cartId = "123456789123456789123456789123456789"; // this should be retrieved from a session or cookie
try {
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getAffirmCheckout(cartId, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (apiResponse.errors && apiResponse.errors.length > 0) {
// TODO: display errors to customer about the failure
apiResponse.errors.forEach(error => {
console.log(error);
});
} else {
console.log(apiResponse.checkout_json); // this is the object to send to Affirm.
}
} catch (error) {
console.error('Error retrieving Affirm checkout:', error);
}
}
}
<?php /** @noinspection DuplicatedCode */
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
// needed to proceed with an Affirm checkout. See https://www.affirm.com/ for details about Affirm.
// This sample does not show the construction of the affirm checkout widgets. See the affirm api for those examples.
require_once '../vendor/autoload.php';
require_once '../constants.php';
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$cart_id = '123456789123456789123456789123456789'; // this should be retrieved from a session or cookie
$api_response = $checkout_api->getAffirmCheckout($cart_id);
if(!is_null($api_response->getErrors()) && count($api_response->getErrors()) > 0){
// TODO: display errors to customer about the failure
foreach ($api_response->getErrors() as $error) {
var_dump($error);
}
} else {
var_dump($api_response->getCheckoutJson()); // this is the object to send to Affirm.
}
from ultracart.apis import CheckoutApi
from samples import api_client
from flask import session, request
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
# needed to proceed with an Affirm checkout. See https://www.affirm.com/ for details about Affirm.
# This sample does not show the construction of the affirm checkout widgets. See the affirm api for those examples.
checkout_api = CheckoutApi(api_client())
# this should be retrieved from a session or cookie
cart_id = '123456789123456789123456789123456789'
api_response = checkout_api.get_affirm_checkout(cart_id)
if api_response.errors is not None and len(api_response.errors) > 0:
# TODO: display errors to customer about the failure
for error in api_response.errors:
print(error)
else:
print(api_response.checkout_json) # this is the object to send to Affirm.
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
# needed to proceed with an Affirm checkout. See https://www.affirm.com/ for details about Affirm.
# This sample does not show the construction of the affirm checkout widgets. See the affirm api for those examples.
require 'ultracart_api'
require_relative '../constants'
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
cart_id = '123456789123456789123456789123456789' # this should be retrieved from a session or cookie
api_response = checkout_api.get_affirm_checkout(cart_id)
if !api_response.errors.nil? && api_response.errors.length > 0
# TODO: display errors to customer about the failure
api_response.errors.each do |error|
puts error.inspect
end
else
puts api_response.checkout_json.inspect # this is the object to send to Affirm.
end
import { checkoutApi } from '../api';
import { CartAffirmCheckoutResponse } from 'ultracart_rest_api_v2_typescript';
export class GetAffirmCheckout {
/// <summary>
/// For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
/// needed to proceed with an Affirm checkout.
/// </summary>
public static async Execute(): Promise<void> {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
// needed to proceed with an Affirm checkout. See https://www.affirm.com/ for details about Affirm.
// This sample does not show the construction of the affirm checkout widgets. See the affirm api for those examples.
const cartId: string = "123456789123456789123456789123456789"; // this should be retrieved from a session or cookie
try {
const apiResponse: CartAffirmCheckoutResponse = await checkoutApi.getAffirmCheckout({cartId});
if (apiResponse.errors && apiResponse.errors.length > 0) {
// TODO: display errors to customer about the failure
apiResponse.errors.forEach(error => {
console.log(error);
});
} else {
console.log(apiResponse.checkout_json); // this is the object to send to Affirm.
}
} catch (error) {
console.error('Error retrieving Affirm checkout:', error);
}
}
}
Look up the city and state for the shipping zip code. Useful for building an auto complete for parts of the shipping address
SDK Function Name: cityState
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
cart | Cart | body | Cart | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class CityState
{
/// <summary>
/// Takes a postal code and returns back a city and state (US Only)
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Takes a postal code and returns back a city and state (US Only)
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String cartId = "123456789123456789123456789123456789"; // you should have the cart id from session or cookie.
Cart cart = new Cart();
cart.CartId = cartId; // required
cart.Shipping = new CartShipping();
cart.Shipping.PostalCode = "44233";
CityStateZip apiResponse = checkoutApi.CityState(cart);
Console.WriteLine("City: " + apiResponse.City);
Console.WriteLine("State: " + apiResponse.State);
}
}
}
package checkout;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class CityState {
/**
* Takes a postal code and returns back a city and state (US Only)
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String cartId = "123456789123456789123456789123456789"; // you should have the cart id from session or cookie.
Cart cart = new Cart();
cart.cartId(cartId); // required
cart.shipping(new CartShipping());
cart.getShipping().postalCode("44233");
try {
CityStateZip apiResponse = checkoutApi.cityState(cart);
System.out.println("City: " + apiResponse.getCity());
System.out.println("State: " + apiResponse.getState());
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
/// <summary>
/// Takes a postal code and returns back a city and state (US Only)
/// </summary>
export class CityState {
/// <summary>
/// Takes a postal code and returns back a city and state (US Only)
/// </summary>
static async Execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Takes a postal code and returns back a city and state (US Only)
const cartId = "123456789123456789123456789123456789"; // you should have the cart id from session or cookie.
const cart = {
cart_id: cartId, // required
shipping: {
postal_code: "44233"
}
};
try {
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.cityState(cart, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
console.log("City: " + apiResponse.city);
console.log("State: " + apiResponse.state);
} catch (error) {
console.error("Error retrieving city and state:", error);
}
}
}
<?php /** @noinspection DuplicatedCode */
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Takes a postal code and returns back a city and state (US Only)
use ultracart\v2\models\Cart;
use ultracart\v2\models\CartShipping;
require_once '../vendor/autoload.php';
require_once '../constants.php';
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$cartId = '123456789123456789123456789123456789'; // you should have the cart id from session or cookie.
$cart = new Cart();
$cart->setCartId($cartId); // required
$cart->setShipping(new CartShipping());
$cart->getShipping()->setPostalCode('44233');
$api_response = $checkout_api->cityState($cart);
echo 'City: ' . $api_response->getCity() . '<br>';
echo 'State: ' . $api_response->getState() . '<br>';
from ultracart.apis import CheckoutApi
from ultracart.models import Cart, CartShipping
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Takes a postal code and returns back a city and state (US Only)
checkout_api = CheckoutApi(api_client())
cart_id = '123456789123456789123456789123456789' # you should have the cart id from session or cookie
cart = Cart()
cart.cart_id = cart_id # required
cart.shipping = CartShipping()
cart.shipping.postal_code = '44233'
api_response = checkout_api.city_state(cart)
print(f'City: {api_response.city}')
print(f'State: {api_response.state}')
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Takes a postal code and returns back a city and state (US Only)
require 'ultracart_api'
require_relative '../constants'
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
cart_id = '123456789123456789123456789123456789' # you should have the cart id from session or cookie
cart = UltracartClient::Cart.new
cart.cart_id = cart_id # required
cart.shipping = UltracartClient::CartShipping.new
cart.shipping.postal_code = '44233'
api_response = checkout_api.city_state(cart)
puts "City: #{api_response.city}"
puts "State: #{api_response.state}"
import {checkoutApi} from '../api';
import {Cart, CityStateZip} from 'ultracart_rest_api_v2_typescript';
/// <summary>
/// Takes a postal code and returns back a city and state (US Only)
/// </summary>
export class CityState {
/// <summary>
/// Takes a postal code and returns back a city and state (US Only)
/// </summary>
public static async Execute(): Promise<void> {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Takes a postal code and returns back a city and state (US Only)
const cartId: string = "123456789123456789123456789123456789"; // you should have the cart id from session or cookie.
const cart: Cart = {
cart_id: cartId, // required
shipping: {
postal_code: "44233"
}
};
try {
const apiResponse: CityStateZip = await checkoutApi.cityState({cart});
console.log("City: " + apiResponse.city);
console.log("State: " + apiResponse.state);
} catch (error) {
console.error("Error retrieving city and state:", error);
}
}
}
Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
SDK Function Name: relatedItemsForItem
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
item_id | Item ID to retrieve related items for | path | string | required |
cart | Cart | body | Cart | required |
_expand | The object expansion to perform on the result. See item resource documentation for examples | query | string | optional |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class RelatedItemsForItem
{
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Retrieves items related to the items within the cart, in addition to another item id you supply.
// Item relations are configured in the UltraCart backend.
// See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
// Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
// content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
string expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
// In C# web application, you'd get the cookie from HttpContext
string cartId = null;
// Example of how you might get the cookie in ASP.NET
// if (HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME] != null)
// {
// cartId = HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME].Value;
// }
Cart cart = null;
if (cartId == null)
{
CartResponse apiResponse = checkoutApi.GetCart(expansion);
cart = apiResponse.Cart;
}
else
{
CartResponse apiResponse = checkoutApi.GetCartByCartId(cartId, expansion);
cart = apiResponse.Cart;
}
// TODO - add some items to the cart and update.
List<CartItem> items = new List<CartItem>();
CartItem cartItem = new CartItem();
cartItem.ItemId = "ITEM_ABC";
cartItem.Quantity = 1;
items.Add(cartItem);
cart.Items = items;
// update the cart and assign it back to our variable.
cart = checkoutApi.UpdateCart(cart, expansion).Cart;
string anotherItemId = "ITEM_ZZZ";
ItemsResponse apiResponse2 = checkoutApi.RelatedItemsForItem(anotherItemId, cart, expansion);
List<Item> relatedItems = apiResponse2.Items;
Console.WriteLine("<html lang=\"en\"><body><pre>");
foreach (Item item in relatedItems)
{
Console.WriteLine(item.ToString());
}
Console.WriteLine("</pre></body></html>");
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class RelatedItemsForItem {
public static void execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Retrieves items related to the items within the cart, in addition to another item id you supply.
// Item relations are configured in the UltraCart backend.
// See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
// Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
// content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
// In Java web application, you'd get the cookie from HttpServletRequest
String cartId = null;
// Example of how you might get the cookie in a Servlet
// Cookie[] cookies = request.getCookies();
// if (cookies != null) {
// for (Cookie cookie : cookies) {
// if (Constants.CART_ID_COOKIE_NAME.equals(cookie.getName())) {
// cartId = cookie.getValue();
// break;
// }
// }
// }
try {
Cart cart;
if (cartId == null) {
CartResponse apiResponse = checkoutApi.getCart(expansion);
cart = apiResponse.getCart();
} else {
CartResponse apiResponse = checkoutApi.getCartByCartId(cartId, expansion);
cart = apiResponse.getCart();
}
// TODO - add some items to the cart and update.
List<CartItem> items = new ArrayList<>();
CartItem cartItem = new CartItem();
cartItem.setItemId("ITEM_ABC");
cartItem.setQuantity(BigDecimal.valueOf(1));
items.add(cartItem);
cart.setItems(items);
// update the cart and assign it back to our variable.
cart = checkoutApi.updateCart(cart, expansion).getCart();
String anotherItemId = "ITEM_ZZZ";
ItemsResponse apiResponse2 = checkoutApi.relatedItemsForItem(anotherItemId, cart, expansion);
List<Item> relatedItems = apiResponse2.getItems();
System.out.println("<html lang=\"en\"><body><pre>");
for (Item item : relatedItems) {
System.out.println(item.toString());
}
System.out.println("</pre></body></html>");
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import {checkoutApi} from '../api.js';
export class RelatedItemsForItem {
/**
* Retrieves items related to the items within the cart, in addition to another item id.
* Item relations are configured in the UltraCart backend.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
*
* Note: The returned items have a fixed expansion (only so many item properties are returned).
* Item expansion includes:
* content, content.assignments, content.attributes, content.multimedia,
* content.multimedia.thumbnails, options, pricing, and pricing.tiers
*/
static async execute() {
try {
// Expansion options for the cart
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// In TypeScript web application, you'd get the cookie from your request context
let cartId;
// Example of how you might get the cookie
// cartId = request.cookies["UltraCartShoppingCartID"];
let cart;
let apiResponse;
if (!cartId) {
apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = apiResponse.cart;
} else {
apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByCartId(
cartId,{_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = apiResponse.cart;
}
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Add some items to the cart and update
cart.items = [{
item_id: "ITEM_ABC",
quantity: 1
}];
// Update the cart and assign it back to our variable
const updateResponse = await new Promise((resolve, reject) => {
checkoutApi.updateCart(cart, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = updateResponse.cart;
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Another item ID to find related items for
const anotherItemId = "ITEM_ZZZ";
// Get related items for the specific item and cart
const apiResponse2 = await new Promise((resolve, reject) => {
checkoutApi.relatedItemsForItem(anotherItemId, cart,{_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const relatedItems = apiResponse2.items || [];
// Output related items
relatedItems.forEach(item => {
console.log(JSON.stringify(item, null, 2));
});
} catch (error) {
console.error("Error retrieving related items:", error);
}
}
}
<?php /** @noinspection DuplicatedCode */
use ultracart\v2\models\CartFinalizeOrderRequest;
use ultracart\v2\models\CartFinalizeOrderRequestOptions;
use ultracart\v2\models\CartItem;
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Retrieves items related to the items within the cart, in addition to another item id you supply.
// Item relations are configured in the UltraCart backend.
// See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
// Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
// content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
$cart_id = null;
if(isset($_COOKIE[Constants::CART_ID_COOKIE_NAME])){
$cart_id = $_COOKIE[Constants::CART_ID_COOKIE_NAME];
}
$cart = null;
if(is_null($cart_id)){
$api_response = $checkout_api->getCart($expansion);
} else {
$api_response = $checkout_api->getCartByCartId($cart_id, $expansion);
}
$cart = $api_response->getCart();
// TODO - add some items to the cart and update.
$items = [];
$cartItem = new CartItem();
$cartItem->setItemId('ITEM_ABC');
$cartItem->setQuantity(1);
$items[] = $cartItem;
$cart->setItems($items);
// update the cart and assign it back to our variable.
$cart = $checkout_api->updateCart($cart, $expansion)->getCart();
$another_item_id = 'ITEM_ZZZ';
$api_response = $checkout_api->relatedItemsForItem($another_item_id, $cart, $expansion);
$related_items = $api_response->getItems();
echo '<html lang="en"><body><pre>';
var_dump($related_items);
echo '</pre></body></html>';
from flask import request
from ultracart.apis import CheckoutApi
from ultracart.models import CartItem
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Retrieves items related to the items within the cart, in addition to another item id you supply.
# Item relations are configured in the UltraCart backend.
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
# Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
# content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
checkout_api = CheckoutApi(api_client())
expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
"""
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
"""
cart_id = request.cookies.get('UltraCartShoppingCartID')
if cart_id is None:
api_response = checkout_api.get_cart(expand=expand)
else:
api_response = checkout_api.get_cart_by_cart_id(cart_id, expand=expand)
cart = api_response.cart
# TODO - add some items to the cart and update.
items = []
cart_item = CartItem()
cart_item.item_id = 'ITEM_ABC'
cart_item.quantity = 1
items.append(cart_item)
cart.items = items
# update the cart and assign it back to our variable
cart = checkout_api.update_cart(cart, expand=expand).cart
another_item_id = 'ITEM_ZZZ'
api_response = checkout_api.related_items_for_item(another_item_id, cart, expand=expand)
related_items = api_response.items
print(related_items)
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Retrieves items related to the items within the cart, in addition to another item ID you supply.
# Item relations are configured in the UltraCart backend.
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
expansion = 'customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes'
cart_id = ENV['HTTP_ULTRACARTSHOPPINGCARTID']
cart = if cart_id.nil?
checkout_api.get_cart({_expand: expansion}).cart
else
checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
end
# TODO - add some items to the cart and update.
items = []
cart_item = UltracartClient::CartItem.new
cart_item.item_id = 'ITEM_ABC'
cart_item.quantity = 1
items << cart_item
cart.items = items
# Update the cart
cart = checkout_api.update_cart(cart, { '_expand' => expansion }).cart
another_item_id = 'ITEM_ZZZ'
api_response = checkout_api.related_items_for_item(another_item_id, cart, { '_expand' => expansion })
related_items = api_response.items
puts related_items.inspect
import {checkoutApi} from '../api';
import {Cart, CartItem, CartResponse, Item, ItemsResponse} from 'ultracart_rest_api_v2_typescript';
export class RelatedItemsForItem {
/**
* Retrieves items related to the items within the cart, in addition to another item id.
* Item relations are configured in the UltraCart backend.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
*
* Note: The returned items have a fixed expansion (only so many item properties are returned).
* Item expansion includes:
* content, content.assignments, content.attributes, content.multimedia,
* content.multimedia.thumbnails, options, pricing, and pricing.tiers
*/
public static async execute(): Promise<void> {
try {
// Expansion options for the cart
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// In TypeScript web application, you'd get the cookie from your request context
let cartId: string | undefined;
// Example of how you might get the cookie
// cartId = request.cookies["UltraCartShoppingCartID"];
let cart: Cart | undefined;
let apiResponse: CartResponse;
if (!cartId) {
apiResponse = await checkoutApi.getCart({expand});
cart = apiResponse.cart;
} else {
apiResponse = await checkoutApi.getCartByCartId({
cartId: cartId,
expand
});
cart = apiResponse.cart;
}
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Add some items to the cart and update
cart.items = [{
item_id: "ITEM_ABC",
quantity: 1
}];
// Update the cart and assign it back to our variable
cart = (await checkoutApi.updateCart({
cart: cart,
expand
})).cart;
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Another item ID to find related items for
const anotherItemId = "ITEM_ZZZ";
// Get related items for the specific item and cart
const apiResponse2: ItemsResponse = await checkoutApi.relatedItemsForItem({
itemId: anotherItemId,
cart: cart,
expand
});
const relatedItems: Item[] = apiResponse2.items || [];
// Output related items
relatedItems.forEach(item => {
console.log(JSON.stringify(item, null, 2));
});
} catch (error) {
console.error("Error retrieving related items:", error);
}
}
}
Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
SDK Function Name: relatedItemsForCart
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
cart | Cart | body | Cart | required |
_expand | The object expansion to perform on the result. See item resource documentation for examples | query | string | optional |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.checkout
{
public class RelatedItemsForCart
{
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Retrieves items related to the items within the cart. Item relations are configured in the UltraCart backend.
// See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
// Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
// content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
string expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
// In C# web application, you'd get the cookie from HttpContext
string cartId = null;
// Example of how you might get the cookie in ASP.NET
// if (HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME] != null)
// {
// cartId = HttpContext.Current.Request.Cookies[Constants.CART_ID_COOKIE_NAME].Value;
// }
Cart cart = null;
if (cartId == null)
{
CartResponse apiResponse = checkoutApi.GetCart(expansion);
cart = apiResponse.Cart;
}
else
{
CartResponse apiResponse = checkoutApi.GetCartByCartId(cartId, expansion);
cart = apiResponse.Cart;
}
// TODO - add some items to the cart and update.
List<CartItem> items = new List<CartItem>();
CartItem cartItem = new CartItem();
cartItem.ItemId = "ITEM_ABC";
cartItem.Quantity = 1;
items.Add(cartItem);
cart.Items = items;
// update the cart and assign it back to our variable.
cart = checkoutApi.UpdateCart(cart, expansion).Cart;
ItemsResponse apiResponse2 = checkoutApi.RelatedItemsForCart(cart);
List<Item> relatedItems = apiResponse2.Items;
Console.WriteLine("<html lang=\"en\"><body><pre>");
foreach (Item item in relatedItems)
{
Console.WriteLine(item.ToString());
}
Console.WriteLine("</pre></body></html>");
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class RelatedItemsForCart {
public static void execute() {
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Retrieves items related to the items within the cart. Item relations are configured in the UltraCart backend.
// See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
// Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
// content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
// In Java web application, you'd get the cookie from HttpServletRequest
String cartId = null;
// Example of how you might get the cookie in a Servlet
// Cookie[] cookies = request.getCookies();
// if (cookies != null) {
// for (Cookie cookie : cookies) {
// if (Constants.CART_ID_COOKIE_NAME.equals(cookie.getName())) {
// cartId = cookie.getValue();
// break;
// }
// }
// }
Cart cart;
try {
if (cartId == null) {
CartResponse apiResponse = checkoutApi.getCart(expansion);
cart = apiResponse.getCart();
} else {
CartResponse apiResponse = checkoutApi.getCartByCartId(cartId, expansion);
cart = apiResponse.getCart();
}
// TODO - add some items to the cart and update.
List<CartItem> items = new ArrayList<>();
CartItem cartItem = new CartItem();
cartItem.setItemId("ITEM_ABC");
cartItem.setQuantity(BigDecimal.valueOf(1));
items.add(cartItem);
cart.setItems(items);
// update the cart and assign it back to our variable.
cart = checkoutApi.updateCart(cart, expansion).getCart();
ItemsResponse apiResponse2 = checkoutApi.relatedItemsForCart(cart, null);
List<Item> relatedItems = apiResponse2.getItems();
System.out.println("<html lang=\"en\"><body><pre>");
for (Item item : relatedItems) {
System.out.println(item.toString());
}
System.out.println("</pre></body></html>");
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import {checkoutApi} from '../api.js';
export class RelatedItemsForCart {
/**
* Retrieves items related to the items within the cart.
* Item relations are configured in the UltraCart backend.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
*
* Note: The returned items have a fixed expansion (only so many item properties are returned).
* Item expansion includes:
* content, content.assignments, content.attributes, content.multimedia,
* content.multimedia.thumbnails, options, pricing, and pricing.tiers
*/
static async execute() {
try {
// Expansion options for the cart
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// In TypeScript web application, you'd get the cookie from your request context
let cartId;
// Example of how you might get the cookie
// cartId = request.cookies["UltraCartShoppingCartID"];
let cart;
let apiResponse;
if (!cartId) {
apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCart({_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = apiResponse.cart;
} else {
apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByCartId(
cartId,
{_expand:expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = apiResponse.cart;
}
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Add some items to the cart and update
cart.items = [{
item_id: "ITEM_ABC",
quantity: 1
}];
// Update the cart and assign it back to our variable
const updateResponse = await new Promise((resolve, reject) => {
checkoutApi.updateCart(cart, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
cart = updateResponse.cart;
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Get related items for the cart
const apiResponse2 = await new Promise((resolve, reject) => {
checkoutApi.relatedItemsForCart(cart, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const relatedItems = apiResponse2.items || [];
// Output related items
relatedItems.forEach(item => {
console.log(JSON.stringify(item, null, 2));
});
} catch (error) {
console.error("Error retrieving related items:", error);
}
}
}
<?php /** @noinspection DuplicatedCode */
use ultracart\v2\models\CartFinalizeOrderRequest;
use ultracart\v2\models\CartFinalizeOrderRequestOptions;
use ultracart\v2\models\CartItem;
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// Retrieves items related to the items within the cart. Item relations are configured in the UltraCart backend.
// See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
// Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
// content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
$cart_id = null;
if(isset($_COOKIE[Constants::CART_ID_COOKIE_NAME])){
$cart_id = $_COOKIE[Constants::CART_ID_COOKIE_NAME];
}
$cart = null;
if(is_null($cart_id)){
$api_response = $checkout_api->getCart($expansion);
} else {
$api_response = $checkout_api->getCartByCartId($cart_id, $expansion);
}
$cart = $api_response->getCart();
// TODO - add some items to the cart and update.
$items = [];
$cartItem = new CartItem();
$cartItem->setItemId('ITEM_ABC');
$cartItem->setQuantity(1);
$items[] = $cartItem;
$cart->setItems($items);
// update the cart and assign it back to our variable.
$cart = $checkout_api->updateCart($cart, $expansion)->getCart();
$api_response = $checkout_api->relatedItemsForCart($cart);
$related_items = $api_response->getItems();
echo '<html lang="en"><body><pre>';
var_dump($related_items);
echo '</pre></body></html>';
from flask import request
from ultracart.apis import CheckoutApi
from ultracart.models import CartItem
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Retrieves items related to the items within the cart. Item relations are configured in the UltraCart backend.
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
# Note: The returned items have a fixed expansion (only so many item properties are returned). The item expansion is:
# content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers
checkout_api = CheckoutApi(api_client())
expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
"""
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
"""
cart_id = request.cookies.get('UltraCartShoppingCartID')
if cart_id is None:
api_response = checkout_api.get_cart(expand=expand)
else:
api_response = checkout_api.get_cart_by_cart_id(cart_id, expand=expand)
cart = api_response.cart
# TODO - add some items to the cart and update.
items = []
cart_item = CartItem()
cart_item.item_id = 'ITEM_ABC'
cart_item.quantity = 1
items.append(cart_item)
cart.items = items
# update the cart and assign it back to our variable
cart = checkout_api.update_cart(cart, expand=expand).cart
api_response = checkout_api.related_items_for_cart(cart)
related_items = api_response.items
print(related_items)
require 'ultracart_api'
require_relative '../constants'
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# Retrieves items related to the items within the cart. Item relations are configured in the UltraCart backend.
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
expansion = 'customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes'
cart_id = ENV['HTTP_ULTRACARTSHOPPINGCARTID']
cart = if cart_id.nil?
checkout_api.get_cart({_expand: expansion}).cart
else
checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
end
# TODO - add some items to the cart and update.
items = []
cart_item = UltracartClient::CartItem.new
cart_item.item_id = 'ITEM_ABC'
cart_item.quantity = 1
items << cart_item
cart.items = items
# Update the cart
cart = checkout_api.update_cart(cart, { '_expand' => expansion }).cart
api_response = checkout_api.related_items_for_cart(cart)
related_items = api_response.items
puts related_items.inspect
import {checkoutApi} from '../api';
import {Cart, CartItem, CartResponse, Item, ItemsResponse} from 'ultracart_rest_api_v2_typescript';
export class RelatedItemsForCart {
/**
* Retrieves items related to the items within the cart.
* Item relations are configured in the UltraCart backend.
*
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
*
* Note: The returned items have a fixed expansion (only so many item properties are returned).
* Item expansion includes:
* content, content.assignments, content.attributes, content.multimedia,
* content.multimedia.thumbnails, options, pricing, and pricing.tiers
*/
public static async execute(): Promise<void> {
try {
// Expansion options for the cart
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
const expand = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes";
// In TypeScript web application, you'd get the cookie from your request context
let cartId: string | undefined;
// Example of how you might get the cookie
// cartId = request.cookies["UltraCartShoppingCartID"];
let cart: Cart | undefined;
let apiResponse: CartResponse;
if (!cartId) {
apiResponse = await checkoutApi.getCart({expand});
cart = apiResponse.cart;
} else {
apiResponse = await checkoutApi.getCartByCartId({
cartId: cartId,
expand
});
cart = apiResponse.cart;
}
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Add some items to the cart and update
cart.items = [{
item_id: "ITEM_ABC",
quantity: 1
}];
// Update the cart and assign it back to our variable
cart = (await checkoutApi.updateCart({
cart: cart,
expand
})).cart;
if (cart === undefined) {
console.error("Could not get a cart from UltraCart, cannot continue.");
return;
}
// Get related items for the cart
const apiResponse2: ItemsResponse = await checkoutApi.relatedItemsForCart({cart});
const relatedItems: Item[] = apiResponse2.items || [];
// Output related items
relatedItems.forEach(item => {
console.log(JSON.stringify(item, null, 2));
});
} catch (error) {
console.error("Error retrieving related items:", error);
}
}
}
Get a cart specified by the return code parameter.
SDK Function Name: getCartByReturnCode
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
return_code | Return code to lookup cart ID by | path | string | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Web;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using RestSharp;
namespace SdkSample.checkout
{
public class GetCartByReturnCode
{
/// <summary>
/// Retrieves a cart using a return code
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example returns a shopping cart given a return_code. The return_code is generated by UltraCart
// and usually emailed to a customer. The email will provide a link to this script where you may use the
// return_code to retrieve the customer's cart.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
String returnCode = "1234567890"; // usually retrieved from a query parameter
CartResponse apiResponse = checkoutApi.GetCartByReturnCode(returnCode, expansion);
Cart cart = apiResponse.Cart;
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
HttpCookie cookie = new HttpCookie(Constants.CartIdCookieName);
cookie.Value = cart.CartId;
cookie.Expires = DateTime.Now.AddDays(14); // 1209600 seconds = 14 days
cookie.Path = "/";
// HttpContext.Current.Response.Cookies.Add(cookie);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(cart, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class GetCartByReturnCode {
/**
* Retrieves a cart using a return code
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example returns a shopping cart given a return_code. The return_code is generated by UltraCart
* and usually emailed to a customer. The email will provide a link to this script where you may use the
* return_code to retrieve the customer's cart.
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
String expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
try {
// usually retrieved from a query parameter
String returnCode = "1234567890";
CartResponse apiResponse = checkoutApi.getCartByReturnCode(returnCode, expansion);
Cart cart = apiResponse.getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// Note: In Java, cookie handling is framework-specific. The following is a conceptual representation.
// HttpCookie cookie = new HttpCookie(Constants.CART_ID_COOKIE_NAME);
// cookie.setValue(cart.getCartId());
// cookie.setMaxAge(1209600); // 1209600 seconds = 14 days
// cookie.setPath("/");
// HttpContext.getCurrentResponse().addCookie(cookie);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(cart));
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import { checkoutApi } from '../api.js';
import { DateTime } from 'luxon';
/**
* Retrieves a cart using a return code
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example returns a shopping cart given a return_code. The return_code is generated by UltraCart
* and usually emailed to a customer. The email will provide a link to this script where you may use the
* return_code to retrieve the customer's cart.
*
* Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
* - affiliate - checkout - customer_profile
* - billing - coupons - gift
* - gift_certificate - items.attributes - items.multimedia
* - items - items.multimedia.thumbnails - items.physical
* - marketing - payment - settings.gift
* - settings.billing.provinces - settings.shipping.deliver_on_date - settings.shipping.estimates
* - settings.shipping.provinces - settings.shipping.ship_on_date - settings.shipping.terms
* - settings.terms - shipping - taxes
* - summary - upsell_after
*/
export async function execute() {
// Expansion to include multiple cart details
const expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Usually retrieved from a query parameter
const returnCode = "1234567890";
try {
// Retrieve cart by return code
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByReturnCode(returnCode, {_expand: expansion}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const cart = apiResponse.cart;
if (cart) {
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Note: In a browser environment, you would use document.cookie or browser-specific cookie management
document.cookie = `UltraCartShoppingCartID=${cart.cart_id}; expires=${DateTime.now().plus({ days: 14 }).toHTTP()}; path=/;`;
// Log the cart details
console.log(JSON.stringify(cart, null, 2));
}
} catch (error) {
// Error handling
console.error('Error retrieving cart by return code:', error);
}
}
<?php /** @noinspection DuplicatedCode */
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example returns a shopping cart given a return_code. The return_code is generated by UltraCart
// and usually emailed to a customer. The email will provide a link to this script where you may use the
// return_code to retrieve the customer's cart.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
$return_code = '1234567890'; // usually retrieved from a query parameter
$api_response = $checkout_api->getCartByReturnCode($return_code, $expansion);
$cart = $api_response->getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
setcookie(Constants::CART_ID_COOKIE_NAME, $cart->getCartId(), time() + 1209600, "/");
echo '<html lang="en"><body><pre>';
var_dump($cart);
echo '</pre></body></html>';
from ultracart.apis import CheckoutApi
from samples import api_client
from flask import make_response
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# this example returns a shopping cart given a return_code. The return_code is generated by UltraCart
# and usually emailed to a customer. The email will provide a link to this script where you may use the
# return_code to retrieve the customer's cart.
checkout_api = CheckoutApi(api_client())
expand = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
"""
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
"""
return_code = '1234567890' # usually retrieved from a query parameter
api_response = checkout_api.get_cart_by_return_code(return_code, expand=expand)
cart = api_response.cart
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
response = make_response(str(cart))
response.set_cookie("UltraCartShoppingCartID", cart.cart_id, max_age=1209600, path="/")
print(cart)
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# this example returns a shopping cart given a return_code. The return_code is generated by UltraCart
# and usually emailed to a customer. The email will provide a link to this script where you may use the
# return_code to retrieve the customer's cart.
require 'ultracart_api'
require_relative '../constants'
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
# affiliate checkout customer_profile
# billing coupons gift
# gift_certificate items.attributes items.multimedia
# items items.multimedia.thumbnails items.physical
# marketing payment settings.gift
# settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
# settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
# settings.terms shipping taxes
# summary upsell_after
return_code = '1234567890' # usually retrieved from a query parameter
api_response = checkout_api.get_cart_by_return_code(return_code, _expand: expansion)
cart = api_response.cart
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
cookies[Constants::CART_ID_COOKIE_NAME] = { value: cart.cart_id, expires: Time.now + 1209600, path: "/" }
puts cart.inspect
import { CartResponse, Cart } from 'ultracart_rest_api_v2_typescript';
import { checkoutApi } from '../api';
import { DateTime } from 'luxon';
/**
* Retrieves a cart using a return code
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example returns a shopping cart given a return_code. The return_code is generated by UltraCart
* and usually emailed to a customer. The email will provide a link to this script where you may use the
* return_code to retrieve the customer's cart.
*
* Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
* - affiliate - checkout - customer_profile
* - billing - coupons - gift
* - gift_certificate - items.attributes - items.multimedia
* - items - items.multimedia.thumbnails - items.physical
* - marketing - payment - settings.gift
* - settings.billing.provinces - settings.shipping.deliver_on_date - settings.shipping.estimates
* - settings.shipping.provinces - settings.shipping.ship_on_date - settings.shipping.terms
* - settings.terms - shipping - taxes
* - summary - upsell_after
*/
export async function execute(): Promise<void> {
// Expansion to include multiple cart details
const expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Usually retrieved from a query parameter
const returnCode = "1234567890";
try {
// Retrieve cart by return code
const apiResponse: CartResponse = await checkoutApi.getCartByReturnCode({returnCode, expand: expansion});
const cart: Cart | undefined = apiResponse.cart;
if (cart) {
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Note: In a browser environment, you would use document.cookie or browser-specific cookie management
document.cookie = `UltraCartShoppingCartID=${cart.cart_id}; expires=${DateTime.now().plus({ days: 14 }).toHTTP()}; path=/;`;
// Log the cart details
console.log(JSON.stringify(cart, null, 2));
}
} catch (error) {
// Error handling
console.error('Error retrieving cart by return code:', error);
}
}
Get a cart specified by the encrypted return token parameter.
SDK Function Name: getCartByReturnToken
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
return_token | Return token provided by StoreFront Communications | query | string | optional |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Web;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using RestSharp;
namespace SdkSample.checkout
{
public class GetCartByReturnToken
{
/// <summary>
/// Retrieves a cart using a return token
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
// and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
// provide a link to this script where you may use the token to retrieve the customer's cart.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
String cartToken = "1234567890"; // usually retrieved from a query parameter
CartResponse apiResponse = checkoutApi.GetCartByReturnToken(cartToken, expansion);
Cart cart = apiResponse.Cart;
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
HttpCookie cookie = new HttpCookie(Constants.CartIdCookieName);
cookie.Value = cart.CartId;
cookie.Expires = DateTime.Now.AddDays(14); // 1209600 seconds = 14 days
cookie.Path = "/";
// HttpContext.Current.Response.Cookies.Add(cookie);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(cart, Newtonsoft.Json.Formatting.Indented));
}
}
}
package checkout;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class GetCartByReturnToken {
/**
* Retrieves a cart using a return token
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
* and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
* provide a link to this script where you may use the token to retrieve the customer's cart.
*/
public static void execute() {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
String expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
try {
// usually retrieved from a query parameter
String cartToken = "1234567890";
CartResponse apiResponse = checkoutApi.getCartByReturnToken(cartToken, expansion);
Cart cart = apiResponse.getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
// Note: In Java, cookie handling is framework-specific. The following is a conceptual representation.
// HttpCookie cookie = new HttpCookie(Constants.CART_ID_COOKIE_NAME);
// cookie.setValue(cart.getCartId());
// cookie.setMaxAge(1209600); // 1209600 seconds = 14 days
// cookie.setPath("/");
// HttpContext.getCurrentResponse().addCookie(cookie);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(cart));
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import {checkoutApi} from '../api.js';
import {DateTime} from 'luxon';
/**
* Retrieves a cart using a return token
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
* and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
* provide a link to this script where you may use the token to retrieve the customer's cart.
*
* Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
* - affiliate - checkout - customer_profile
* - billing - coupons - gift
* - gift_certificate - items.attributes - items.multimedia
* - items - items.multimedia.thumbnails - items.physical
* - marketing - payment - settings.gift
* - settings.billing.provinces - settings.shipping.deliver_on_date - settings.shipping.estimates
* - settings.shipping.provinces - settings.shipping.ship_on_date - settings.shipping.terms
* - settings.terms - shipping - taxes
* - summary - upsell_after
*/
export async function execute() {
// Expansion to include multiple cart details
const expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Usually retrieved from a query parameter
const cartToken = "1234567890";
try {
// Retrieve cart by return token
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getCartByReturnToken(cartToken, {_expand: expansion}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const cart = apiResponse.cart;
if (cart) {
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Note: In a browser environment, you would use document.cookie or browser-specific cookie management
document.cookie = `UltraCartShoppingCartID=${cart.cart_id}; expires=${DateTime.now().plus({days: 14}).toHTTP()}; path=/;`;
// Log the cart details
console.log(JSON.stringify(cart, null, 2));
}
} catch (error) {
// Error handling
console.error('Error retrieving cart by return token:', error);
}
}
<?php /** @noinspection DuplicatedCode */
require_once '../vendor/autoload.php';
require_once '../constants.php';
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// this example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
// and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
// provide a link to this script where you may use the token to retrieve the customer's cart.
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"; //
// Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
/*
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
*/
$cart_token = '1234567890'; // usually retrieved from a query parameter
$api_response = $checkout_api->getCartByReturnToken($cart_token, $expansion);
$cart = $api_response->getCart();
// TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
setcookie(Constants::CART_ID_COOKIE_NAME, $cart->getCartId(), time() + 1209600, "/");
echo '<html lang="en"><body><pre>';
var_dump($cart);
echo '</pre></body></html>';
from ultracart.apis import CheckoutApi
from samples import api_client
from flask import make_response
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# this example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
# and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
# provide a link to this script where you may use the token to retrieve the customer's cart.
checkout_api = CheckoutApi(api_client())
expand = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
"""
affiliate checkout customer_profile
billing coupons gift
gift_certificate items.attributes items.multimedia
items items.multimedia.thumbnails items.physical
marketing payment settings.gift
settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
settings.terms shipping taxes
summary upsell_after
"""
cart_token = '1234567890' # usually retrieved from a query parameter
api_response = checkout_api.get_cart_by_return_token(cart_token, expand=expand)
cart = api_response.cart
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
response = make_response(str(cart))
response.set_cookie("UltraCartShoppingCartID", cart.cart_id, max_age=1209600, path="/")
print(cart)
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# this example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
# and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
# provide a link to this script where you may use the token to retrieve the customer's cart.
require 'ultracart_api'
require_relative '../constants'
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
# Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
# affiliate checkout customer_profile
# billing coupons gift
# gift_certificate items.attributes items.multimedia
# items items.multimedia.thumbnails items.physical
# marketing payment settings.gift
# settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
# settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
# settings.terms shipping taxes
# summary upsell_after
cart_token = '1234567890' # usually retrieved from a query parameter
api_response = checkout_api.get_cart_by_return_token(cart_token, _expand: expansion)
cart = api_response.cart
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
cookies[Constants::CART_ID_COOKIE_NAME] = { value: cart.cart_id, expires: Time.now + 1209600, path: "/" }
puts cart.inspect
import { CartResponse, Cart } from 'ultracart_rest_api_v2_typescript';
import { checkoutApi } from '../api';
import { DateTime } from 'luxon';
/**
* Retrieves a cart using a return token
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*
* This example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
* and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
* provide a link to this script where you may use the token to retrieve the customer's cart.
*
* Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
* - affiliate - checkout - customer_profile
* - billing - coupons - gift
* - gift_certificate - items.attributes - items.multimedia
* - items - items.multimedia.thumbnails - items.physical
* - marketing - payment - settings.gift
* - settings.billing.provinces - settings.shipping.deliver_on_date - settings.shipping.estimates
* - settings.shipping.provinces - settings.shipping.ship_on_date - settings.shipping.terms
* - settings.terms - shipping - taxes
* - summary - upsell_after
*/
export async function execute(): Promise<void> {
// Expansion to include multiple cart details
const expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes";
// Usually retrieved from a query parameter
const cartToken = "1234567890";
try {
// Retrieve cart by return token
const apiResponse: CartResponse = await checkoutApi.getCartByReturnToken({returnToken:cartToken, expand: expansion});
const cart: Cart | undefined = apiResponse.cart;
if (cart) {
// TODO: set or re-set the cart cookie if this is part of a multi-page process.
// Two weeks is a generous cart id time.
// Note: In a browser environment, you would use document.cookie or browser-specific cookie management
document.cookie = `UltraCartShoppingCartID=${cart.cart_id}; expires=${DateTime.now().plus({ days: 14 }).toHTTP()}; path=/;`;
// Log the cart details
console.log(JSON.stringify(cart, null, 2));
}
} catch (error) {
// Error handling
console.error('Error retrieving cart by return token:', error);
}
}
Lookup a state/province list for a given country code
SDK Function Name: getStateProvincesForCountry
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
country_code | Two letter ISO country code | path | string | required |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using Newtonsoft.Json;
namespace SdkSample.checkout
{
public class GetStateProvincesForCountry
{
/// <summary>
/// A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
/// </summary>
public static void Execute()
{
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
CheckoutApi checkoutApi = new CheckoutApi(Constants.ApiKey);
String countryCode = "US";
CheckoutStateProvinceResponse apiResponse = checkoutApi.GetStateProvincesForCountry(countryCode);
List<StateProvince> provinces = apiResponse.StateProvinces;
foreach (StateProvince province in provinces)
{
Console.WriteLine(JsonConvert.SerializeObject(province,
new JsonSerializerSettings { Formatting = Formatting.Indented }));
}
}
}
}
package checkout;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ultracart.admin.v2.CheckoutApi;
import com.ultracart.admin.v2.models.CheckoutStateProvinceResponse;
import com.ultracart.admin.v2.models.StateProvince;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.util.List;
public class GetStateProvincesForCountry {
/**
* A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
* Reference Implementation: https://github.com/UltraCart/responsive_checkout
*/
public static void execute() throws ApiException {
CheckoutApi checkoutApi = new CheckoutApi(Constants.API_KEY);
String countryCode = "US";
CheckoutStateProvinceResponse apiResponse = checkoutApi.getStateProvincesForCountry(countryCode);
List<StateProvince> provinces = apiResponse.getStateProvinces();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
for (StateProvince province : provinces) {
System.out.println(gson.toJson(province));
}
}
}
import {checkoutApi} from '../api.js';
/// <summary>
/// A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
/// </summary>
export class GetStateProvincesForCountry {
/// <summary>
/// A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
/// </summary>
static async execute() {
// Use the API key from your configuration (replace with actual method of getting API key)
const countryCode = "US";
try {
const apiResponse = await new Promise((resolve, reject) => {
checkoutApi.getStateProvincesForCountry(countryCode, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const provinces = apiResponse.stateProvinces || [];
provinces.forEach(province => {
console.log(JSON.stringify(province, null, 2));
});
} catch (error) {
console.error("Error fetching state provinces:", error);
}
}
}
// Optional: If you want to call the method
// GetStateProvincesForCountry.execute().catch(console.error);
<?php /** @noinspection DuplicatedCode */
// Reference Implementation: https://github.com/UltraCart/responsive_checkout
// A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
require_once '../vendor/autoload.php';
require_once '../constants.php';
$checkout_api = ultracart\v2\api\CheckoutApi::usingApiKey(Constants::API_KEY);
$country_code = 'US';
$api_response = $checkout_api->getStateProvincesForCountry($country_code);
$provinces = $api_response->getStateProvinces();
foreach ($provinces as $province) {
var_dump($province); // contains both name and abbreviation
}
from ultracart.apis import CheckoutApi
from samples import api_client
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
checkout_api = CheckoutApi(api_client())
country_code = 'US'
api_response = checkout_api.get_state_provinces_for_country(country_code)
provinces = api_response.state_provinces
for province in provinces:
print(province) # contains both name and abbreviation
# Reference Implementation: https://github.com/UltraCart/responsive_checkout
# A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
require 'ultracart_api'
require_relative '../constants'
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
country_code = 'US'
api_response = checkout_api.get_state_provinces_for_country(country_code)
provinces = api_response.state_provinces
provinces.each do |province|
puts province.inspect # contains both name and abbreviation
end
import {checkoutApi} from '../api';
import {
CheckoutStateProvinceResponse,
StateProvince
} from 'ultracart_rest_api_v2_typescript';
/// <summary>
/// A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
/// </summary>
export class GetStateProvincesForCountry {
/// <summary>
/// A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
/// Reference Implementation: https://github.com/UltraCart/responsive_checkout
/// </summary>
public static async execute(): Promise<void> {
// Use the API key from your configuration (replace with actual method of getting API key)
const countryCode = "US";
try {
const apiResponse: CheckoutStateProvinceResponse = await checkoutApi.getStateProvincesForCountry({countryCode});
const provinces: StateProvince[] = apiResponse.stateProvinces || [];
provinces.forEach(province => {
console.log(JSON.stringify(province, null, 2));
});
} catch (error) {
console.error("Error fetching state provinces:", error);
}
}
}
// Optional: If you want to call the method
// GetStateProvincesForCountry.execute().catch(console.error);
The following webhook events are generated for this resource.
Event | Description | Response | Expansion |
---|---|---|---|
checkout_cart_abandon | Fired when a cart is abandoned by the customer | Cart | Yes |
Name | Data Type | Description |
---|---|---|
action | string | |
channel | string | |
metric | string | |
storefront_oid | integer (int32) | |
subject | string | |
ts | integer (int64) | |
type | string | |
uuid | string |
Name | Data Type | Description |
---|---|---|
arbitrary_item_id | string | Arbitrary item id that should be rebilled instead of the normal schedule |
arbitrary_percentage_discount | number | An arbitrary percentage discount to provide on future rebills |
arbitrary_quantity | number | Arbitrary quantity to rebill |
arbitrary_schedule_days | integer (int32) | The number of days to rebill if the frequency is set to an arbitrary number of days |
arbitrary_unit_cost | number | Arbitrary unit cost that rebills of this item should occur at |
arbitrary_unit_cost_remaining_orders | integer (int32) | The number of rebills to give the arbitrary unit cost on before reverting to normal pricing. |
auto_order_item_oid | integer (int32) | Primary key of AutoOrderItem |
calculated_next_shipment_dts | (read only) string (dateTime) | Calculated Date/time that this item is scheduled to rebill. Will be null if no more shipments are going to occur on this item |
first_order_dts | (read only) string (dateTime) | Date/time of the first order of this item. Null if item added to auto order and has not been rebilled yet. |
frequency | string | Frequency of the rebill if not a fixed schedule
Allowed Values
|
future_schedules | array of AutoOrderItemFutureSchedule | The future rebill schedule for this item up to the next ten rebills |
last_order_dts | string (dateTime) | Date/time of the last order of this item |
life_time_value | number | The life time value of this item including the original purchase |
next_item_id | (read only) string | Calculated next item id |
next_preshipment_notice_dts | string (dateTime) | The date/time of when the next pre-shipment notice should be sent |
next_shipment_dts | string (dateTime) | Date/time that this item is scheduled to rebill |
no_order_after_dts | string (dateTime) | Date/time after which no additional rebills of this item should occur |
number_of_rebills | integer (int32) | The number of times this item has rebilled |
options | array of AutoOrderItemOption | Options associated with this item |
original_item_id | string | The original item id purchased. This item controls scheduling. If you wish to modify a schedule, for example, from monthly to yearly, change this item from your monthly item to your yearly item, and then change the next_shipment_dts to your desired date. |
original_quantity | number | The original quantity purchased |
paused | boolean | True if paused. This field is an object instead of a primitive for backwards compatibility. |
paypal_payer_id | string | The PayPal Payer ID tied to this item |
paypal_recurring_payment_profile_id | string | The PayPal Profile ID tied to this item |
preshipment_notice_sent | boolean | True if the preshipment notice associated with the next rebill has been sent |
rebill_value | number | The value of the rebills of this item |
remaining_repeat_count | integer (int32) | The number of rebills remaining before this item is complete |
simple_schedule | AutoOrderItemSimpleSchedule | If the item is configured as an automatic rebill and only has a simple single step schedule then details are provided within this object |
Name | Data Type | Description |
---|---|---|
item_id | string | Item ID that should rebill |
rebill_count | integer (int32) | The number of times this rebill represents |
shipment_dts | string (dateTime) | Date/time that this item is scheduled to rebill |
unit_cost | number | The unit cost of the item rebilling |
Name | Data Type | Description |
---|---|---|
label | string(50) | Label |
value | string(1024) | Value |
Name | Data Type | Description |
---|---|---|
frequency | (read only) string | Frequency of the rebill if not a fixed schedule
Allowed Values
|
item_id | (read only) string | Item ID that should rebill |
repeat_count | integer (int32) | The number of times this simple schedule is configured for |
Name | Data Type | Description |
---|---|---|
device | BrowserDevice | |
os | BrowserOS | |
user_agent | BrowserUserAgent |
Name | Data Type | Description |
---|---|---|
family | string |
Name | Data Type | Description |
---|---|---|
family | string | |
major | string | |
minor | string | |
patch | string | |
patch_minor | string |
Name | Data Type | Description |
---|---|---|
family | string | |
major | string | |
minor | string | |
patch | string |
Name | Data Type | Description |
---|---|---|
affiliate | CartAffiliate | Affiliate |
affiliate_network_pixel_oid | (read only) integer (int32) | The affiliate network pixel identifier associated with the cart |
base_currency_code | (read only) string(3) | The ISO-4217 three letter base currency code of the account |
billing | CartBilling | Billing |
buysafe | CartBuysafe | buySAFE |
cart_id | (read only) string | Unique identifier for this cart |
checkout | CartCheckout | Checkout |
coupons | array of CartCoupon | Coupons |
currency_code | string(3) | The ISO-4217 three letter currency code the customer is viewing prices in |
currency_conversion | CartCurrencyConversion | Currency conversion information for this cart |
customer_profile | CartCustomerProfile | Customer profile if logged in |
exchange_rate | (read only) number | The exchange rate if the customer is viewing a different currency than the base |
gift | CartGift | Gift |
gift_certificate | CartGiftCertificate | Gift certificate |
items | array of CartItem | Items |
language_iso_code | string(3) | The ISO-631 three letter code the customer would like to checkout with |
logged_in | boolean | True if the customer is logged into their profile |
marketing | CartMarketing | Marketing |
merchant_id | (read only) string | Merchant ID this cart is associated with |
payment | CartPayment | Payment |
properties | array of CartProperty | Properties associated with the cart |
settings | (read only) CartSettings | Settings for options that should be available during the checkout |
shipping | CartShipping | Shipping |
summary | CartSummary | Summary |
taxes | CartTaxes | Taxes |
upsell_after | CartUpsellAfter | Upsell After |
Name | Data Type | Description |
---|---|---|
affiliate_id | integer (int32) | Affiliate id associated with the cart |
affiliate_sub_id | string(50) | Affiliate sub id associated with the cart |
Name | Data Type | Description |
---|---|---|
checkout_json | string | Checkout JSON object |
errors | array of string | Errors that should be displayed to the customer |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
cc_emails | array of string | CC emails. Multiple allowed, but total length of all emails can not exceed 100 characters. |
cell_phone | string(25) | Cell phone |
cell_phone_e164 | (read only) string(25) | Cell phone (E164 format) |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
day_phone | string(25) | Day phone |
string(100) | ||
email_confirm | string(100) | Email entered for confirmation |
evening_phone | string(25) | Evening phone |
first_name | string(30) | First name |
last_name | string(30) | Last name |
postal_code | string(20) | Postal code |
state_region | string(32) | State for United States otherwise region or province for other countries |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
bond_available | (read only) boolean | True if buySAFE is willing to bond the order |
bond_cost | (read only) Currency | Cost of the bond if the customer wants to purchase it |
bond_free | (read only) boolean | True if the bond is free (merchant paying for it) |
bond_wanted | boolean | True if the customer wants the bond |
cart_display_text | (read only) string | Recommend text to display to the customer |
cart_display_url | (read only) string | URL associated with the recommended text |
Name | Data Type | Description |
---|---|---|
comments | string(2000) | Comments from the customer. Rarely used on the single page checkout. |
current_step | (read only) string | Current step of the checkout (read only) |
custom_field1 | string(50) | Custom field 1 |
custom_field10 | string(200) | Custom field 10 |
custom_field2 | string(50) | Custom field 2 |
custom_field3 | string(50) | Custom field 3 |
custom_field4 | string(50) | Custom field 4 |
custom_field5 | string(75) | Custom field 5 |
custom_field6 | string(50) | Custom field 6 |
custom_field7 | string(50) | Custom field 7 |
custom_field8 | string(200) | Custom field 8 |
custom_field9 | string(200) | Custom field 9 |
ip_address | string | IP Address (read only unless non-browser key authenticated) |
return_code | (read only) string | Return code assigned for send return email operation |
return_url | string(2048) | The URL to redirect the customer to when they return from an abandon cart email. Must be https protocol. |
screen_branding_theme_code | string(10) | Screen branding theme code |
storefront_host_name | string | StoreFront Host Name |
user_agent | string | User agent of the browser |
Name | Data Type | Description |
---|---|---|
coupon_code | string | Coupon code |
Name | Data Type | Description |
---|---|---|
base_currency_Code | string | Base currency code for this merchant |
currencies | array of Currency | Conversion information for 1 unit of base currency to target currencies |
Name | Data Type | Description |
---|---|---|
allow_3rd_party_billing | boolean | True if profile is allowed to bill to their 3rd party shipping account |
allow_cod | boolean | True if this profile is allowed to use a COD |
allow_purchase_order | boolean | True if this profile is allowed to use a purchase order |
billing_addresses | array of CartCustomerProfileAddress | Billing addresses on file for this profile |
credit_cards | array of CartCustomerProfileCreditCard | Credit cards on file for this profile (masked) |
customer_profile_oid | integer (int32) | Unique identifier |
dhl_account_number | string | DHL account number on file |
dhl_duty_account_number | string | DHL duty account number on file |
string | ||
fedex_account_number | string | FedEx account number on file |
free_shipping | boolean | True if this profile always qualifies for free shipping |
free_shipping_minimum | number | The minimum amount that this profile has to purchase to qualify for free shipping |
maximum_item_count | integer (int32) | Maximum item count this profile can purchase |
minimum_item_count | integer (int32) | Minimum item count this profile must purchase |
minimum_subtotal | number | Minimum subtotal this profile must purchase |
no_coupons | boolean | True if this profile is prevented from using coupons |
no_free_shipping | boolean | True if this profile is never given free shipping |
no_realtime_charge | boolean | True if this customers orders are not charged in real-time |
pricing_tiers | array of string | Pricing tier names this profile qualifies for |
shipping_addresses | array of CartCustomerProfileAddress | Shipping addresses on file for this profile |
signup_dts | (read only) string | Signup date |
tax_exempt | boolean | True if this profile is exempt from sales tax |
ups_account_number | string | UPS account number on file |
Name | Data Type | Description |
---|---|---|
address1 | string | Address 1 |
address2 | string | Address 2 |
city | string | City |
company | string | Company |
country_code | string | ISO-3166 Country code |
day_phone | string | Day phone |
evening_phone | string | Evening phone |
first_name | string | First name |
last_name | string | Last name |
oid | integer (int32) | Unique identifier for this address |
postal_code | string | Postal code |
state_region | string | State for United States otherwise region or province for other countries |
tax_county | string | Tax county if a billing address |
title | string | Title |
Name | Data Type | Description |
---|---|---|
card_expiration_month | integer (int32) | Card expiration month (1-12) |
card_expiration_year | integer (int32) | Card expiration year (four digit) |
card_number | string | Card number (masked last 4 digits) |
card_type | string | Card type
Allowed Values
|
customer_profile_credit_card_id | integer (int32) | Unique identifier for this stored card |
last_used_date | string (dateTime) | Last used |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
options | CartFinalizeOrderRequestOptions | Options that control the finalize order operation |
Name | Data Type | Description |
---|---|---|
auto_approve_purchase_order | boolean | Automatically approve the purchase order |
channel_partner_code | string | Channel partner code to associate this order with |
channel_partner_oid | integer (int32) | Channel partner oid to associate this order with |
channel_partner_order_id | string | If channel_partner_oid or channel_partner_code specified Channel partner order id for reference |
consider_recurring | boolean | Consider this order a recurring order for the purposes of payment gateway recurring flag |
credit_card_authorization_amount | number | If the order was authorized outside of UltraCart, this is the amount of the authorization |
credit_card_authorization_date | string (dateTime) | If the order was authorized outside of UltraCart, this is the date/time of the authorization |
credit_card_authorization_reference_number | string(60) | If the order was authorized outside of UltraCart, this is the authorization reference number |
no_realtime_payment_processing | boolean | Prevents normal real-time processing of the payment and sends the order to Accounts Receivable |
setup_next_cart | boolean | True if the system should create another cart automatically if the current cart was logged into a profile |
skip_payment_processing | boolean | Skip payment processing and move the order on to shipping (or completed if no shipping required) |
store_completed | boolean | True the order in the completed stage |
store_if_payment_declines | boolean | Store the order in accounts receivable if the payment declines |
Name | Data Type | Description |
---|---|---|
errors | array of string | Error messages if the order could not be completed |
next_cart | Cart | Next cart if options.setup_next_cart=true and order created successfully |
order | Order | Order generated from the cart |
order_id | string | Order ID assigned to the order |
successful | boolean | True if the cart was converted successfully to an order |
Name | Data Type | Description |
---|---|---|
gift | boolean | True if this order is a gift |
gift_charge | (read only) Currency | Additional charge for making this order a gift |
gift_email | string(100) | Email address of the gift recipient |
gift_message | string(10000) | Message to the gift recipient |
gift_wrap_cost | (read only) Currency | Cost of the gift wrap selected |
gift_wrap_title | string(30) | Title of the selected gift wrap |
Name | Data Type | Description |
---|---|---|
gift_certificate_amount | (read only) Currency | The amount used on the gift certificate |
gift_certificate_code | string | Gift certificate code |
gift_certificate_remaining_balance_after_order | (read only) Currency | The amount of money left on the gift certificate after this order is completed |
Name | Data Type | Description |
---|---|---|
arbitrary_unit_cost | Currency | If authentication type is not browser key Arbitrary unit cost |
attributes | (read only) array of CartItemAttribute | Attributes |
auto_order_schedule | string | If schedules array is populated Auto order schedule the customer selected |
default_image_url | (read only) string | URL to the default multimedia image |
default_thumbnail_url | (read only) string | URL to the default multimedia thumbnail |
description | (read only) string | Description of the item |
discount | (read only) Currency | The discount on this item provided by a coupon |
extended_description | (read only) string | Extended description of the item |
item_id | string | Item ID |
item_oid | integer (int32) | Item object identifier |
kit | (read only) boolean | True if this item is a kit |
kit_component_options | array of CartKitComponentOption | Options associated with the kit components |
manufacturer_suggested_retail_price | (read only) Currency | Manufacture suggested retail price |
maximum_quantity | (read only) number | Maximum quantity the customer can purchase |
minimum_quantity | (read only) number | Minimum quantity the customer can purchase |
multimedia | (read only) array of CartItemMultimedia | Multimedia |
options | array of CartItemOption | Options |
phsyical | CartItemPhysical | Physical characteristcs |
position | (read only) integer (int32) | Position of the item in the cart |
preorder | (read only) boolean | True if this item is on pre-order |
properties | array of CartItemProperty | Properties associated with the item |
quantity | number | quantity |
schedules | (read only) array of string | Customer selectable auto order schedules |
total_cost | (read only) Currency | Total cost of item before discount |
total_cost_with_discount | (read only) Currency | Total cost of this item after discount |
unit_cost | (read only) Currency | Unit cost of the item |
unit_cost_with_discount | (read only) Currency | Unit cost of the item after discounts |
upsell | boolean | True if this item was added to the cart as part of an upsell |
variations | array of CartItemVariationSelection | Variations |
view_url | (read only) string | URL to view the product on the site |
Name | Data Type | Description |
---|---|---|
name | string | Name of the attribute |
type | string | Type of attribute
Allowed Values
|
value | string | Value of the attribute |
Name | Data Type | Description |
---|---|---|
code | string | Code assigned to the multimedia |
description | string | Description |
exclude_from_gallery | boolean | True if the image should be excluded from galleries |
image_height | integer (int32) | If type = Image Image height |
image_width | integer (int32) | If type = Image Image width |
is_default | boolean | True if the multimedia is the default for this type |
thumbnails | array of CartItemMultimediaThumbnail | Thumbnails of the images |
type | string | Type of multimedia
Allowed Values
|
url | string | URL to view multimedia at |
Name | Data Type | Description |
---|---|---|
height | integer (int32) | Height in pixels |
png | boolean | True if thumbnail is a PNG, otherwise its a JPEG |
square | boolean | True if the thumbnail is square |
url | string | URL for the thumbnail |
width | integer (int32) | Width in pixels |
Name | Data Type | Description |
---|---|---|
cost_if_specified | (read only) Currency | Cost if the option is specified |
cost_per_letter | (read only) Currency | Cost per letter of text (single or multiline options) |
cost_per_line | (read only) Currency | Cost per line of text (multiline options) |
ignore_if_default | (read only) boolean | True if the default answer is ignored |
label | (read only) string | Display label for the option |
name | (read only) string | Name of the option |
one_time_fee | (read only) boolean | Charge the fee a single time instead of multiplying by the quantity |
option_oid | (read only) integer (int32) | Unique identifier for the option |
required | (read only) boolean | True if the customer is required to select a value |
selected_value | string(1024) | The value of the option specified by the customer |
type | (read only) string | Type of option
Allowed Values
|
values | (read only) array of CartItemOptionValue | Values that the customer can select from for radio or select type options |
Name | Data Type | Description |
---|---|---|
additional_cost | Currency | Additional cost of the item if this option value is selected |
additional_weight | Weight | Additional weight of the item if this option is selected |
default_value | boolean | True if this is the default value |
display_order | integer (int32) | Display order of the option value |
value | string | Value of the option the customer can select |
Name | Data Type | Description |
---|---|---|
height | (read only) Distance | Height |
length | (read only) Distance | Length |
weight | (read only) Weight | Weight |
width | (read only) Distance | Width |
Name | Data Type | Description |
---|---|---|
display | boolean | True if this property is displayed to the customer |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(3800) | Value |
Name | Data Type | Description |
---|---|---|
variation_name | string | Variation name |
variation_value | string | Variation value |
Name | Data Type | Description |
---|---|---|
cost_if_specified | (read only) Currency | Cost if the option is specified |
cost_per_letter | (read only) Currency | Cost per letter of text (single or multi-line options) |
cost_per_line | (read only) Currency | Cost per line of text (multiline options) |
ignore_if_default | (read only) boolean | True if the default answer is ignored |
item_id | (read only) string | Kit component item id |
item_oid | (read only) integer (int32) | Unique identifier for the kit component item |
label | (read only) string | Display label for the option |
name | (read only) string | Name of the option |
one_time_fee | (read only) boolean | Charge the fee a single time instead of multiplying by the quantity |
option_oid | (read only) integer (int32) | Unique identifier for the option |
required | (read only) boolean | True if the customer is required to select a value |
selected_value | string(1024) | The value of the option specified by the customer |
type | (read only) string | Type of option
Allowed Values
|
values | (read only) array of CartItemOptionValue | Values that the customer can select from for radio or select type options |
Name | Data Type | Description |
---|---|---|
advertising_source | string | The advertising source the customer indicated |
cell_phone_opt_in | boolean | True if the customer agrees to receiving marketing SMS messages |
mailing_list_opt_in | boolean | True if the customer agrees to receiving marketing emails |
Name | Data Type | Description |
---|---|---|
affirm | CartPaymentAffirm | If payment_method = Affirm Affirm |
amazon | CartPaymentAmazon | If payment_method = Amazon Amazon |
check | CartPaymentCheck | If payment_method = Check Check |
credit_card | CartPaymentCreditCard | If payment_method = Credit Card Credit card |
health_benefit_card | CartPaymentHealthBenefitCard | Health benefit card |
payment_method | string | Payment method
Allowed Values
|
purchase_order | CartPaymentPurchaseOrder | If payment_method = Purchase Order Purchase order |
rtg_code | string | Rotating transaction gateway code |
Name | Data Type | Description |
---|---|---|
affirm_checkout_token | string | Affirm checkout token |
Name | Data Type | Description |
---|---|---|
amazon_order_reference_id | string | Amazon order reference id |
Name | Data Type | Description |
---|---|---|
check_number | integer (int32) | Check number they are paying with |
Name | Data Type | Description |
---|---|---|
card_expiration_month | integer (int32) | Card expiration month (1-12) |
card_expiration_year | integer (int32) | Card expiration year (four digit year) |
card_number | string | Card number (masked to the last 4) |
card_number_token | string | Hosted field token for the card number |
card_type | string | Card type |
card_verification_number | string | Card verification number (masked) |
card_verification_number_token | string | Hosted field token for the card verification number |
customer_profile_credit_card_id | integer (int32) | ID of the stored credit card to use |
store_credit_card | boolean | True if the customer wants to store the card on their profile for future re-use |
Name | Data Type | Description |
---|---|---|
health_benefit_card_expiration_month | integer (int32) | Health benefit expiration month (1-12) |
health_benefit_card_expiration_year | integer (int32) | Health benefit card expiration year (four digit year) |
health_benefit_card_number | string | Health benefit card number (masked to the last 4) |
health_benefit_card_number_token | string | Hosted field token for the card number |
health_benefit_card_verification_number | string | Health benefit card verification number (masked) |
health_benefit_card_verification_number_token | string | Hosted field token for the health benefit card verification number |
Name | Data Type | Description |
---|---|---|
purchase_order_number | string | Purchase order number |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
customer_profile_oid | integer (int32) | Unique identifier for customer profile. Can not be used with browser key authentication type. |
password | string | Password for the profile |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
errors | array of string | Errors to display to the customer if they failed any of the validations checked |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
password | string | Password for the profile |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
errors | array of string | Errors to display to the customer if they failed any of the validations checked |
Name | Data Type | Description |
---|---|---|
display | boolean | True if this property is displayed to the customer |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(3800) | Value |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
errors | array of string | Errors that should be displayed to the customer |
Name | Data Type | Description |
---|---|---|
billing | CartSettingsBilling | Billing settings for this cart |
gift | CartSettingsGift | Gift giving settings |
payment | CartSettingsPayment | Payment settings for this cart |
shipping | CartSettingsShipping | Shipping settings for this cart |
taxes | CartSettingsTaxes | Information on taxes for this cart |
terms | CartSettingsTerms | Terms of the checkout the customer must agree to |
Name | Data Type | Description |
---|---|---|
provinces | array of CartSettingsProvince | If _expand=settings.billing.provinces specified Provinces |
Name | Data Type | Description |
---|---|---|
allow_gifts | boolean | True if this checkout supports gift giving |
gift_charge | Currency | The cost associated with sending a gift |
gift_wraps | array of CartSettingsGiftWrap | The gift wraps available for the customer to select from |
max_message_length | integer (int32) | The maximum length of the gift message the giver can enter |
Name | Data Type | Description |
---|---|---|
cost | Currency | Cost if this gift wrap is selected |
title | string | Title of the gift wrap |
url | string | URL for the sample of the gift wrap |
Name | Data Type | Description |
---|---|---|
amazon | CartSettingsPaymentAmazon | If supports_amazon = true Amazon Payments information |
credit_card | CartSettingsPaymentCreditCard | If supports_credit_card = true Credit card payment information |
need_payment | boolean | True if this card requires a payment from the customer |
paypal | CartSettingsPaymentPayPal | If supports_paypal = true PayPal information |
supports_amazon | boolean | True if Amazon payments are available on this order |
supports_check | boolean | True if check payments are available on this order |
supports_cod | boolean | True if COD payments are available on this order |
supports_credit_card | boolean | True if credit card payments are available on this order |
supports_money_order | boolean | True if money order payments are available on this order |
supports_paypal | boolean | True if PayPal payments are available on this order |
supports_purchase_order | boolean | True if purchase order payments are available on this order |
supports_quote_request | boolean | True if quote requests payments are available on this order |
supports_wire_transfer | boolean | True if wire transfer payments are available on this order |
Name | Data Type | Description |
---|---|---|
amazon_button_url | string | Amazon button URL |
amazon_merchant_id | string | Amazon merchant ID |
amazon_widget_url | string | Amazon widget URL |
Name | Data Type | Description |
---|---|---|
collect_credit_card_verification_number | boolean | True if the credit card verification number should be collected |
collect_credit_card_verification_number_minimum | number | If this field is null or the total is greater than or equal to this value then collect the CVV2. |
credit_card_types | array of string | Available credit card types
Allowed Values
|
hosted_fields_shopping_cart_token | string | The shoppingCartToken needed for proper initialization of hosted fields collection |
Name | Data Type | Description |
---|---|---|
paypal_button_alt_text | string | PayPal button alt text |
paypal_button_url | string | PayPal button URL |
paypal_credit_button_url | string | PayPal Credit button URL |
paypal_credit_legal_image_url | string | PayPal Credit legal image URL |
paypal_credit_legal_url | string | PayPal Credit legal URL |
Name | Data Type | Description |
---|---|---|
code | string | |
province | string |
Name | Data Type | Description |
---|---|---|
deliver_on_date | CartSettingsShippingCalendar | If _expand=settings.shipping.deliver_on_date specified Deliver on date calendar information |
estimates | array of CartSettingsShippingEstimate | If _expand=settings.shipping.estimates specified Estimates for this cart |
need_shipping | boolean | True if this order needs shipping |
provinces | array of CartSettingsProvince | If _expand=settings.shipping.provinces specified Provinces |
ship_on_date | CartSettingsShippingCalendar | If _expand=settings.shipping.ship_on_date specified Ship on date calendar information |
Name | Data Type | Description |
---|---|---|
blackouts | array of string | Specified dates that are blacked out on the calendar in ISO8601 format |
days_of_week | array of boolean | Days of week that should be enabled on the calendar (0 - Sunday through 6 - Saturday) |
earliest | string | The earliest date that can be selected on the calendar |
require | boolean | True if the customer is required to select a date |
show | boolean | True if this calendar should be shown to the customer |
Name | Data Type | Description |
---|---|---|
allow_3rd_party_billing | boolean | True if this method allows the customer to use their own shipper account number |
comment | string | Comment to display to the customer about this method |
cost | Currency | Cost of this method |
cost_before_discount | Currency | Cost before discount by coupon |
default_method | boolean | True if this is the default method |
discount | Currency | Amount discounted by a coupon |
discounted | boolean | True if this method is discounted because of a coupon |
display_name | string | The name to display to the customer |
estimated_delivery | string | Date of the estimated delivery (or range) |
lift_gate_option | boolean | True if a lift gate option for this method should be offered to the customer |
name | string | Shipping method name |
pickup | boolean | True if this shipping method requires customers to physically pickup product themselves |
tax | Currency | Tax applied to this method if selected |
total_tax | Currency | Total amount of tax on the order if this method is selected |
Name | Data Type | Description |
---|---|---|
counties | array of string |
Name | Data Type | Description |
---|---|---|
html | string | HTML version of the terms |
text | string | Text version of the terms. |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
day_phone | string(25) | Day time phone |
delivery_date | string (dateTime) | Date the customer is requesting delivery on. Typically used for perishable product delivery. |
evening_phone | string(25) | Evening phone |
first_name | string(30) | First name |
last_name | string(30) | Last name |
lift_gate | boolean | Lift gate requested (LTL shipping methods only) |
postal_code | string(25) | Postal code |
ship_on_date | string (dateTime) | Date the customer is requesting that the order ship on. Typically used for perishable product delivery. |
ship_to_residential | boolean | True if the shipping adress is residential. Effects the methods that are available to the customer as well as the price of the shipping method. |
shipping_3rd_party_account_number | string(20) | 3rd party account number to ship against for UPS or FedEx |
shipping_method | string(40) | Shipping method |
special_instructions | string(10000) | Special instructions from the customer regarding shipping |
state_region | string(32) | State/Region |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
arbitrary_shipping_handling_total | Currency | If Overwrites the shipping and handling total normally calculated by UltraCart. Usable only if API authentication is not browser key. Arbitrary shipping/handling total |
arbitrary_tax | Currency | If Overwrites the calculated tax determined by UltraCart. Usable only if API authentication is not browser key. Arbitrary tax |
arbitrary_tax_rate | Currency | If Overwrites the tax rate normally calculated by UltraCart. Usable only if API authentication is not browser key. Arbitrary tax rate |
arbitrary_taxable_subtotal | Currency | If Overwrites the taxable subtotal normally calculated by UltraCart. Usable only if API authentication is not browser key. Arbitrary taxable subtotal |
health_benefit_card_amount | (read only) Currency | Health benefit card amount used |
health_benefit_card_balance | (read only) Currency | Health benefit card balance |
health_benefit_card_requirements | (read only) string | Health benefit card requirements |
internal_gift_certificate_amount | (read only) Currency | Internal gift certificate amount used (store credit) |
shipping_handling | Currency | Shipping/handling |
shipping_handling_discount | Currency | Shipping/handling discount |
shipping_handling_with_discount | Currency | Shipping/handling with discount |
subtotal | (read only) Currency | Subtotal |
subtotal_discount | (read only) Currency | Subtotal discount |
subtotal_with_discount | (read only) Currency | Subtotal with discount |
surcharge | (read only) Currency | Surcharge associated with the payment method |
tax | (read only) Currency | Tax |
taxable_subtotal | (read only) Currency | Taxable subtotal |
taxable_subtotal_discount | (read only) Currency | Taxable subttotal discount |
taxable_subtotal_with_discount | (read only) Currency | Taxable subtotal with discount |
total | (read only) Currency | Total |
Name | Data Type | Description |
---|---|---|
county | string(32) | Tax county if the state requires it. |
exempt | (read only) boolean | True if tax exempt |
rate | (read only) number | Tax rate |
Name | Data Type | Description |
---|---|---|
finalize_after_dts | string (dateTime) | The date/time after which the cart will finalize into an order. |
finalize_after_minutes | integer (int32) | The amount of inactivity in minutes after which the cart should be finalized into an order. This will calculate the finalize_after_dts field. |
upsell_path_code | string(5) | Upsell path code |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
checks | array of string | Checks to perform
Allowed Values
|
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
errors | array of string | Errors to display to the customer if they failed any of the validations checked |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
error_parameter_name | string | If any error happen during the processing on the UltraCart side, the browser will be redirected to your error_return_url with the error passed in this parameter name. |
error_return_url | string | The URL to return the browser to if there are processing errors on the UltraCart side. |
operation | string | The type of handoff operation to perform
Allowed Values
|
paypal_maximum_upsell_revenue | number | If operation=payPal or payPalCredit The maximum amount of revenue that you think the customer could add during a custom upsell after sequence on your checkout. |
paypal_return_url | string | If operation=payPal or payPalCredit The URl to return the customers browser to after they have completed the PayPal process. |
secure_host_name | string | The desired secure host name to perform the handoff on. This should match the desired StoreFront. |
ucacid | string | The UltraCart Analytics cookie value. Populate this if you're handing off from a different domain than the checkout. |
Name | Data Type | Description |
---|---|---|
cart | Cart | Cart |
errors | array of string | Errors that occurred which are preventing the handoff operation. Display these to the customer. |
redirect_to_url | string | The URL that you should redirect the customers browser to |
Name | Data Type | Description |
---|---|---|
allowed_referrers | array of string | Allowed referrers. If URLs are specified, automatic translation will convert them to proper allowed referrer maskes. |
Name | Data Type | Description |
---|---|---|
browser_key | string | Browser key that is used to authenticate against the new linked application. |
Name | Data Type | Description |
---|---|---|
stateProvinces | array of StateProvince |
Name | Data Type | Description |
---|---|---|
city | string | |
error | string | |
state | string | |
validZip | boolean | |
zip | string |
Name | Data Type | Description |
---|---|---|
iso_2_code | string(2) | iso_2_code |
name | string(50) | name |
Name | Data Type | Description |
---|---|---|
currency_code | string | Currency code of the localized value |
exchange_rate | number | Exchange rate used to localize |
localized | number | Value localized to the customer |
localized_formatted | string | Value localized and formatted for the customer |
value | number | Value in base currency |
Name | Data Type | Description |
---|---|---|
activity | CustomerActivity | activity by this customer |
affiliate_oid | integer (int32) | Affiliate oid |
allow_3rd_party_billing | boolean | Allow 3rd party billing |
allow_cod | boolean | Allow COD |
allow_drop_shipping | boolean | Allow Drop Shipping |
allow_purchase_order | boolean | Allow purchase orders by this customer |
allow_quote_request | boolean | Allow quote request |
allow_selection_of_address_type | boolean | Allow selection of residential or business address type |
attachments | array of CustomerAttachment | Attachments |
auto_approve_cod | boolean | Auto approve COD |
auto_approve_purchase_order | boolean | Auto approve purchase orders by this customer |
automatic_merchant_notes | string | Automatic merchant notes are added to every order placed |
billing | array of CustomerBilling | Billing addresses for this customer |
business_notes | string(2000) | Business notes (internally visible only) |
cards | array of CustomerCard | Credit Cards for this customer |
cc_emails | array of CustomerEmail | Additional emails to CC notification |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
dhl_account_number | string(20) | DHL account number |
dhl_duty_account_number | string(20) | DHL duty account number |
do_not_send_mail | boolean | Do not send mail (null will not update) |
edi | CustomerEDI | EDI settings |
string | Email address of this customer profile | |
exempt_shipping_handling_charge | boolean | Exempt shipping handling charge |
fedex_account_number | string(20) | FedEx account number |
free_shipping | boolean | This customer always receives free shipping |
free_shipping_minimum | number | If free_shipping is true, this is the minimum subtotal required for free shipping |
last_modified_by | (read only) string(100) | Last modified by |
last_modified_dts | (read only) string (dateTime) | Last modified date |
loyalty | CustomerLoyalty | Loyalty |
maximum_item_count | integer (int32) | Maximum item count |
merchant_id | (read only) string | Merchant ID |
minimum_item_count | integer (int32) | Minimum item count |
minimum_subtotal | number | Minimum subtotal |
no_coupons | boolean | No coupons |
no_free_shipping | boolean | No free shipping regardless of coupons or item level settings |
no_realtime_charge | boolean | No realtime charge |
orders | array of Order | Orders associated with this customer profile |
orders_summary | CustomerOrdersSummary | Summary of orders placed by this customer profile |
password | string(30) | Password (may only be set, never read) |
pricing_tiers | array of CustomerPricingTier | Pricing tiers for this customer |
privacy | CustomerPrivacy | Privacy settings of the customer profile |
properties | array of CustomerProperty | Properties for this customer |
qb_class | string | QuickBooks class to import this customer as |
qb_code | string | QuickBooks name to import this customer as |
qb_tax_exemption_reason_code | integer (int32) | QuickBooks tax exemption reason code |
quotes | array of Order | Quotes associated with this customer profile |
quotes_summary | CustomerQuotesSummary | Summary of the quotes submitted by this customer profile |
referral_source | string(50) | Referral Source |
reviewer | CustomerReviewer | Item reviewer information |
sales_rep_code | string(10) | Sales rep code |
send_signup_notification | boolean | Send signup notification, if true during customer creation, will send a notification. |
shipping | array of CustomerShipping | Shipping addresses for this customer |
signup_dts | (read only) string | Signup date |
software_entitlements | array of CustomerSoftwareEntitlement | Software entitlements owned by this customer |
suppress_buysafe | boolean | Suppress buySAFE (deprecated) |
tags | array of CustomerTag | Tags for this customer |
tax_codes | CustomerTaxCodes | Tax codes used by tax integrations |
tax_exempt | boolean | True if the customer is tax exempt |
tax_id | string(15) | Tax ID |
terms | string | Terms for this customer |
track_separately | boolean | True if the customer should be tracked separately in QuickBooks |
unapproved | boolean | Unapproved |
ups_account_number | string(20) | UPS account number |
website_url | string(100) | Website url |
Name | Data Type | Description |
---|---|---|
activities | array of Activity | |
global_unsubscribed | boolean | |
global_unsubscribed_dts | string | |
memberships | array of ListSegmentMembership | |
metrics | array of Metric | |
properties_list | array of Property | |
spam_complaint | boolean | |
spam_complaint_dts | string |
Name | Data Type | Description |
---|---|---|
customer_profile_attachment_oid | (read only) integer (int32) | Attachment identifier |
description | string | Description |
file_name | (read only) string | File name |
mime_type | (read only) string | Mime type |
upload_dts | (read only) string (dateTime) | Upload date/time |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
customer_billing_oid | (read only) integer (int32) | Customer profile billing object identifier |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
day_phone | string(25) | Day phone |
default_billing | boolean | Default billing |
evening_phone | string(25) | Evening phone |
first_name | string(30) | First name |
last_name | string(30) | Last name |
last_used_dts | string (dateTime) | Last used date |
postal_code | string(20) | Postal code |
state_region | string(32) | State for United States otherwise region or province for other countries |
tax_county | string(32) | Tax County |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
card_expiration_month | integer (int32) | Card expiration month (1-12) |
card_expiration_year | integer (int32) | Card expiration year (four digit year) |
card_number | string | Card number (masked to the last 4) |
card_number_token | string | Hosted field token for the card number |
card_type | string | Card type |
customer_profile_credit_card_id | integer (int32) | ID of the stored credit card to use |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
last_used_dts | string (dateTime) | Last used date |
Name | Data Type | Description |
---|---|---|
channel_partner_oid | integer (int32) | EDI channel partner this customer profile is associated with |
distribution_center_number | string | The EDI distribution center number associated with this customer profile. |
store_number | string | The EDI store number associated with this customer profile. |
Name | Data Type | Description |
---|---|---|
customer_profile_email_oid | integer (int32) | ID of the email |
string(100) | ||
label | string(100) | Label |
receipt_notification | boolean | CC this email on receipt notifications |
refund_notification | boolean | CC this email on refund notifications |
shipment_notification | boolean | CC this email on shipment notifications |
Name | Data Type | Description |
---|---|---|
current_points | (read only) integer (int32) | Current points |
internal_gift_certificate | GiftCertificate | The internal gift certificate that is used to manage cashback points under the hood |
internal_gift_certificate_balance | (read only) string | Loyalty Cashback / Store credit balance (internal gift certificate balance) |
internal_gift_certificate_oid | (read only) integer (int32) | Internal gift certificate oid used to tracking loyalty cashback / store credit. |
ledger_entries | (read only) array of CustomerLoyaltyLedger | Ledger entries |
pending_points | (read only) integer (int32) | Pending Points |
redemptions | (read only) array of CustomerLoyaltyRedemption | Redemptions |
Name | Data Type | Description |
---|---|---|
created_by | (read only) string | Created By |
created_dts | (read only) string (dateTime) | Created date |
description | (read only) string | Description |
(read only) string | ||
item_id | (read only) string | Item Id |
item_index | (read only) integer (int32) | Item Index |
ledger_dts | (read only) string (dateTime) | Ledger date |
loyalty_campaign_oid | (read only) integer (int32) | Loyalty campaign oid |
loyalty_ledger_oid | (read only) integer (int32) | Loyalty ledger oid |
loyalty_points | (read only) integer (int32) | Loyalty points |
modified_by | (read only) string | Modified By |
modified_dts | (read only) string (dateTime) | Modified date |
order_id | (read only) string | Order Id |
quantity | (read only) integer (int32) | Quantity |
vesting_dts | (read only) string (dateTime) | Vesting date |
Name | Data Type | Description |
---|---|---|
coupon_code | (read only) string | Coupon code |
coupon_code_oid | (read only) integer (int32) | Coupon code OID |
coupon_used | (read only) boolean | Coupon used |
description_for_customer | (read only) string | Description for customer |
expiration_dts | (read only) string (dateTime) | Expiration date |
gift_certificate_code | (read only) string | Gift certificate code |
gift_certificate_oid | (read only) integer (int32) | Gift certificate oid |
loyalty_ledger_oid | (read only) integer (int32) | Loyalty ledger OID |
loyalty_points | (read only) integer (int32) | Loyalty points |
loyalty_redemption_oid | (read only) integer (int32) | Loyalty redemption OID |
order_id | (read only) string | Order id |
redemption_dts | (read only) string (dateTime) | Redemption date |
remaining_balance | (read only) number | Remaining balance |
Name | Data Type | Description |
---|---|---|
first_order_dts | (read only) string (dateTime) | First order date |
last_order_dts | (read only) string (dateTime) | Last order date |
order_count | integer (int32) | Total number of orders |
total | number | Total amount associated with the orders |
Name | Data Type | Description |
---|---|---|
name | string(50) | Name |
pricing_tier_oid | integer (int32) | Pricing Tier Oid |
Name | Data Type | Description |
---|---|---|
last_update_dts | (read only) string (dateTime) | Last update date |
marketing | (read only) boolean | The customer has opted in to marketing |
preference | (read only) boolean | The customer has opted in to preference tracking |
statistics | (read only) boolean | The customer has opted in to statistics collection |
Name | Data Type | Description |
---|---|---|
customer_profile_property_oid | integer (int32) | Customer profile property oid |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(1500) | Value |
Name | Data Type | Description |
---|---|---|
first_quote_dts | (read only) string (dateTime) | First quote date |
last_quote_dts | (read only) string (dateTime) | Last quote date |
quote_count | integer (int32) | Total number of quote |
total | number | Total amount associated with the quotes |
Name | Data Type | Description |
---|---|---|
auto_approve | boolean | True if reviewes from this customer profile should automatically be approved |
average_overall_rating | (read only) number | Average overall rating of items reviewed |
expert | boolean | True if the customer is an expert |
first_review | (read only) string (dateTime) | First review |
last_review | (read only) string (dateTime) | Last review |
location | string | Location of the reviewer |
nickname | string | Nickname of the reviewer |
number_helpful_review_votes | (read only) integer (int32) | Number of helpful review votes |
rank | (read only) integer (int32) | Rank of this reviewer |
reviews_contributed | (read only) integer (int32) | Number of reviews contributed |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
customer_shipping_oid | (read only) integer (int32) | Customer profile shipping object identifier |
day_phone | string(25) | Day phone |
default_shipping | boolean | Default shipping |
evening_phone | string(25) | Evening phone |
first_name | string(30) | First name |
last_name | string(30) | Last name |
last_used_dts | string (dateTime) | Last used date |
postal_code | string(20) | Postal code |
state_region | string(32) | State for United States otherwise region or province for other countries |
tax_county | string(32) | Tax County |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
activation_code | string(50) | Activation Code Associated with the software |
activation_dts | string (dateTime) | Date/time when the activation code was created |
customer_software_entitlement_oid | (read only) integer (int32) | Customer profile software entitlement object identifier |
expiration_dts | string (dateTime) | Date/time when the activation code will expire |
purchased_via_item_description | (read only) string(512) | Item description used to purchase this software. |
purchased_via_item_id | (read only) string(20) | Item ID used to purchase this software. |
purchased_via_order_id | (read only) string(30) | Order ID used to purchase this software. |
software_sku | string(30) | SKU of the software |
Name | Data Type | Description |
---|---|---|
tag_value | string(250) | Tag Value |
Name | Data Type | Description |
---|---|---|
avalara_customer_code | string | Avalara customer code |
avalara_entity_use_code | string | Avalara entity use code |
sovos_customer_code | string | Sovos customer code |
taxjar_customer_id | string | TaxJar customer id |
taxjar_exemption_type | string | TaxJar exemption type |
Name | Data Type | Description |
---|---|---|
uom | string | Unit of measure
Allowed Values
|
value | number | The distance measured in UOM |
Name | Data Type | Description |
---|---|---|
developer_message | string | A technical message meant to be read by a developer |
error_code | string | HTTP status code |
more_info | string | Additional information often a link to additional documentation |
object_id | string | Object id that the error is associated with |
user_message | string | An end-user friendly message suitable for display to the customer |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
activated | boolean | True if this gift certificate is activated and ready to apply to purchases. |
code | (read only) string | The code used by the customer to purchase against this gift certificate. |
customer_profile_oid | (read only) integer (int32) | This is the customer profile oid associated with this internally managed gift certificate. |
deleted | boolean | True if this gift certificate was deleted. |
string(100) | Email of the customer associated with this gift certificate. | |
expiration_dts | string (dateTime) | Expiration date time. |
gift_certificate_oid | (read only) integer (int32) | Gift certificate oid. |
internal | (read only) boolean | This is an internally managed gift certificate associated with the loyalty cash rewards program. |
ledger_entries | (read only) array of GiftCertificateLedgerEntry | A list of all ledger activity for this gift certificate. |
merchant_id | string | Merchant Id |
merchant_note | string | A list of all ledger activity for this gift certificate. |
original_balance | (read only) number | Original balance of the gift certificate. |
reference_order_id | (read only) string | The order used to purchase this gift certificate. This value is ONLY set during checkout when a certificate is purchased, not when it is used. Any usage is recorded in the ledger |
remaining_balance | (read only) number | The remaining balance on the gift certificate. This is never set directly, but calculated from the ledger. To change the remaining balance, add a ledger entry. |
Name | Data Type | Description |
---|---|---|
amount | number | The amount of the activity. |
description | string(50) | Description of what this ledger entry is used. |
entry_dts | string (dateTime) | Date time of this ledger activity. |
gift_certificate_ledger_oid | integer (int32) | Gift certificate ledger oid is a primary key for this object, used internally. |
gift_certificate_oid | integer (int32) | Gift certificate oid. |
reference_order_id | string | The order id if this gift certificate was used as part of the payment. |
Name | Data Type | Description |
---|---|---|
accounting | ItemAccounting | Accounting such as QuickBooks codes |
amember | ItemAmember | Amember configuration |
auto_order | ItemAutoOrder | Auto Order |
ccbill | ItemCCBill | CCBill.com (Deprecated) |
channel_partner_item_mappings | array of ItemChannelPartnerMapping | Channel Partner Item Mapping |
chargeback | ItemChargeback | Chargeback (deprecated) |
checkout | ItemCheckout | Checkout |
content | ItemContent | Content such as multimedia and attributes |
creation_dts | (read only) string (dateTime) | Date/time of creation |
description | string(512) | Description of the item up to 500 characters. |
description_translated_text_instance_oid | (read only) integer (int32) | Description translated text instance id |
digital_delivery | ItemDigitalDelivery | Digital Delivery |
ebay | ItemEbay | e-Bay |
email_notifications | ItemEmailNotifications | Email notifications |
enrollment123 | ItemEnrollment123 | Enrollment123.com |
fulfillment_addons | array of ItemFulfillmentAddon | Fulfillment Add-ons |
gift_certificate | ItemGiftCertificate | Gift Certificate |
google_product_search | ItemGoogleProductSearch | Google Product Search |
identifiers | ItemIdentifiers | Identifiers such as SKU, Barcode, etc. |
inactive | boolean | True if this item is inactive and can not be purchased |
instant_payment_notifications | ItemInstantPaymentNotifications | Instance Payment Notifications |
internal | ItemInternal | Internal information such as memo |
kit | boolean | True if this item is a kit |
kit_component_only | boolean | True if this item can only be usd as a kit component |
kit_definition | ItemKitDefinition | Kit Definition |
last_modified_dts | (read only) string (dateTime) | Date/time of last modification |
merchant_id | string(5) | UltraCart merchant ID owning item |
merchant_item_id | string(20) | Unique item id assigned to this item |
merchant_item_oid | (read only) integer (int32) | Unique object identifier for this item |
options | array of ItemOption | Options |
parent_category_id | integer (int32) | Parent category of the item. Zero indicates the root folder. |
parent_category_path | string | Parent category path. / indicates the root folder. |
payment_processing | ItemPaymentProcessing | Payment Processing |
physical | ItemPhysical | Physical characters like weight and measurements |
pricing | ItemPricing | Pricing |
properties | array of ItemProperty | Properties |
realtime_pricing | ItemRealtimePricing | Real-time Pricing |
recommend_replenishment_days | integer (int32) | Number of days to recommend replenishment after. Null is not configured. Set to zero to disable. |
related | ItemRelated | Related items |
reporting | ItemReporting | Reporting |
restriction | ItemRestriction | Restrictions |
revguard | ItemRevguard | Revguard.com (Deprecated) |
reviews | ItemReviews | Reviews |
salesforce | ItemSalesforce | Salesforce.com configuration |
shipping | ItemShipping | Shipping |
tags | ItemTags | Tags |
tax | ItemTax | Tax settings |
third_party_email_marketing | array of ItemThirdPartyEmailMarketing | 3rd Party Email Marketing |
variant_items | array of ItemVariantItem | Variant Items |
variations | array of ItemVariation | Variations |
wishlist_member | ItemWishlistMember | WishList Member |
Name | Data Type | Description |
---|---|---|
accounting_code | string(50) | QuickBooks item name if different than the item id |
qb_class | string(31) | QuickBooks class if you are classifying items on your invoices/receipts |
Name | Data Type | Description |
---|---|---|
amember_payment_duration_days | integer (int32) | The number of days that the customer should be given access to the item |
amember_product_id | string(10) | A-member product id give customer access to when they purchase this item |
Name | Data Type | Description |
---|---|---|
auth_future_amount | number | Amount to try and authorize for the future rebill |
auth_test_amount | number | Amount to try and test authorize |
auto_order_cancel_charge_minimum_balance | boolean | If true, the cost of the cancel item will be the remaining balance of the minimum rebill or lifetime value |
auto_order_cancel_item_id | string(20) | Item id to attempt charging the customer for if they cancel |
auto_order_cancel_item_oid | integer (int32) | Item object identifier to attempt charging the customer for if they cancel |
auto_order_cancel_minimum_life_time_count | integer (int32) | The minimum life time count that must be billed in order to not be charged the cancellation item. |
auto_order_cancel_minimum_life_time_value | number | The minimum life time value that must be paid in order to not be charged the cancellation item. |
auto_order_cancel_minimum_rebill_count | integer (int32) | The minimum rebill count that must be billed in order to not be charged the cancellation item. |
auto_order_cancel_minimum_rebill_value | number | The minimum rebill value that must be paid in order to not be charged the cancellation item. |
auto_order_downgrade_items | array of string | List of downgrade items presented to customer service representatives |
auto_order_paused | boolean | True if the rebill processing of this item is paused |
auto_order_prohibit_expiring_cards | integer (int32) | Minimum number of months before expiration for the card. Overrides the account level setting if higher. Set to zero to disable. |
auto_order_schedules | array of string | The user selectable schedules that are available
Allowed Values
|
auto_order_upgrade_items | array of string | List of upgrade items presented to customer service representatives |
auto_order_upsell | boolean | True if this item uses a fixed upsell step schedule |
auto_order_upsell_no_easy_cancel | boolean | Do not send the easy cancel email to the customer |
auto_order_upsell_one_per_customer | boolean | Limit the purchase of this item to one per customer |
auto_orderable | boolean | True if this item can be automatically ordered by the customer |
cancel_other_auto_orders | boolean | True if other auto orders for this customer should be canceled when this item is ordered |
free_shipping_auto_order | boolean | True if the customer should be given free shipping |
refund_other_auto_orders | boolean | True if other auto orders for this customer should refunded if this item is refunded. |
steps | array of ItemAutoOrderStep | The rebill steps if this auto order is an upsell |
Name | Data Type | Description |
---|---|---|
arbitrary_schedule_days | integer (int32) | If the schedule is arbitrary, then this is the number of days |
arbitrary_unit_cost | number | Arbitrary unit cost used to override the regular item cost |
arbitrary_unit_cost_schedules | array of ItemAutoOrderStepArbitraryUnitCostSchedule | Arbitrary unit costs schedules for more advanced discounting by rebill attempt |
grandfather_pricing | array of ItemAutoOrderStepGrandfatherPricing | Grand-father pricing configuration if the rebill schedule has changed over time |
managed_by | string | Managed by (defaults to UltraCart)
Allowed Values
|
pause_days | integer (int32) | Number of days to pause |
pause_until_date | string (dateTime) | Wait for this step to happen until the specified date |
pause_until_day_of_month | integer (int32) | Pause until a specific day of the month |
pause_until_minimum_delay_days | integer (int32) | Pause at least this many days between the last order and the calculated next day of month |
preshipment_notice_days | integer (int32) | If set, a pre-shipment notice is sent to the customer this many days in advance |
recurring_merchant_item_id | string(20) | Item id to rebill |
recurring_merchant_item_oid | integer (int32) | Item object identifier to rebill |
repeat_count | integer (int32) | Number of times to rebill. Last step can be null for infinite |
schedule | string | Frequency of the rebill
Allowed Values
|
subscribe_email_list_name | string | Email list name to subscribe the customer to when the rebill occurs (decommissioned email engine) |
subscribe_email_list_oid | integer (int32) | Email list identifier to subscribe the customer to when this rebill occurs (decommissioned email engine) |
type | string | Type of step (item, kit only, loop or pause)
Allowed Values
|
Name | Data Type | Description |
---|---|---|
arbitrary_unit_cost | number | Arbitrary unit cost |
retry_days | integer (int32) | Retry days |
Name | Data Type | Description |
---|---|---|
on_or_before_date | string (dateTime) | On or before date |
unit_cost | number | Unit cost |
Name | Data Type | Description |
---|---|---|
ccbill_allowed_currencies | string | Allowed currencies |
ccbill_allowed_types | string | Allowed types |
ccbill_currency_code | string | Currency code |
ccbill_form_name | string | Form name |
ccbill_subaccount_id | string | Sub-account id |
ccbill_subscription_type_id | string | Subscription type id |
Name | Data Type | Description |
---|---|---|
barcode_ua | string | Barcode UA (EDI only) |
barcode_uc | string | Barcode UC (EDI only) |
barcode_ui | string | Barcode UI (EDI only) |
barcode_uk | string | Barcode UK (EDI only) |
buyer_catalog_number | string | Buyer catalog number (EDI only) |
buyer_dpci | string | Buyer DPCI (EDI only) |
buyer_item_number | string | Buyer item number (EDI only) |
channel_partner_code | string | Channel partner code |
channel_partner_oid | integer (int32) | Channel partner object identifier |
cost | number | Cost given to this channel partner |
from_item_id | string(30) | From Item ID |
from_sku | string(50) | From SKU |
mutually_defined_number | string | Mutually defined number (EDI only) |
quantity_ratio_cp | integer (int32) | Ratio (Channel Partner) |
quantity_ratio_uc | integer (int32) | Ratio (UltraCart) |
sku | string(50) | SKU |
unit_of_measure | string | Unit of measure |
vendor_number | string | Vendor number (EDI only) |
vendor_style_number | string | Vendor style number (EDI only) |
Name | Data Type | Description |
---|---|---|
addendums | array of ItemChargebackAddendum | Addendums (deprecated) |
adjustment_requests | array of ItemChargebackAdjustmentRequest | Adjustment requests (deprecated) |
Name | Data Type | Description |
---|---|---|
chargeback_addendum_oid | integer (int32) | Chargeback addendum object identifier |
description | string | Description |
file_size | integer (int32) | Size of the file |
pages | integer (int32) | Number of pages |
Name | Data Type | Description |
---|---|---|
chargeback_adjustment_request_oid | integer (int32) | Chargeback adjustment request object identifier |
description | string | Description |
reason_code | string | Reason code |
Name | Data Type | Description |
---|---|---|
suppress_buysafe | boolean | True to suppress buySAFE (deprecated) |
terms | string(10000) | Terms for purchasing this item |
terms_if_auto_order | boolean | Terms only apply if the item is on auto order |
terms_translated_text_instance_oid | (read only) integer (int32) | Terms translated text instance identifier |
Name | Data Type | Description |
---|---|---|
assignments | array of ItemContentAssignment | StoreFront assignments |
attributes | array of ItemContentAttribute | StoreFront attributes |
custom_thank_you_url | string | Custom Thank You URL |
exclude_from_search | boolean | Exclude from search |
exclude_from_sitemap | boolean | Exclude from the sitemap for the StoreFront |
exclude_from_top_sellers | boolean | Exclude from the top sellers list in the StoreFront |
extended_description | string(10000) | Extended description (max 10000 characters) |
extended_description_translated_text_instance_oid | (read only) integer (int32) | Extended description text translation instance identifier |
meta_description | string | SEO meta description used by Storefronts |
meta_keywords | string | SEO meta keywords used by Storefronts |
meta_title | string | SEO meta title used by Storefronts |
multimedia | array of ItemContentMultimedia | Multimedia |
new_item | boolean | True if the item is new |
new_item_end | string (dateTime) | The date the item should no longer be considered new |
new_item_start | string (dateTime) | The date the item should start being considered new |
view_url | string | Legacy view URL (not used by StoreFronts) |
Name | Data Type | Description |
---|---|---|
default_assignment | boolean | True if this group is the default assignment for this item |
group_oid | integer (int32) | Page (group) object identifier |
group_path | string | Page (group) path |
host | string | StoreFront host name |
sort_order | integer (int32) | Sort order (optional) |
url_part | string(150) | URL part if the item id is not used |
Name | Data Type | Description |
---|---|---|
name | string(400) | Attribute name |
translated_text_instance_oid | (read only) integer (int32) | Attribute translated text instance identifier |
type | string | Attribute type
Allowed Values
|
value | string(100000) | Attribute value |
Name | Data Type | Description |
---|---|---|
cloud_url | (read only) string | URL where the image can be downloaded from the cloud |
cloud_url_expiration | (read only) string (dateTime) | Expiration date of the cloud URL |
code | string(20) | Code assigned to the file |
description | string(50000) | Description |
exclude_from_gallery | boolean | True to exclude from multimedia gallery |
file_name | string(75) | File name |
height | integer (int32) | Height of the image |
merchant_item_multimedia_oid | integer (int32) | Item multimedia object identifier |
orphan | boolean | True if the multimedia is an orphan of the active StoreFront themes |
placeholder | boolean | True if the object is a place holder that can be populated |
temp_multimedia_oid | integer (int32) | Temporary multimedia object identifier assigned if uploading new multimedia |
thumbnails | array of ItemContentMultimediaThumbnail | Thumbnails of this image |
type | string | Type of file
Allowed Values
|
url | string | URL to download file (on new multimedia record this can be a URL for UltraCart to fetch) |
width | integer (int32) | Width of the image |
Name | Data Type | Description |
---|---|---|
height | integer (int32) | Height of the thumbnail |
http_url | string | HTTP URL to view the thumbnail |
https_url | string | HTTPS URL to view the thumbnail |
png_format | boolean | True if PNG, false if JPEG |
square | boolean | True if the thumbnail is square |
width | integer (int32) | Width of the thumbnail |
Name | Data Type | Description |
---|---|---|
activation_code_description | string(50) | Description of the activation code |
activation_code_low_warning | integer (int32) | The number of activation codes whcih should generate a warning email |
activation_code_realtime_url | string(350) | The URL to retrieve activation codes from in real-time |
activation_code_shared_secret | string(20) | Shared secret used when communicating with the real-time URL |
activation_code_type | string | Type of activation code
Allowed Values
|
digital_items | array of ItemDigitalItem | Digital items that customer can download when this item is purchased |
Name | Data Type | Description |
---|---|---|
click_wrap_agreement | string | Click wrap agreement is presented to the customer before they can purchase your product. |
creation_dts | (read only) string (dateTime) | File creation date |
description | string(200) | Description of the digital item |
digital_item_oid | integer (int32) | The Digital item oid is a primary key used internally by UltraCart. You should not set or change this value. Doing so will have no effect. |
external_id | string(100) | External Id useful for syncing with a remote filesystem, this may be an MD5 hash or whatever suits your needs. |
file_size | (read only) integer (int64) | File size |
import_from_url | string | This url is sourced to create or update a digital file in your digital library. It is only considered during an insert or update operation. |
mime_type | (read only) string(100) | Mime type associated with the file |
original_filename | string(250) | Original filename |
pdf_meta | ItemDigitalItemPdfMeta | Additional properties for pdf files |
Name | Data Type | Description |
---|---|---|
assembly_allowed | boolean | Assembly allowed |
copy_allowed | boolean | Copy/Paste is allowed |
custom_footer | string(8000) | A custom footer for each pdf page |
custom_header | string(8000) | A custom header for each pdf page |
degraded_printing_allowed | boolean | Degraded printing allowed |
fillin_allowed | boolean | Fillin is allowed |
modify_annotations_allowed | boolean | Modifying annotations is allowed |
modify_contents_allowed | boolean | Modifying contents is allowed |
printing_allowed | boolean | Printing is allowed |
screen_readers_allowed | boolean | Screen readers are allowed |
tagged | boolean | PDF is tagged |
Name | Data Type | Description |
---|---|---|
active | boolean | True if the item is active for listing |
category_id | integer (int32) | e-Bay category ID |
category_specifics | array of ItemEbayCategorySpecific | Answers to category specific questions |
condition_description | string | Description of the condition (e-Bay constant) |
condition_id | integer (int32) | Numerical ID of the condition (e-Bay constant) |
consecutive_failures | integer (int32) | Number of consecutive failures trying to list this item |
custom_category1 | integer (int64) | e-Bay Store category 1 |
custom_category2 | integer (int64) | e-Bay Store category 2 |
dispatch_time_max | integer (int32) | Maximum number of days it will take to ship the item |
domestic_1_additional_cost | number | Domestic 1 method additional item cost |
domestic_1_first_cost | number | Domestic 1 method first item cost |
domestic_2_additional_cost | number | Domestic 2 method additional item cost |
domestic_2_first_cost | number | Domestic 2 method first item cost |
domestic_3_additional_cost | number | Domestic 3 method additional item cost |
domestic_3_first_cost | number | Domestic 3 method first item cost |
domestic_4_additional_cost | number | Domestic 4 method additional item cost |
domestic_4_first_cost | number | Domestic 4 method first item cost |
ebay_auction_id | string | If listed, this is the e-Bay auction id |
ebay_specific_inventory | integer (int32) | e-Bay specific inventory |
ebay_template_name | string | The template name to use hwen rendering the e-Bay listing |
ebay_template_oid | integer (int32) | The template object identifier to use when rendering the e-Bay listing |
end_time | (read only) string (dateTime) | Date/time of the auction end |
free_shipping | boolean | True if item receives free shipping |
free_shipping_method | string | The method that is free for free shipping |
international_1_additional_cost | number | International 1 method additional item cost |
international_1_first_cost | number | International 1 method first item cost |
international_2_additional_cost | number | International 2 method additional item cost |
international_2_first_cost | number | International 2 method first item cost |
international_3_additional_cost | number | International 3 method additional item cost |
international_3_first_cost | number | International 3 method first item cost |
international_4_additional_cost | number | International 4 method additional item cost |
international_4_first_cost | number | International 4 method first item cost |
last_status_dts | (read only) string (dateTime) | Date/time of the last status check |
listed_dispatch_time_max | integer (int32) | Current listing dispatch time maximum |
listed_ebay_template_oid | integer (int32) | The template object identifier used for the listing |
listing_dts | (read only) string (dateTime) | Date/time of the listing |
listing_duration | string | The duration of the listing
Allowed Values
|
listing_price | number | Price to list the item at |
listing_price_override | number | The price to list the item at if different than the regular UltraCart item price |
listing_type | string | The type of e-Bay listing |
marketplace_analysis | (read only) ItemEbayMarketPlaceAnalysis | Details of the marketplace analysis |
marketplace_analysis_perform | boolean | True if marketplace analysis should be performed |
marketplace_final_value_fee_percentage | number | Marketplace FVF percentage |
marketplace_last_check_dts | (read only) string (dateTime) | Date/time of the marketplace analysis last check |
marketplace_lowest | (read only) boolean | True if we are the lowest offer in the marketplace |
marketplace_map_violation | (read only) boolean | True if another seller is violating MAP |
marketplace_multiplier | number | Marketplace multiplier |
marketplace_other_price | (read only) number | Marketplace other price |
marketplace_other_seller | (read only) string | Marketplace other seller |
marketplace_other_shipping | (read only) number | Marketplace other shipping |
marketplace_other_total | (read only) number | Marketplace other total |
marketplace_our_additional_profit_potential | number | Marketplace our additional profit potential |
marketplace_our_price | (read only) number | Marketplace our price |
marketplace_our_profit | (read only) number | Marketplace our profit |
marketplace_our_shipping | (read only) number | Marketplace our shipping |
marketplace_our_total | (read only) number | Marketplace our total |
marketplace_overhead | number | Marketplace overhead |
marketplace_profitable | (read only) boolean | True if our listing is profitable to sell |
next_attempt_dts | (read only) string (dateTime) | Date/time for the next attempt to list |
next_listing_duration | string | The next listing duration to use when the current listing ends.
Allowed Values
|
no_promotional_shipping | boolean | True if the item should not qualify for promotional shipping |
packaging_handling_costs | number | Packaging and handling costs |
previous_ebay_auction_id | (read only) string | Previous e-Bay auction id |
quantity | integer (int32) | Quantity available of the item |
reserve_price | number | Reserve price |
send_dimensions_and_weight | string | How to send the item dimensions and weights to e-Bay
Allowed Values
|
start_time | (read only) string | Date/time of the auction start |
status | string | Status of the item's listing
Allowed Values
|
target_dispatch_time_max | integer (int32) | Typical number of days it will take to ship the item |
Name | Data Type | Description |
---|---|---|
name | string | Name of the category specification field |
value | string | Value |
Name | Data Type | Description |
---|---|---|
auction_id | string | Auction ID |
price | number | Price |
seller | string | Seller |
shipping | number | Shipping |
total | number | Total |
Name | Data Type | Description |
---|---|---|
adjusted_price | number | Adjusted price |
adjusted_shipping | number | Adjusted shipping |
adjusted_total | number | Adjusted total |
cogs | number | Cost of goods sold |
final_value_fee | number | Final value fee |
minimum_advertised_price | number | Minimum advertised price |
other_listings | array of ItemEbayMarketListing | Other listings |
our_listing | ItemEbayMarketListing | Our listing |
overhead | number | Overhead |
profit_potential | number | Profit potential |
Name | Data Type | Description |
---|---|---|
skip_receipt | boolean | Skip receipt email to customer |
skip_shipment_notification | boolean | Skip shipment notification to customer |
Name | Data Type | Description |
---|---|---|
enrollment123_product_code | string | Enrolment 123 product code |
Name | Data Type | Description |
---|---|---|
add_item_id | (read only) string | Add Item Id |
add_item_oid | integer (int32) | Add Item object identifier |
initial_order_only | boolean | Initial Order Only |
once_per_order | boolean | Once Per Order |
quantity | integer (int32) | Quantity |
Name | Data Type | Description |
---|---|---|
gift_certificate | boolean | True if the purchase of this item generates a gift certificate |
gift_certificate_expiration_days | integer (int32) | The number of days that the gift certificate is good for (optional) |
Name | Data Type | Description |
---|---|---|
adwords_grouping | string(50) | Adwords grouping |
adwords_label1 | string(50) | Adwords label 1 |
adwords_label2 | string(50) | Adwords label 2 |
adwords_label3 | string(50) | Adwords label 3 |
adwords_label4 | string(50) | Adwords label 4 |
adwords_label5 | string(50) | Adwords label 5 |
age_group | string(5) | Age group |
available_at_physical_store | boolean | Available at physical store |
book_author | string(50) | Book - author |
book_format | string(50) | Book - format |
book_isbn | string(20) | Bood - ISBN |
book_publisher | string(50) | Book - publisher |
category_description | string(1000) | Category description |
color | string(100) | Color |
condition | string(15) | Condition |
custom_label0 | string(50) | Custom label 0 |
custom_label1 | string(50) | Custom label 1 |
custom_label2 | string(50) | Custom label 2 |
custom_label3 | string(50) | Custom label 3 |
custom_label4 | string(50) | Custom label 4 |
gender | string(6) | Gender |
google_product_category | string(250) | Google product category |
music_artist | string(50) | Music - artist |
music_format | string(5) | Music - format |
music_release_date | string (dateTime) | Music - release date |
omit_from_feed | boolean | Omit from feed |
product_type | string(10) | Product type |
promotion_id1 | string(30) | Promotion ID 1 |
promotion_id10 | string(30) | Promotion ID 10 |
promotion_id2 | string(30) | Promotion ID 2 |
promotion_id3 | string(30) | Promotion ID 3 |
promotion_id4 | string(30) | Promotion ID 4 |
promotion_id5 | string(30) | Promotion ID 5 |
promotion_id6 | string(30) | Promotion ID 6 |
promotion_id7 | string(30) | Promotion ID 7 |
promotion_id8 | string(30) | Promotion ID 8 |
promotion_id9 | string(30) | Promotion ID 9 |
search_dts | string (dateTime) | Search date/time |
search_lowest_price | number | Search lowest price |
search_lowest_url | string(250) | Search lowest URL |
search_position | integer (int32) | Search position |
shippingLabel | string | |
size | string(20) | Size |
video_director | string(50) | Video - director |
video_format | string(5) | Video - format |
video_rating | string(5) | Video - rating |
video_release_date | string (dateTime) | Video - release date |
video_starring | string(150) | Video - starring |
Name | Data Type | Description |
---|---|---|
barcode | string(30) | Barcode |
barcode_gtin12 | string(12) | Barcode - GTIN 12 |
barcode_gtin14 | string(14) | Barcode - GTIN 14 |
barcode_upc11 | string(11) | Barcode - UPC 11 |
barcode_upc12 | string(12) | Barcode - UPC 12 |
manufacturer_name | string(50) | Manufacturer Name |
manufacturer_sku | string(25) | Manufacturer SKU |
unspsc | string(20) | UNSPSC |
Name | Data Type | Description |
---|---|---|
post_operation | boolean | True for HTTP POST instead of GET |
successful_response_text | string(1024) | Successful response text |
url | string(1024) | URL |
Name | Data Type | Description |
---|---|---|
notifications | array of ItemInstantPaymentNotification | Notifications |
Name | Data Type | Description |
---|---|---|
memo | string(250) | Memo |
Name | Data Type | Description |
---|---|---|
component_cost | number | Component item cost |
component_description | (read only) string | Component item description |
component_merchant_item_id | string | Component item ID |
component_merchant_item_oid | integer (int32) | Component item object identifier |
quantity | integer (int32) | Quantity |
Name | Data Type | Description |
---|---|---|
components | array of ItemKitComponent | Components |
Name | Data Type | Description |
---|---|---|
cost_if_specified | number | Cost if specified |
cost_per_letter | number | Cost per letter |
cost_per_line | number | Cost per line |
ignore_if_default | boolean | Ignore this option on the order if the default value is selected |
label | string(50) | Label |
label_translated_text_instance_oid | (read only) integer (int32) | Label translated text instance ID |
name | string(50) | Name |
name_translated_text_instance_oid | (read only) integer (int32) | Name translated text instance ID |
one_time_fee | boolean | One time fee |
option_oid | integer (int32) | Option object identifier |
required | boolean | True if the customer is required to specify an answer |
system_option | boolean | True if this is a system option |
type | string | Type of option
Allowed Values
|
values | array of ItemOptionValue | Values |
Name | Data Type | Description |
---|---|---|
additional_dimension_application | string | Additional dimensions application
Allowed Values
|
additional_items | array of ItemOptionValueAdditionalItem | Additional items to add to the order if this value is selected |
cost_change | number | Cost change |
default_value | boolean | True if default value |
digital_items | array of ItemOptionValueDigitalItem | Digital items to allow the customer to download if this option value is selected |
height | Distance | If additional_dimension_application != none Additional dimensions (height) |
length | Distance | If additional_dimension_application != none Additional dimensions (length) |
merchant_item_multimedia_oid | integer (int32) | Multimedia object identifier associated with this option value |
option_value_oid | integer (int32) | Option value object identifier |
percent_cost_change | number | Percentage cost change |
translated_text_instance_oid | (read only) integer (int32) | Translated text instance id |
value | string(1024) | Value |
weight_change | Weight | Weight change |
weight_change_percent | number | Percentage weight change |
width | Distance | If additional_dimension_application != none Additional dimensions (width) |
Name | Data Type | Description |
---|---|---|
additional_merchant_item_id | string | Additional item id |
additional_merchant_item_oid | integer (int32) | Additional item object identifier |
Name | Data Type | Description |
---|---|---|
digital_item_oid | integer (int32) | Digital item object identifier |
original_filename | string | Original filename |
Name | Data Type | Description |
---|---|---|
block_prepaid | boolean | True if prepaid cards should be blocked from buying this item |
block_refunds | boolean | True if this item should block any refund attempts, set to false otherwise, null value will not update the field |
credit_card_transaction_type | string | Credit card transaction type
Allowed Values
|
no_realtime_charge | boolean | True if no real-time charge should be performed on this item. |
payment_method_validity | array of string | Payment method validity
Allowed Values
|
rotating_transaction_gateway_codes | array of string | Rotating transaction gateway codes |
Name | Data Type | Description |
---|---|---|
height | Distance | Height |
length | Distance | Length |
weight | Weight | Weight |
width | Distance | Width |
Name | Data Type | Description |
---|---|---|
allow_arbitrary_cost | boolean | Allow arbitrary cost |
arbitrary_cost_velocity_code | string(10000) | Arbitrary cost velocity code |
auto_order_cost | number | Cost if customer selects to receive item on auto order. Set to zero to delete. |
automatic_pricing_tier_name | string | Automatic pricing tier name |
automatic_pricing_tier_oid | integer (int32) | Automatic pricing tier object identifier |
cogs | number | Cost of goods sold |
cost | number | Cost |
currency_code | string(3) | Currency code
Allowed Values
|
manufacturer_suggested_retail_price | number | Manufacturer suggested retail price |
maximum_arbitrary_cost | number | Maximum arbitrary cost |
minimum_advertised_price | number | Minimum advertised price |
minimum_arbitrary_cost | number | Minimum arbitrary cost |
mix_and_match_group | string | Mix and match group |
mix_and_match_group_oid | integer (int32) | Mix and match group object identifier |
sale_cost | number | Sale cost |
sale_end | string (dateTime) | If sale_cost specified Sale end |
sale_start | string (dateTime) | If sale_cost specified Sale start |
tiers | array of ItemPricingTier | Tiers |
Name | Data Type | Description |
---|---|---|
default_tier | (read only) boolean | True if this is the default tier |
discounts | array of ItemPricingTierDiscount | Discounts |
limit | ItemPricingTierLimit | Limits |
name | (read only) string | Pricing tier name |
pricing_tier_oid | (read only) integer (int32) | Pricing tier object identifier |
Name | Data Type | Description |
---|---|---|
cost | number | Cost |
quantity | integer (int32) | Quantity |
Name | Data Type | Description |
---|---|---|
cumulative_order_limit | integer (int32) | Cumulative order limit |
exempt_from_minimum_item_count | boolean | Exempt from Minimum Item Count |
individual_order_limit | integer (int32) | Individual order limit |
multiple_quantity | integer (int32) | Multiple quantity |
payment_method_validity | array of string | Payment method validity
Allowed Values
|
Name | Data Type | Description |
---|---|---|
expirationDts | (read only) string (dateTime) | Expiration of the property |
name | string(100) | Property name |
value | string(1000) | Property value |
Name | Data Type | Description |
---|---|---|
realtime_pricing_parameter | string | Real-time pricing provider parameters |
realtime_pricing_provider | string | Real-time pricing provider name |
realtime_pricing_provider_oid | integer (int32) | Real-time pricing provide object identifier |
Name | Data Type | Description |
---|---|---|
no_system_calculated_related_items | boolean | True to suppress system calculated relationships |
not_relatable | boolean | Not relatable |
related_items | array of ItemRelatedItem | Related items |
Name | Data Type | Description |
---|---|---|
related_merchant_item_id | string | Related item id |
related_merchant_item_oid | integer (int32) | Related item object identifier |
type | string | Relationship type
Allowed Values
|
Name | Data Type | Description |
---|---|---|
report_as_upsell | boolean | Report as an upsell |
report_pickable_quantities | array of integer (int32) | Report pickable quantities (deprecated) |
Name | Data Type | Description |
---|---|---|
exclude_coupon | boolean | Exclude coupons |
exclude_from_free_promotion | boolean | Exclude from free promotion |
items | array of ItemRestrictionItem | Items |
maximum_quantity | integer (int32) | Maximum quantity |
minimum_quantity | integer (int32) | Minimum quantity (defaults to 1) |
multiple_quantity | integer (int32) | Multiple of quantity |
one_per_customer | boolean | One per customer |
purchase_separately | boolean | Purchase separately |
Name | Data Type | Description |
---|---|---|
restrict_merchant_item_id | string | Restrict item id |
restrict_merchant_item_oid | integer (int32) | Restrict item object identifier |
type | string | Restriction type
Allowed Values
|
Name | Data Type | Description |
---|---|---|
revguard_canceled_csr_prompt_group | integer (int64) | Canceled CSR prompt group |
revguard_canceled_ivr_prompt_group | integer (int64) | IVR prompt group |
revguard_canceled_web_prompt_group | integer (int64) | Canceled web prompt group |
revguard_client_brand | integer (int64) | Client brand |
revguard_csr_prompt_group | integer (int64) | CSR prompt group |
revguard_ivr_prompt_group | integer (int64) | IVR prompt group |
revguard_web_prompt_group | integer (int64) | Web prompt group |
Name | Data Type | Description |
---|---|---|
customer_profile_oid | integer (int32) | Customer profile object identifier |
featured | boolean | |
helperful_no_votes | integer (int32) | |
helpful_yes_votes | integer (int32) | |
merchant_reply | string(10000) | Merchant Reply (set to an empty string to remove) |
order_id | string | |
overall | number | |
rating_name1 | string(100) | Rating Name 1 |
rating_name10 | string(100) | Rating Name 10 |
rating_name2 | string(100) | Rating Name 2 |
rating_name3 | string(100) | Rating Name 3 |
rating_name4 | string(100) | Rating Name 4 |
rating_name5 | string(100) | Rating Name 5 |
rating_name6 | string(100) | Rating Name 6 |
rating_name7 | string(100) | Rating Name 7 |
rating_name8 | string(100) | Rating Name 8 |
rating_name9 | string(100) | Rating Name 9 |
rating_score1 | number | |
rating_score10 | number | |
rating_score2 | number | |
rating_score3 | number | |
rating_score4 | number | |
rating_score5 | number | |
rating_score6 | number | |
rating_score7 | number | |
rating_score8 | number | |
rating_score9 | number | |
recommend_store_to_friend | integer (int32) | |
recommend_to_friend | boolean | |
review | string(10000) | Review |
review_oid | integer (int32) | |
reviewed_nickname | string(25) | Nickname |
reviewer_email | string(100) | Reviewer Email |
reviewer_location | string(25) | Location |
status | string | Status of the review
Allowed Values
|
store_feedback | string(10000) | Store Feedback |
submitted_dts | string (dateTime) | Date/time of review submission |
title | string(250) | Title |
Name | Data Type | Description |
---|---|---|
has_approved_review | (read only) boolean | True if the item has an approved review |
has_review | (read only) boolean | True if the item has a review |
individual_reviews | array of ItemReview | |
review_count | (read only) integer (int32) | Number of approved reviews |
review_overall | (read only) number | Overall score of reviews |
review_template_name | string | Review template name |
review_template_oid | integer (int32) | Review template object identifier |
reviewable | boolean | True if the item is reviewable |
share_reviews_with_merchant_item_id | (read only) string | Share reviews with item id. To set, use the share_reviews_with_merchant_item_oid field. |
share_reviews_with_merchant_item_oid | integer (int32) | Share reviews with item oid. To null out this field, set teh value to zero. |
Name | Data Type | Description |
---|---|---|
sfdc_pricebook_id | string | Salesforce.com pricebook id |
sfdc_product_id | string | Salesforce.com product id |
Name | Data Type | Description |
---|---|---|
allow_back_order | boolean | Allow back order |
amazon_fba | boolean | Fulfillment by Amazon.com |
case_inner_packs | integer (int32) | Case inner packs |
case_units | integer (int32) | Case units |
cases | array of ItemShippingCase | Cases |
collect_serial_numbers | boolean | This item is on pre-order |
country_code_of_origin | string(2) | Country code of origin for customs forms. (ISO-3166 two letter code) |
customs_description | string | Customs description |
customs_value | number | Customs value |
delivery_on_friday | boolean | Delivery on Friday |
delivery_on_monday | boolean | Delivery on Monday |
delivery_on_saturday | boolean | Delivery on Saturday |
delivery_on_sunday | boolean | Delivery on Sunday |
delivery_on_thursday | boolean | Delivery on Thursday |
delivery_on_tuesday | boolean | Delivery on Tuesday |
delivery_on_wednesday | boolean | Delivery on Wednesday |
destination_markups | array of ItemShippingDestinationMarkup | Destination markups |
destination_restrictions | array of ItemShippingDestinationRestriction | Destination restrictions |
distribution_centers | array of ItemShippingDistributionCenter | Distribution centers |
eta | string (dateTime) | Estimated time of arrival |
free_shipping | boolean | Qualifies for free shipping |
freight_class | string | Freight class |
hazmat | boolean | Hazardous material |
hold_for_transmission | boolean | Hold for transmission |
made_to_order | boolean | True if this item is made to order |
made_to_order_lead_time | integer (int32) | Number of days lead time it takes to make the item before ite can ship |
max_days_time_in_transit | integer (int32) | Maximum days allowed in transit |
methods | array of ItemShippingMethod | Methods |
no_shipping_discount | boolean | No shipping discounts |
package_requirements | array of ItemShippingPackageRequirement | Package requirements |
perishable_class_name | string | Perishable class name |
perishable_class_oid | integer (int32) | Perishable class object identifier |
preorder | boolean | This item is on pre-order |
require_delivery_date | boolean | True to require customer to select a delivery date |
restrict_shipment_on_friday | boolean | Restrict shipment on Friday |
restrict_shipment_on_monday | boolean | Restrict shipment on Monday |
restrict_shipment_on_saturday | boolean | Restrict shipment on Saturday |
restrict_shipment_on_sunday | boolean | Restrict shipment on Sunday |
restrict_shipment_on_thursday | boolean | Restrict shipment on Thursday |
restrict_shipment_on_tuesday | boolean | Restrict shipment on Tuesday |
restrict_shipment_on_wednesday | boolean | Restrict shipment on Wednesday |
ship_separately | boolean | Ship this item in a separate box |
ship_separately_additional_weight | Weight | Ship separately box weight |
ship_separately_height | Distance | Ship separately box height |
ship_separately_length | Distance | Ship separately box length |
ship_separately_package_special_type | string | Ship separately package special type
Allowed Values
|
ship_separately_width | Distance | Ship separately box width |
special_product_type | string | Special product type (USPS Media Mail)
Allowed Values
|
track_inventory | boolean | Track inventory |
Name | Data Type | Description |
---|---|---|
case_label | string(20) | Case label |
case_merchant_item_id | string | Case item id |
case_merchant_item_oid | integer (int32) | Case item object identifier |
quantity | integer (int32) | Case quantity |
Name | Data Type | Description |
---|---|---|
adult_signature_required | boolean | Adult Signature Required (only updated if not-null value provided) |
country_code | string(2) | Country code (ISO-3166 two letter) |
flat_fee | number | Flat fee |
per_item | number | Per item |
postal_code | string(20) | Postal code |
shipping_method | string | Shipping method |
state | string(32) | State |
Name | Data Type | Description |
---|---|---|
country_code | string(2) | Country code (ISO-3166 two letter) |
state | string(32) | State |
validity | string | Validity
Allowed Values
|
Name | Data Type | Description |
---|---|---|
allocated_to_placed_orders | (read only) number | Allocated to placed orders |
allocated_to_shopping_carts | (read only) number | Allocated to shopping carts |
available_to_allocate | (read only) number | Available to allocate |
cogs | (read only) number | Cost of goods sold override at the distribution center level |
desired_inventory_level | number | Desired inventory level |
distribution_center_code | string | Distribution center code |
distribution_center_oid | integer (int32) | Distribution center object identifier |
eta | string (dateTime) | Estimated time of arrival |
handles | boolean | True if this distribution center handles this item |
inventory_level | number | Inventory level |
maximum_backorder | integer (int32) | Maximum back-order |
reorder_inventory_level | number | Reorder inventory level (triggers notification) |
sku | string(50) | SKU |
stock_picking_location | string(20) | Stock picking location |
Name | Data Type | Description |
---|---|---|
cost | number | Cost |
each_additional_item_markup | number | Each additional item markup |
filter_to_if_available | boolean | Filter to this method if available |
first_item_markup | number | First item markup |
fixed_shipping_cost | number | Fixed shipping cost |
flat_fee_markup | number | Flat fee markup |
free_shipping | boolean | Free shipping |
per_item_fee_markup | number | Per item fee markup |
percentage_markup | number | Percentage markup |
percentage_of_item_markup | number | Percentage of item markup |
relax_restrictions_on_upsell | boolean | Relax restrictions on upsell |
shipping_method | string | Shipping method name |
shipping_method_oid | integer (int32) | Shipping method object identifier |
shipping_method_validity | string | Shipping method validity
Allowed Values
|
signature_required | boolean | Signature required |
Name | Data Type | Description |
---|---|---|
package_name | string | Package name |
package_oid | integer (int32) | Package object identifier |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
items | array of Item | items |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
tagType | string | tag_tpe
Allowed Values
|
tagValue | string(100) | tag_value |
Name | Data Type | Description |
---|---|---|
exemptions | array of ItemTaxExemption | Exemptions |
tax_free | boolean | True if tax free |
tax_product_type | string | Tax product type
Allowed Values
|
taxable_cost | number | Taxable cost if different than regular cost |
Name | Data Type | Description |
---|---|---|
city | string(32) | City |
country_code | string(2) | Country code (ISO-3166 two letter) |
county | string(32) | County |
postal_code | string(20) | Postal code |
state_code | string(32) | State code |
Name | Data Type | Description |
---|---|---|
add_tags | array of string | Add tags |
provider_name | string | Provider name
Allowed Values
|
remove_tags | array of string | Remove tags |
subscribe_lists | array of string | Subscribe to lists |
unsubscribe_lists | array of string | Unsubscribe from lists |
Name | Data Type | Description |
---|---|---|
description | (read only) string(512) | Description |
merchant_item_multimedia_oid | integer (int32) | Multimedia object identifier |
variant_merchant_item_id | string | Variant item id |
variant_merchant_item_oid | integer (int32) | Variant item object identifier |
variation_options | array of string | Variation options |
variations | array of string | Variations |
Name | Data Type | Description |
---|---|---|
default_text | string(50) | Default text |
default_text_translated_text_instance_oid | (read only) integer (int32) | Default text translated text instance id |
name | string(50) | Name |
name_translated_text_instance_oid | (read only) integer (int32) | Name translated text instance id |
options | array of ItemVariationOption | Options |
Name | Data Type | Description |
---|---|---|
default_option | boolean | True if default option |
merchant_item_multimedia_oid | integer (int32) | Multimedia object identifier |
translated_text_instance_oid | (read only) integer (int32) | Translated text instance id |
value | string(50) | Value |
Name | Data Type | Description |
---|---|---|
wishlist_member_instance_description | string | WishList Member instance description |
wishlist_member_instance_oid | integer (int32) | WishList Member instance object identifier |
wishlist_member_sku | string(25) | WishList Member SKU |
Name | Data Type | Description |
---|---|---|
name | string | |
type | string | |
uuid | string |
Name | Data Type | Description |
---|---|---|
all_time | number | |
all_time_formatted | string | |
last_30 | number | |
last_30_formatted | string | |
name | string | |
prior_30 | number | |
prior_30_formatted | string | |
type | string |
Name | Data Type | Description |
---|---|---|
affiliates | (read only) array of OrderAffiliate | Affiliates if any were associated with the order. The first one in the array sent the order and each subsequent affiliate is the recruiter that earns a downline commission. |
auto_order | (read only) OrderAutoOrder | Auto Order. If this is the original order then expansion can be done. If it is a rebill then the record is a small pointer to the auto order and original order records. |
billing | OrderBilling | Billing |
buysafe | OrderBuysafe | buySAFE bond |
channel_partner | (read only) OrderChannelPartner | Channel Partner if one is associated with the order |
checkout | OrderCheckout | Checkout |
coupons | array of OrderCoupon | Coupons |
creation_dts | (read only) string (dateTime) | Date/time that the order was created |
currency_code | string(3) | Currency code that the customer used if different than the merchant's base currency code
Allowed Values
|
current_stage | string | Current stage that the order is in.
Allowed Values
|
current_stage_histories | (read only) array of OrderCurrentStageHistory | History of the changes to the current_stage field |
customer_profile | (read only) Customer | Customer profile if one is associated with the order |
digital_order | OrderDigitalOrder | Digital order details |
edi | OrderEdi | EDI related information (only for orders received via EDI channel partner) |
exchange_rate | number | Exchange rate at the time the order was placed if currency code is different than the base currency |
fraud_score | (read only) OrderFraudScore | Fraud score if checked on the order |
gift | OrderGift | Gift giving information |
gift_certificate | (read only) OrderGiftCertificate | Gift certificate used on the order |
internal | OrderInternal | Internal |
items | array of OrderItem | Items |
language_iso_code | (read only) string(3) | Three letter ISO-639 language code used by the customer during the checkout if different than the default language |
linked_shipment | (read only) OrderLinkedShipment | Linked shipment information (CCBill orders only) |
marketing | OrderMarketing | Marketing |
merchant_id | (read only) string | UltraCart merchant ID owning this order |
order_id | (read only) string | Order ID |
payment | OrderPayment | Payment |
point_of_sale | (read only) OrderPointOfSale | If the order was a point of sale order, this this object contains the details of where the transaction took place. |
properties | array of OrderProperty | Properties, available only through update, not through insert due to the nature of how properties are handled internally |
quote | (read only) OrderQuote | Quote |
refund_dts | (read only) string (dateTime) | If the order was refunded, the date/time that the last refund occurred |
refund_reason | string | Refund reason code. This can only be written during a refund operation otherwise this field is read only. |
reject_dts | (read only) string (dateTime) | If the order was rejected, the date/time that the rejection occurred |
reject_reason | string | Reject reason code. This can only be written during a reject operation otherwise this field is read only. |
salesforce | (read only) OrderSalesforce | Salesforce.com identifiers |
shipping | OrderShipping | Shipping |
summary | OrderSummary | Summary |
Tags | array of OrderTag | tags, available only through update, not through insert due to the nature of how tags are handled internally |
taxes | OrderTaxes | Taxes |
utms | (read only) array of OrderUtm | UTM clicks. The zero index is the most recent (last) UTM click |
Name | Data Type | Description |
---|---|---|
affiliate_oid | integer (int32) | Affiliate ID |
ledger_entries | array of OrderAffiliateLedger | Ledger entries associated with all the commissions earned on this order |
sub_id | string | Sub identifier provided by the affiliate on the click that generated this order |
Name | Data Type | Description |
---|---|---|
assigned_by_user | string | UltraCart user name that assigned this commission if manually assigned |
item_id | string | Item ID that this ledger record is associated with |
tier_number | integer (int32) | Tier number of this affiliate in the commission calculation |
transaction_amount | number | Amount of the transaction |
transaction_amount_paid | number | The amount that has been paid so far on the transaction |
transaction_dts | string (dateTime) | The date/time that the affiliate ledger was generated for the transaction |
transaction_memo | string | Details of the transaction suitable for display to the affiliate |
transaction_percentage | number | The percentage earned on the transaction |
transaction_state | string | The state of the transaction
Allowed Values
|
Name | Data Type | Description |
---|---|---|
auto_order_code | (read only) string | Unique code assigned to this auto order |
auto_order_oid | (read only) integer (int32) | Auto order object identifier |
cancel_after_next_x_orders | integer (int32) | Cancel this auto order after X additional rebills |
cancel_downgrade | (read only) boolean | True if the auto order was canceled because the customer purchased a downgrade item |
cancel_reason | string | The reason this auto order was canceled by either merchant or customer |
cancel_upgrade | (read only) boolean | True if the auto order was canceled because the customer purchased an upgrade item |
canceled_by_user | string | The user that canceled the auto order |
canceled_dts | string (dateTime) | The date/time that the auto order was canceled |
completed | (read only) boolean | True if the auto order ran successfully to completion |
credit_card_attempt | integer (int32) | The number of credit card attempts that have taken place |
disabled_dts | (read only) string (dateTime) | The date/time the auto order was disabled due to failed rebills |
enabled | boolean | True if this auto order is enabled |
failure_reason | (read only) string | The reason this auto order failed during the last rebill attempt |
items | array of AutoOrderItem | The items that are setup to rebill |
next_attempt | string (dateTime) | The next time that the auto order will be attempted for processing |
original_order_id | (read only) string | The original order id that this auto order is associated with. |
override_affiliate_id | integer (int32) | Override the affiliate id given credit for rebills of this auto order |
rebill_orders | (read only) array of Order | Rebill orders that have taken place on this auto order |
rotating_transaction_gateway_code | string | The RTG code associated with this order for future rebills |
status | (read only) string | The status of the auto order
Allowed Values
|
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
cc_emails | array of string | CC emails. Multiple allowed, but total length of all emails can not exceed 100 characters. |
cell_phone | string(25) | Cell phone |
cell_phone_e164 | (read only) string(25) | Cell phone (E164 format) |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
day_phone | string(25) | Day time phone |
day_phone_e164 | (read only) string(25) | Day time phone (E164 format) |
string(100) | ||
evening_phone | string(25) | Evening phone |
evening_phone_e164 | (read only) string(25) | Evening phone (E164 format) |
first_name | string(30) | First name |
last_name | string(30) | Last name |
postal_code | string(20) | Postal code |
state_region | string(32) | State for United States otherwise region or province for other countries |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
buysafe_bond_available | (read only) boolean | True if a buySAFE bond was available for purchase on this order |
buysafe_bond_cost | (read only) Currency | Cost of the buySAFE bond |
buysafe_bond_free | (read only) boolean | True if the buySAFE bond was free for this order |
buysafe_bond_refunded | (read only) Currency | Amount of the buySAFE bond that was refunded |
buysafe_bond_wanted | boolean | True if the buySAFE bond was wanted by the customer |
buysafe_shopping_cart_id | (read only) string | Shopping cart ID associated with the buySAFE bond |
Name | Data Type | Description |
---|---|---|
auto_approve_purchase_order | boolean | If true, any purchase order submitted is automatically approved |
channel_partner_code | string | The code of the channel partner |
channel_partner_data | string | Additional data provided by the channel partner, read-only |
channel_partner_oid | integer (int32) | Channel partner object identifier, read-only and available on existing channel orders only. |
channel_partner_order_id | string(50) | The order ID assigned by the channel partner for this order. |
ignore_invalid_shipping_method | boolean | Set to true to ignore invalid shipping method being specified. Only applicable on inserting orders. |
no_realtime_payment_processing | boolean | Indicates this order should be placed in Account Receivable for later payment processing |
skip_payment_processing | boolean | Indicates this order was already paid for via a channel purchase and no payment collection should be attempted |
store_completed | boolean | Instructs UltraCart to skip shipping department and mark this order as fully complete. This flag defaults to true. Set this flag to false to shipped product for this order. |
store_if_payment_declines | boolean | If true, any failed payment will place the order in Accounts Receivable rather than rejecting it. |
treat_warnings_as_errors | boolean | Any warnings are raised as errors and halt the import of the order |
Name | Data Type | Description |
---|---|---|
browser | (read only) Browser | Parsed user agent string into components |
comments | string | Comments from the customer. Rarely used on the single page checkout. |
custom_field1 | string(50) | Custom field 1 |
custom_field10 | string(200) | Custom field 10 |
custom_field2 | string(50) | Custom field 2 |
custom_field3 | string(50) | Custom field 3 |
custom_field4 | string(50) | Custom field 4 |
custom_field5 | string(75) | Custom field 5 |
custom_field6 | string(50) | Custom field 6 |
custom_field7 | string(50) | Custom field 7 |
custom_field8 | string(200) | Custom field 8 |
custom_field9 | string(200) | Custom field 9 |
customer_ip_address | (read only) string | IP address of the customer when placing the order |
screen_branding_theme_code | string(10) | Screen branding theme code associated with the order (legacy checkout) |
screen_size | (read only) string | Screen size small, medium or large |
storefront_host_name | string | StoreFront host name associated with the order |
upsell_path_code | (read only) string | Upsell path code assigned during the checkout that the customer went through |
Name | Data Type | Description |
---|---|---|
accounting_code | (read only) string | QuickBooks accounting code for this coupon |
automatically_applied | (read only) boolean | Whether or not the coupon was automatically applied to the order |
base_coupon_code | string(20) | Coupon code configured by the merchant. Will differ if the customer used a one time coupon code generated off this base coupon |
coupon_code | string(20) | Coupon code entered by the customer |
hdie_from_customer | (read only) boolean | True if this coupon is hide from the customer |
Name | Data Type | Description |
---|---|---|
after_stage | string | New stage that the order is in.
Allowed Values
|
before_stage | string | Previous stage that the order was in.
Allowed Values
|
transition_dts | (read only) string (dateTime) | Date/time that the stage transitioned |
Name | Data Type | Description |
---|---|---|
file_size | (read only) integer (int64) | File size |
last_download | (read only) string (dateTime) | Last download |
last_download_ip_address | (read only) string | IP address that performed the last download |
original_filename | (read only) string | Original file name |
product_code | (read only) string | Item id associated with this item |
product_description | (read only) string | Item description associated with this item |
remaining_downloads | integer (int32) | Remaining number of downloads |
url | (read only) string | URL that the customer can click to download the specific digital item |
Name | Data Type | Description |
---|---|---|
creation_dts | (read only) string (dateTime) | Date/time that the digital order was created |
expiration_dts | string (dateTime) | Expiration date/time of the digital order |
items | array of OrderDigitalItem | Digital items associated with the digital order |
url | (read only) string | URL where the customer can go to and download their digital order content |
url_id | (read only) string | URL ID is a unique code that is part of the URLs |
Name | Data Type | Description |
---|---|---|
bill_to_edi_code | string | Billing address identification code from the EDI order. Typically DUNS or DUNS+4 |
edi_department | string | Department number associated with this EDI order |
edi_internal_vendor_number | string(50) | Internal vendor number associated with this EDI order |
ship_to_edi_code | string | Shipping address identification code from the EDI order. Typically DUNS or DUNS+4 |
Name | Data Type | Description |
---|---|---|
anonymous_proxy | boolean | True if the IP address is a known anonymous proxy server |
bin_match | string | Whether the BIN (first six digits) matched the country
Allowed Values
|
carder_email | boolean | True if the email address belongs to a known credit card fraudster |
country_code | string | Country code |
country_match | boolean | Country code matches BIN country |
customer_phone_in_billing_location | string | Whether the customer's phone number is located in the area of the billing address |
distance_km | integer (int32) | Distance in kilometers between the IP address and the BIN |
free_email | boolean | True if the email address is for a free service like gmail.com |
high_risk_country | boolean | True if the customer is in a high risk country known for internet fraud |
ip_city | string | City associated with the IP address |
ip_isp | string | ISP that owns the IP address |
ip_latitude | string | Approximate latitude associated with the IP address |
ip_longitude | string | Approximate longitude associated with the IP address |
ip_org | string | Organization that owns the IP address |
ip_region | string | State/region associated with the IP address |
proxy_score | number | Likelihood of the IP address being a proxy server |
score | number | Overall score. This is the score that is compared to see if the order is rejected or held for review by the fraud filter rules. |
ship_forwarder | boolean | True if the address is a known ship forwarding company |
spam_score | number | Likelihood of the email address being associated with a spammer |
transparent_proxy | boolean | True if the IP address that placed the order is a transparent proxy server |
Name | Data Type | Description |
---|---|---|
gift | boolean | True if the order is a gift |
gift_charge | Currency | Charge associated with making this order a gift |
gift_charge_accounting_code | (read only) string | QuickBooks code for the gift charge |
gift_charge_refunded | Currency | Amount refunded of the gift charge (read only except refund operation) |
gift_email | string(100) | Email address of the gift recipient |
gift_message | string(10000) | Message to the gift recipient |
gift_wrap_accounting_code | (read only) string | QuickBooks code for the gift wrap charge |
gift_wrap_cost | Currency | Cost of the gift wrap the customer selected |
gift_wrap_refunded | Currency | Amount refunded of the gift wrap (read only except refund operation) |
gift_wrap_title | string(30) | Title of the gift wrap that the customer wants used |
Name | Data Type | Description |
---|---|---|
gift_certificate_amount | (read only) Currency | Gift certificate amount applied to the order |
gift_certificate_code | (read only) string | Gift certificate code used on the order |
gift_certificate_oid | (read only) integer (int32) | Gift certificate object identifier |
Name | Data Type | Description |
---|---|---|
exported_to_accounting | boolean | True if the order has been exported to QuickBooks. If QuickBooks is not configured, then this will already be true |
merchant_notes | string | Merchant notes. Full notes in non-transactional mode. Just used to write a new merchant note when transaction merchant notes enabled. |
placed_by_user | (read only) string | If placed via the BEOE, this is the user that placed the order |
refund_by_user | (read only) string | User that issued the refund |
sales_rep_code | string(10) | Sales rep code associated with the order |
transactional_merchant_notes | (read only) array of OrderTransactionalMerchantNote | Transactional merchant notes |
Name | Data Type | Description |
---|---|---|
accounting_code | (read only) string | QuickBooks code |
activation_codes | array of string | Activation codes assigned to this item |
actual_cogs | Currency | Actual COGS of the item used by the cost analysis report |
arbitrary_unit_cost | Currency | Arbitrary unit cost, used only during inserts for overriding the unit cost of an item |
auto_order_last_rebill_dts | string (dateTime) | Date/time of the last rebill, used only during order insert to help project future rebills |
auto_order_schedule | string | Auto order schedule, used only during inserts supplying the recurring schedule |
barcode | (read only) string | Barcode |
barcode_gtin12 | (read only) string(12) | Barcode - GTIN 12 |
barcode_gtin14 | (read only) string(14) | Barcode - GTIN 14 |
barcode_upc11 | (read only) string(11) | Barcode - UPC 11 |
barcode_upc12 | (read only) string(12) | Barcode - UPC 12 |
channel_partner_item_id | string(30) | Channel partner item id if this order came through a channel partner and the channel partner item id was mapped to an internal item id |
cogs | (read only) number | Cost of goods sold |
component_unit_value | (read only) number | Value of the kit component item |
cost | Currency | Cost |
country_code_of_origin | (read only) string(2) | Country of origin (ISO-3166 two letter code) |
customs_description | (read only) string | Customs description |
description | string(2000) | Description |
discount | (read only) Currency | Discount |
discount_quantity | (read only) number | Discount quantity |
discount_shipping_weight | (read only) Weight | Discount shipping weight |
distribution_center_code | string | Distribution center code responsible for shipping this item |
edi | OrderItemEdi | EDI related item information |
exclude_coupon | boolean | True if this item is excluded from coupons |
free_shipping | boolean | True if the item receives free shipping |
hazmat | boolean | Hazardous materials indicator |
height | Distance | Height |
item_index | integer (int32) | Index of the item on the order (one based index) |
item_reference_oid | (read only) integer (int32) | Item reference object identifier used to linked to auto order item record |
kit | boolean | True if this item is a kit |
kit_component | boolean | True if this item is a kit component |
length | Distance | Length |
manufacturer_sku | (read only) string | Manufacturer SKU |
max_days_time_in_transit | integer (int32) | Maximum days that the item can be in transit before spoilage (perishable products) |
merchant_item_id | string(20) | Item ID |
mix_and_match_group_name | string | Mix and match group name |
mix_and_match_group_oid | integer (int32) | Mix and match group object identifier |
no_shipping_discount | boolean | True if this item is excluded from shipping discounts |
options | array of OrderItemOption | Options |
packed_by_user | (read only) string | Packed by user |
parent_item_index | integer (int32) | If this item is a kit component, this is the item index of the parent item (kit) |
parent_merchant_item_id | string(20) | If this item is a kit component, this is the item id of the parent item (kit) |
perishable_class | string(50) | Perishable class of the item |
pricing_tier_name | string | Pricing tier that granted the particular price for this item if the customer profile had pricing tiers assigned |
properties | array of OrderItemProperty | Properties |
quantity | number | Quantity |
quantity_refunded | number | Quantity refunded on this item (read only except refund operation) |
quickbooks_class | string(31) | QuickBooks class |
refund_reason | string | Refund reason code. This can only be written during a refund operation otherwise this field is read only. |
return_reason | string | Return reason code. This can only be written during a refund operation otherwise this field is read only. |
ship_separately | boolean | True if this item ships in a separate box |
shipped_by_user | (read only) string | Shipped by user |
shipped_dts | string (dateTime) | Date/time that this item was marked shipped |
shipping_status | string | Shipping status for this item. This is the replacement for the old order level shipping status. |
special_product_type | string | Special product type (USPS Media Mail)
Allowed Values
|
tags | array of OrderItemTag | Tags |
tax_free | boolean | True if the item is tax free |
tax_product_type | string | Type of product for tax purposes (self or UltraCart Managed taxes)
Allowed Values
|
taxable_cost | Currency | The taxable cost of the item. Typically the same as the cost |
total_cost_with_discount | (read only) Currency | Total cost with discount |
total_refunded | Currency | Total refunded on this item (read only except refund operation) |
transmitted_to_distribution_center_dts | string (dateTime) | Date/time that this item was transmitted to the distribution center |
unit_cost_with_discount | (read only) Currency | Unit cost with discount |
upsell | boolean | True if this item was added to the order as part of an upsell |
weight | Weight | Weight |
width | Distance | Width |
Name | Data Type | Description |
---|---|---|
identifications | (read only) array of OrderItemEdiIdentification | Identification information receives on the EDI purchase order |
lots | (read only) array of OrderItemEdiLot | Lot information |
Name | Data Type | Description |
---|---|---|
identification | string | Identification value |
quantity | integer (int32) | Quantity associated with this identifier |
Name | Data Type | Description |
---|---|---|
lot_expiration | string (dateTime) | Log expiration |
lot_number | string | Lot number |
lot_quantity | integer (int32) | Lot quantity |
Name | Data Type | Description |
---|---|---|
additional_dimension_application | string | How the additional dimensions are applied to the item.
Allowed Values
|
cost_change | Currency | The amount that this option changes the cost |
file_attachment | (read only) OrderItemOptionFileAttachment | File attachment if option_type is file and attachment has not expired. |
height | Distance | If additional_dimension_application != none Height |
hidden | boolean | True if this option is hidden from display on the order |
label | string(50) | Label |
length | Distance | If additional_dimension_application != none Length |
one_time_fee | boolean | True if the cost associated with this option is a one time fee or multiplied by the quantity of the item |
value | string(1024) | Value |
weight_change | Weight | The amount that this option changes the weight |
width | Distance | If additional_dimension_application != none Width |
Name | Data Type | Description |
---|---|---|
expiration_dts | string (dateTime) | Expiration date/time |
file_name | string | File name |
mime_type | string | Mime type |
size | integer (int32) | Size |
Name | Data Type | Description |
---|---|---|
display | boolean | True if this property is displayed to the customer |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(3800) | Value |
Name | Data Type | Description |
---|---|---|
tag_value | string(100) | Tag Value |
Name | Data Type | Description |
---|---|---|
has_linked_shipment | boolean | True if this order has child linked shipments |
linked_shipment | boolean | True if this order is linked to another parent order |
linked_shipment_channel_partner_order_ids | array of string | If has_linked_shipment=true The child linked shipment channel partner order ids |
linked_shipment_order_ids | array of string | If has_linked_shipment=true The child linked shipment order ids |
linked_shipment_to_order_id | string | If linked_shipment=true The parent order id that this one is linked to |
Name | Data Type | Description |
---|---|---|
advertising_source | string(50) | Advertising source |
cell_phone_opt_in | boolean | True if the customer has opted into SMS marketing |
mailing_list | boolean | True if the customer has opted into mailing list subscription |
referral_code | string(30) | Referral code |
Name | Data Type | Description |
---|---|---|
check | OrderPaymentCheck | If payment_method=Check Check payment information |
credit_card | OrderPaymentCreditCard | If payment_method=Credit Card Credit card payment information |
echeck | OrderPaymentECheck | If payment_method=eCheck E-Check payment information |
health_benefit_card | OrderPaymentHealthBenefitCard | Health benefit card |
hold_for_fraud_review | (read only) boolean | True if order has been held for fraud review |
insurance | OrderPaymentInsurance | If payment_method=Insurance Insurance information |
payment_dts | string (dateTime) | Date/time that the payment was successfully processed, for new orders, this field is only considered if channel_partner.skip_payment_processing is true |
payment_method | string | Payment method
Allowed Values
|
payment_method_accounting_code | (read only) string | Payment method QuickBooks code |
payment_method_deposit_to_account | (read only) string | Payment method QuickBooks deposit account |
payment_status | (read only) string | Payment status
Allowed Values
|
paypal | (read only) OrderPaymentPayPal | PayPal details if the payment was vaulted. |
purchase_order | OrderPaymentPurchaseOrder | If payment_method=Purchase Order Purchase order information |
rotating_transaction_gateway_code | (read only) string | Rotating transaction gateway code used to process this order |
surcharge | (read only) Currency | Surcharge amount calculated from surcharge_transaction_fee and surcharge_transaction_percentage |
surcharge_accounting_code | (read only) string | Surcharge accounting code |
surcharge_transaction_fee | number | Surcharge transaction fee |
surcharge_transaction_percentage | number | Surcharge transaction percentage |
test_order | (read only) boolean | True if this is a test order |
transactions | (read only) array of OrderPaymentTransaction | Transactions associated with processing this payment |
Name | Data Type | Description |
---|---|---|
check_number | string | Check number |
Name | Data Type | Description |
---|---|---|
card_auth_ticket | (read only) string | Card authorization ticket |
card_authorization_amount | (read only) number | Card authorization amount |
card_authorization_dts | (read only) string (dateTime) | Card authorization date/time |
card_authorization_reference_number | (read only) string | Card authorization reference number |
card_expiration_month | integer (int32) | Card expiration month (1-12) |
card_expiration_year | integer (int32) | Card expiration year (Four digit year) |
card_number | (read only) string | Card number (masked to last 4) |
card_number_token | string | Card number token from hosted fields used to update the card number |
card_number_truncated | (read only) boolean | True if the card has been truncated |
card_type | string | Card type
Allowed Values
|
card_verification_number_token | string | Card verification number token from hosted fields, only for import/insert of new orders, completely ignored for updates, and always null/empty for queries |
dual_vaulted | (read only) OrderPaymentCreditCardDualVaulted | Details on the dual vaulted card that is also stored at the payment processor for future reuse |
Name | Data Type | Description |
---|---|---|
gateway_name | string | |
properties | array of OrderPaymentCreditCardDualVaultedProperty | |
rotating_transaction_gateway_code | string |
Name | Data Type | Description |
---|---|---|
name | string | |
value | string |
Name | Data Type | Description |
---|---|---|
bank_aba_code | string(9) | Bank routing code |
bank_account_name | string(50) | Bank account name |
bank_account_number | string(50) | Bank account number (masked to last 4) |
bank_account_type | string | Bank account type
Allowed Values
|
bank_name | string(50) | Bank name |
bank_owner_type | string | Bank owner type
Allowed Values
|
customer_tax_id | string(9) | Customer tax id (masked to last 4) |
drivers_license_dob | string(10) | Driver license date of birth |
drivers_license_number | string(50) | Driver license number (masked to last 4) |
drivers_license_state | string(2) | Driver license state |
Name | Data Type | Description |
---|---|---|
health_benefit_card_expiration_month | integer (int32) | Health benefit card expiration month (1-12) |
health_benefit_card_expiration_year | integer (int32) | Health benefit card expiration year (Four digit year) |
health_benefit_card_number | (read only) string | Health benefit card number (masked to last 4) |
health_benefit_card_number_token | string | Health benefit card number token from hosted fields used to update the health benefit card number |
health_benefit_card_number_truncated | (read only) boolean | True if the health benefit card has been truncated |
health_benefit_card_verification_number_token | string | Health benefit card verification number token from hosted fields, only for import/insert of new orders, completely ignored for updates, and always null/empty for queries |
Name | Data Type | Description |
---|---|---|
application_id | string | application id |
claim_id | string | claim id |
insurance_type | string | insurance type |
refund_claim_id | string | refund claim id |
Name | Data Type | Description |
---|---|---|
customer_id | (read only) string | PayPal Customer ID |
vault_id | (read only) string | PayPal Vault ID |
Name | Data Type | Description |
---|---|---|
purchase_order_number | string | Purchase order number |
Name | Data Type | Description |
---|---|---|
details | array of OrderPaymentTransactionDetail | Details |
successful | boolean | True if the transaction was successful |
transaction_gateway | string | Transaction gateway |
transaction_id | integer (int32) | Transaction ID |
transaction_timestamp | string (dateTime) | Transaction date/time |
Name | Data Type | Description |
---|---|---|
name | string | Name |
type | string | Type |
value | string | Value |
Name | Data Type | Description |
---|---|---|
location | (read only) PointOfSaleLocation | The location that the point of sale transaction took place at. |
reader | (read only) PointOfSaleReader | The card reader that the point of sale transaction took place at if a credit card was used. |
register | (read only) PointOfSaleRegister | The register that the point of sale transaction took place at. |
Name | Data Type | Description |
---|---|---|
created_by | string(20) | Created by user |
created_dts | string (dateTime) | The date/time that the property was created by the user |
display | boolean | True if this property is displayed to the customer |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(1500) | Value |
Name | Data Type | Description |
---|---|---|
quote_expiration_dts | string (dateTime) | Expiration of quote at date/time |
quoted_by | string | Quoted by user |
quoted_dts | string (dateTime) | Quoted on date/time |
Name | Data Type | Description |
---|---|---|
salesforce_opportunity_id | string | Salesforce.com opportunity id |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
day_phone | string(25) | Day time phone |
day_phone_e164 | (read only) string(25) | Day time phone (E164 format) |
delivery_date | string (dateTime) | Date the customer is requesting delivery on. Typically used for perishable product delivery. |
evening_phone | string(25) | Evening phone |
evening_phone_e164 | (read only) string(25) | Evening phone (E164 format) |
first_name | string(30) | First name |
last_name | string(30) | Last name |
least_cost_route | boolean | If true, instructs UltraCart to apply the cheapest shipping method to this order. Used only for channel partner order inserts. |
least_cost_route_shipping_methods | array of string | List of shipping methods to consider if least_code_route is true. Used only for channel parter order inserts. |
lift_gate | boolean | Lift gate requested (LTL shipping methods only) |
pickup_dts | (read only) string (dateTime) | Date/time the order should be picked up locally. |
postal_code | string(20) | Postal code |
rma | string(30) | RMA number |
ship_on_date | string (dateTime) | Date the customer is requesting that the order ship on. Typically used for perishable product delivery. |
ship_to_residential | boolean | True if the shipping address is residential. Effects the methods that are available to the customer as well as the price of the shipping method. |
shipping_3rd_party_account_number | string(20) | Shipping 3rd party account number |
shipping_date | (read only) string (dateTime) | Date/time the order shipped on. This date is set once the first shipment is sent to the customer. |
shipping_department_status | string(30) | Shipping department status |
shipping_method | string | Shipping method |
shipping_method_accounting_code | (read only) string | Shipping method accounting code |
special_instructions | string | Special instructions from the customer regarding shipping |
state_region | string(32) | State |
title | string(50) | Title |
tracking_number_details | (read only) array of OrderTrackingNumberDetails | Tracking number details |
tracking_numbers | array of string | Tracking numbers |
weight | (read only) Weight | Total weight of the items on the order |
Name | Data Type | Description |
---|---|---|
actual_fulfillment | (read only) Currency | Actual amount of the fulfillment cost |
actual_other_cost | (read only) Currency | Actual other cost |
actual_payment_processing | (read only) Currency | Actual amount of the payment processing cost |
actual_profit | (read only) Currency | Actual profit |
actual_profit_analyzed | (read only) boolean | Actual profit has been analyzed |
actual_profit_review | (read only) boolean | Actual profit needs review |
actual_shipping | (read only) Currency | Actual amount of the shipping cost |
arbitrary_shipping_handling_total | Currency | Arbitrary shipping handling total, this is meaningless for updating an order. For inserting a new order, this will override any internal shipping and handling totals and should only be used for orders completed outside the system. This will probably only ever be needed when submitting arbitrary taxes AND shipping is taxed. |
health_benefit_card_amount | (read only) Currency | Health benefit card amount used |
health_benefit_card_refunded | (read only) Currency | Health benefit card refunded |
internal_gift_certificate_amount | (read only) Currency | Internal gift certificate amount used (store credit) |
internal_gift_certificate_refunded | (read only) Currency | Internal gift certificate refunded (store credit) |
other_refunded | (read only) Currency | Other refunded |
shipping_handling_refunded | Currency | Shipping/handling refunded (read only except refund operation) |
shipping_handling_total | Currency | Shipping/handling total |
shipping_handling_total_discount | (read only) Currency | Shipping/handling total discount |
subtotal | (read only) Currency | Subtotal |
subtotal_discount | (read only) Currency | Subtotal discount |
subtotal_discount_refunded | Currency | Subtotal discount refunded (read only except refund operation) |
subtotal_refunded | (read only) Currency | Subtotal refunded |
tax | Currency | Tax, may be updated to reflect any changes made to the tax fields, but cannot be used when inserting an order. For inserting, use the arbitrary fields instead. |
tax_refunded | Currency | Tax refunded (read only except refund operation) |
taxable_subtotal | (read only) Currency | Taxable subtotal |
taxable_subtotal_discount | (read only) Currency | Taxable subtotal discount |
total | (read only) Currency | Total |
total_refunded | (read only) Currency | Total refunded |
Name | Data Type | Description |
---|---|---|
tag_value | string(100) | Tag Value |
Name | Data Type | Description |
---|---|---|
arbitrary_tax | number | Arbitrary Tax, this is meaningless for updating an order. For inserting a new order, this will override any internal tax calculations and should only be used for orders completed outside the system. |
arbitrary_tax_rate | number | Arbitrary tax rate, this is meaningless for updating an order. For inserting a new order, this will override any internal tax calculations and should only be used for orders completed outside the system. |
arbitrary_taxable_subtotal | number | Arbitrary taxable subtotal, this is meaningless for updating an order. For inserting a new order, this will override any internal tax calculations and should only be used for orders completed outside the system. |
tax_city_accounting_code | (read only) string | QuickBooks tax city code |
tax_country_accounting_code | (read only) string | QuickBooks tax country code |
tax_county | string(32) | County used for tax calculation purposes (only in the United States) |
tax_county_accounting_code | (read only) string | QuickBooks tax county code |
tax_gift_charge | (read only) boolean | True if gift charge is taxed |
tax_postal_code_accounting_code | (read only) string | QuickBooks tax postal code code |
tax_rate | number | Tax rate, this is meaningless for updating an order. For inserting a new order, if you need to override internal tax calculations, use the arbitrary fields. |
tax_rate_city | (read only) number | Tax rate at the city level |
tax_rate_country | (read only) number | Tax rate at the country level |
tax_rate_county | (read only) number | Tax rate at the county level |
tax_rate_postal_code | (read only) number | Tax rate at the postal code level |
tax_rate_state | (read only) number | Tax rate at the state level |
tax_shipping | (read only) boolean | True if shipping is taxed |
tax_state_accounting_code | (read only) string | QuickBooks tax state code |
Name | Data Type | Description |
---|---|---|
city | string | |
event_dts | (read only) string (dateTime) | ISO 8601 timestamp that the event occurred |
event_local_date | string | |
event_local_time | string | |
event_timezone_id | (read only) string | Timezone the event occurred in. Use this in conjunction with event_dts to format a local date/time. |
state | string | |
subtag | string | |
subtag_message | string | |
tag | string | |
tag_description | string | |
tag_icon | string | |
zip | string |
Name | Data Type | Description |
---|---|---|
actual_delivery_date | string | |
actual_delivery_date_formatted | string | |
details | array of OrderTrackingNumberDetail | |
easypost_tracker_id | string | |
expected_delivery_date | string | |
expected_delivery_date_formatted | string | |
map_url | string | |
order_placed_date | string | |
order_placed_date_formatted | string | |
payment_processed_date | string | |
payment_processed_date_formatted | string | |
shipped_date | string | |
shipped_date_formatted | string | |
shipping_method | string | |
status | string | |
status_description | string | |
tracking_number | string | |
tracking_url | string |
Name | Data Type | Description |
---|---|---|
ip_address | string | IP Address |
note | string | note |
note_dts | (read only) string (dateTime) | Timestamp when the note was added |
user | string | User that wrote the merchant note |
Name | Data Type | Description |
---|---|---|
attribution_first_click_subtotal | number | |
attribution_first_click_total | number | |
attribution_last_click_subtotal | number | |
attribution_last_click_total | number | |
attribution_linear_subtotal | number | |
attribution_linear_total | number | |
attribution_position_based_subtotal | number | |
attribution_position_based_total | number | |
click_dts | (read only) string (dateTime) | Date/time that the click happened |
facebook_ad_id | string | |
fbclid | string | |
gbraid | string | |
glcid | string | |
itm_campaign | string | |
itm_content | string | |
itm_id | string | |
itm_medium | string | |
itm_source | string | |
itm_term | string | |
msclkid | string | |
short_code | string | |
short_code_backup | boolean | |
ttclid | string | |
uc_message_id | string | |
utm_campaign | string | |
utm_content | string | |
utm_id | string | |
utm_medium | string | |
utm_source | string | |
utm_term | string | |
vmcid | string | |
wbraid | string |
Name | Data Type | Description |
---|---|---|
adddress2 | string | Address line 2 |
address1 | string | Address line 1 |
city | string | City |
country | string | Country |
distribution_center_code | string | The distribution center code where inventory is reduced from for this sale. |
external_id | string(100) | External Id useful for syncing with a remote filesystem, this may be an MD5 hash or whatever suits your needs. |
merchant_id | string | Merchant ID that owns this location |
pos_location_oid | integer (int32) | Object identifier of the point of sale location. |
postal_code | string | Postal code |
state_province | string | State/province |
Name | Data Type | Description |
---|---|---|
device_type | string | The device type of the reader. |
label | string | The label of the reader. |
merchant_id | string | The merchant id that owns this point of sale reader. |
payment_provider | string | The payment provider for the card reader.
Allowed Values
|
pos_reader_id | integer (int32) | Object identifier of the point of sale reader. |
pos_register_oid | integer (int32) | Object identifier of the point of sale register this reader is assigned to. |
serial_number | string | The serial number of the reader. |
stripe_account_id | string | If the payment provider is Stripe, this is the Stripe account id |
stripe_reader_id | string | If the payment provide is Stripe, this is the Stripe terminal reader id |
Name | Data Type | Description |
---|---|---|
merchant_id | string | The merchant id that owns this point of sale register. |
name | string | Name of the register. |
pos_location_oid | integer (int32) | Object identifier of the point of sale location where this register is located. |
pos_register_oid | integer (int32) | Object identifier of the point of sale register. |
Name | Data Type | Description |
---|---|---|
name | string | |
value | string |
Name | Data Type | Description |
---|---|---|
affid | integer (int32) | Affiliate Id (must be specified if landing_page_url is not) |
ip_address | string | IP Address (must be specified for non-browser key authenticated) |
landing_page_url | string | Landing Page URL |
referrer_url | string | Referrer URL (used for detecting invisible linking) |
subid | string | Sub Id (optional value if affid is specified. |
user_agent | string | User agent of the browser (must be specified for non-browser key authenticated) |
Name | Data Type | Description |
---|---|---|
cookie_max_age | integer (int32) | The cookie max age to use |
cookie_names | array of string | The names of all the cookies to set on the browser |
cookie_values | array of string | The values of all the cookies to set on the browser |
registered | boolean | True if a click was registered |
Name | Data Type | Description |
---|---|---|
payload_name | string | Payload name |
result_set | ResultSet | Result set |
Name | Data Type | Description |
---|---|---|
count | integer (int32) | Number of results in this set |
limit | integer (int32) | Maximum number of results that can be returned in a set |
more | boolean | True if there are more results to query |
next_offset | integer (int32) | The next offset that you should query to retrieve more results |
offset | integer (int32) | Offset of this result set (zero based) |
total_records | integer (int32) | The total number of records in the result set. May be null if the number is not known and the client should continue iterating as long as more is true. |
Name | Data Type | Description |
---|---|---|
abbreviation | string | abbreviation |
name | string(50) | name |
Name | Data Type | Description |
---|---|---|
more_info | string | Additional information often a link to additional documentation |
warning_message | string | A technical message meant to be read by a developer |
Name | Data Type | Description |
---|---|---|
uom | string | Unit of measure
Allowed Values
|
value | number | Weight |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |