csharp
java
javascript
php
python
ruby
typescript

auto_order

/auto_order

The auto order REST API provides all the functionality necessary manipulate auto orders on your UltraCart account.

Software Development Kit (SDK)

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.

Instantiating the API

There are four steps to instantiating the API.

  1. Include the SDK package
  2. Set the API credentials.
  3. Set the API version header.
  4. Instantiate the API Client.

Expansion

The auto order REST API has the capability to expand everything related to the auto order including the original and rebill order records. By default, when you read an auto order, a limited object is returned. If you specify the _expand parameter, additional properties of the auto order object are returned. We encourage you to limit the amount of information that you query for auto orders to the minimal amount possible to have optimal communication. The following expansion operations are available.

Retrieve auto orders

Permissions:
  • auto_order_read

Produces: application/json
get
/auto_order/auto_orders

Retrieves auto orders from the account. If no parameters are specified, all auto orders will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.

SDK Function Name: getAutoOrders

Parameters
Parameter Description Location Data Type Required
auto_order_code Auto order code query string optional
original_order_id Original order id query string optional
first_name First name query string optional
last_name Last name query string optional
company Company query string optional
city City query string optional
state State query string optional
postal_code Postal code query string optional
country_code Country code (ISO-3166 two letter) query string optional
phone Phone query string optional
email Email query string optional
original_order_date_begin Original order date begin query string (dateTime) optional
original_order_date_end Original order date end query string (dateTime) optional
next_shipment_date_begin Next shipment date begin query string (dateTime) optional
next_shipment_date_end Next shipment date end query string (dateTime) optional
card_type Card type query string optional
item_id Item ID query string optional
status Status query string optional
_limit The maximum number of records to return on this one API call. (Max 200)
Default: 100
query integer optional
_offset Pagination of the record set. Offset is a zero based index.
Default: 0
query integer optional
_since Fetch auto orders that have been created/modified since this date/time. query dateTime optional
_sort The sort order of the auto orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
Allowed Values
  • auto_order_code
  • order_id
  • shipping.company
  • shipping.first_name
  • shipping.last_name
  • shipping.city
  • shipping.state_region
  • shipping.postal_code
  • shipping.country_code
  • billing.phone
  • billing.email
  • billing.cc_email
  • billing.company
  • billing.first_name
  • billing.last_name
  • billing.city
  • billing.state
  • billing.postal_code
  • billing.country_code
  • creation_dts
  • payment.payment_dts
  • checkout.screen_branding_theme_code
  • next_shipment_dts
query string optional
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrdersResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Collections.Generic;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class GetAutoOrders
    {
        /*
        getAutoOrders provides a query service on AutoOrders (aka subscriptions or recurring orders) within the UltraCart
        system. It was the first query provided and the most cumbersome to use.  Please use getAutoOrdersByQuery for an
        easier query method.  If you have multiple auto_order_oids and need the corresponding objects, consider
        getAutoOrdersBatch() to reduce call count.
        */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");
            
            try
            {
                List<AutoOrder> autoOrders = new List<AutoOrder>();
                
                int iteration = 1;
                int offset = 0;
                int limit = 200;
                bool moreRecordsToFetch = true;
                
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);
                
                while (moreRecordsToFetch)
                {
                    Console.WriteLine($"executing iteration {iteration}");
                    List<AutoOrder> chunkOfAutoOrders = GetAutoOrderChunk(autoOrderApi, offset, limit);
                    autoOrders.AddRange(chunkOfAutoOrders);
                    offset = offset + limit;
                    moreRecordsToFetch = chunkOfAutoOrders.Count == limit;
                    iteration++;
                }
                
                // Display the auto orders
                foreach (var autoOrder in autoOrders)
                {
                    Console.WriteLine(autoOrder);
                }
                
                Console.WriteLine($"Total auto orders retrieved: {autoOrders.Count}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
        
        /// <summary>
        /// Returns a chunk of auto orders based on query parameters
        /// </summary>
        /// <param name="autoOrderApi">The auto order API instance</param>
        /// <param name="offset">Pagination offset</param>
        /// <param name="limit">Maximum number of records to return</param>
        /// <returns>List of matching auto orders</returns>
        public static List<AutoOrder> GetAutoOrderChunk(AutoOrderApi autoOrderApi, int offset, int limit)
        {
            string expand = "items,original_order,rebill_orders";
            // see www.ultracart.com/api/ for all the expansion fields available (this list below may become stale)
            /*
            Possible Order Expansions:

            add_ons                             items.sample_schedule	        original_order.buysafe	        original_order.payment.transaction
            items	                            original_order	                original_order.channel_partner	original_order.quote
            items.future_schedules	            original_order.affiliate	    original_order.checkout	        original_order.salesforce
            original_order.affiliate.ledger	    original_order.coupon	        original_order.shipping
            original_order.auto_order	        original_order.customer_profile	original_order.summary
            original_order.billing	            original_order.digital_order	original_order.taxes
            rebill_orders	                    original_order.edi	            rebill_orders.affiliate
            rebill_orders.affiliate.ledger	    original_order.fraud_score	    rebill_orders.auto_order
            rebill_orders.billing	            original_order.gift	            rebill_orders.buysafe
            rebill_orders.channel_partner	    original_order.gift_certificate	rebill_orders.checkout
            rebill_orders.coupon	            original_order.internal	        rebill_orders.customer_profile
            rebill_orders.digital_order	        original_order.item	            rebill_orders.edi
            rebill_orders.fraud_score	        original_order.linked_shipment	rebill_orders.gift
            rebill_orders.gift_certificate      original_order.marketing	    rebill_orders.internal
            rebill_orders.item	                original_order.payment	        rebill_orders.linked_shipment
            rebill_orders.marketing	            rebill_orders.payment	        rebill_orders.quote
            rebill_orders.payment.transaction	rebill_orders.salesforce	    rebill_orders.shipping
            rebill_orders.summary	            rebill_orders.taxes
            */
            
            string autoOrderCode = null;
            string originalOrderId = null;
            string firstName = null;
            string lastName = null;
            string company = null;
            string city = null;
            string state = null;
            string postalCode = null;
            string countryCode = null;
            string phone = null;
            string email = "test@ultracart.com"; // <-- for this example, we are only filtering on email address.
            string originalOrderDateBegin = null;
            string originalOrderDateEnd = null;
            string nextShipmentDateBegin = null;
            string nextShipmentDateEnd = null;
            string cardType = null;
            string itemId = null;
            string status = null;
            string since = null;
            string sort = null;
            
            // see all these parameters?  that is why you should use getAutoOrdersByQuery() instead of getAutoOrders()
            var apiResponse = autoOrderApi.GetAutoOrders(autoOrderCode, originalOrderId, firstName, lastName,
                company, city, state, postalCode, countryCode, phone, email, originalOrderDateBegin,
                originalOrderDateEnd, nextShipmentDateBegin, nextShipmentDateEnd, cardType, itemId, status,
                limit, offset, since, sort, expand);
                
            if (apiResponse.AutoOrders != null)
            {
                return apiResponse.AutoOrders;
            }
            return new List<AutoOrder>();
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.AutoOrder;
import com.ultracart.admin.v2.models.AutoOrdersResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;

import java.util.ArrayList;
import java.util.List;

public class GetAutoOrders {
    /**
    getAutoOrders provides a query service on AutoOrders (aka subscriptions or recurring orders) within the UltraCart
    system. It was the first query provided and the most cumbersome to use.  Please use getAutoOrdersByQuery for an
    easier query method.  If you have multiple auto_order_oids and need the corresponding objects, consider
    getAutoOrdersBatch() to reduce call count.
    */
    public static void execute() {
        System.out.println("--- " + GetAutoOrders.class.getSimpleName() + " ---");
        
        try {
            List<AutoOrder> autoOrders = new ArrayList<AutoOrder>();
            
            int iteration = 1;
            int offset = 0;
            int limit = 200;
            boolean moreRecordsToFetch = true;
            
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);
            
            while (moreRecordsToFetch) {
                System.out.println("executing iteration " + iteration);
                List<AutoOrder> chunkOfAutoOrders = getAutoOrderChunk(autoOrderApi, offset, limit);
                autoOrders.addAll(chunkOfAutoOrders);
                offset = offset + limit;
                moreRecordsToFetch = chunkOfAutoOrders.size() == limit;
                iteration++;
            }
            
            // Display the auto orders
            for (AutoOrder autoOrder : autoOrders) {
                System.out.println(autoOrder);
            }
            
            System.out.println("Total auto orders retrieved: " + autoOrders.size());
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
    
    /**
     * Returns a chunk of auto orders based on query parameters
     * @param autoOrderApi The auto order API instance
     * @param offset Pagination offset
     * @param limit Maximum number of records to return
     * @return List of matching auto orders
     */
    public static List<AutoOrder> getAutoOrderChunk(AutoOrderApi autoOrderApi, int offset, int limit) throws ApiException {
        String expand = "items,original_order,rebill_orders";
        // see www.ultracart.com/api/ for all the expansion fields available (this list below may become stale)
        /*
        Possible Order Expansions:

        add_ons                             items.sample_schedule	        original_order.buysafe	        original_order.payment.transaction
        items	                            original_order	                original_order.channel_partner	original_order.quote
        items.future_schedules	            original_order.affiliate	    original_order.checkout	        original_order.salesforce
        original_order.affiliate.ledger	    original_order.coupon	        original_order.shipping
        original_order.auto_order	        original_order.customer_profile	original_order.summary
        original_order.billing	            original_order.digital_order	original_order.taxes
        rebill_orders	                    original_order.edi	            rebill_orders.affiliate
        rebill_orders.affiliate.ledger	    original_order.fraud_score	    rebill_orders.auto_order
        rebill_orders.billing	            original_order.gift	            rebill_orders.buysafe
        rebill_orders.channel_partner	    original_order.gift_certificate	rebill_orders.checkout
        rebill_orders.coupon	            original_order.internal	        rebill_orders.customer_profile
        rebill_orders.digital_order	        original_order.item	            rebill_orders.edi
        rebill_orders.fraud_score	        original_order.linked_shipment	rebill_orders.gift
        rebill_orders.gift_certificate      original_order.marketing	    rebill_orders.internal
        rebill_orders.item	                original_order.payment	        rebill_orders.linked_shipment
        rebill_orders.marketing	            rebill_orders.payment	        rebill_orders.quote
        rebill_orders.payment.transaction	rebill_orders.salesforce	    rebill_orders.shipping
        rebill_orders.summary	            rebill_orders.taxes
        */
        
        String autoOrderCode = null;
        String originalOrderId = null;
        String firstName = null;
        String lastName = null;
        String company = null;
        String city = null;
        String state = null;
        String postalCode = null;
        String countryCode = null;
        String phone = null;
        String email = "test@ultracart.com"; // <-- for this example, we are only filtering on email address.
        String originalOrderDateBegin = null;
        String originalOrderDateEnd = null;
        String nextShipmentDateBegin = null;
        String nextShipmentDateEnd = null;
        String cardType = null;
        String itemId = null;
        String status = null;
        String since = null;
        String sort = null;
        
        // see all these parameters?  that is why you should use getAutoOrdersByQuery() instead of getAutoOrders()
        AutoOrdersResponse apiResponse = autoOrderApi.getAutoOrders(autoOrderCode, originalOrderId, firstName, lastName,
            company, city, state, postalCode, countryCode, phone, email, originalOrderDateBegin,
            originalOrderDateEnd, nextShipmentDateBegin, nextShipmentDateEnd, cardType, itemId, status,
            limit, offset, since, sort, expand);
            
        if (apiResponse.getAutoOrders() != null) {
            return apiResponse.getAutoOrders();
        }
        return new ArrayList<AutoOrder>();
    }
}
import {autoOrderApi} from "../api.js";

/**
 * getAutoOrders provides a query service on AutoOrders (aka subscriptions or recurring orders) within the UltraCart
 * system. It was the first query provided and the most cumbersome to use.  Please use getAutoOrdersByQuery for an
 * easier query method.  If you have multiple auto_order_oids and need the corresponding objects, consider
 * getAutoOrdersBatch() to reduce call count.
 */
export class GetAutoOrders {
    /**
     * Executes the auto orders retrieval process
     */
    static async execute() {
        console.log(`--- ${this.name} ---`);

        try {
            const autoOrders = [];

            let iteration = 1;
            let offset = 0;
            const limit = 200;
            let moreRecordsToFetch = true;

            while (moreRecordsToFetch) {
                console.log(`executing iteration ${iteration}`);
                const chunkOfAutoOrders = await this.getAutoOrderChunk(offset, limit);
                autoOrders.push(...chunkOfAutoOrders);
                offset = offset + limit;
                moreRecordsToFetch = chunkOfAutoOrders.length === limit;
                iteration++;
            }

            // Display the auto orders
            for (const autoOrder of autoOrders) {
                console.log(autoOrder);
            }

            console.log(`Total auto orders retrieved: ${autoOrders.length}`);
        } catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : String(ex)}`);
            console.error(ex instanceof Error ? ex.stack : 'No stack trace available');
        }
    }

    /**
     * Returns a chunk of auto orders based on query parameters
     * @param offset Pagination offset
     * @param limit Maximum number of records to return
     * @returns List of matching auto orders
     */
    static async getAutoOrderChunk(offset, limit) {
        const expand = "items,original_order,rebill_orders";
        /*
        Possible Order Expansions:

        add_ons                             items.sample_schedule	        original_order.buysafe	        original_order.payment.transaction
        items	                            original_order	                original_order.channel_partner	original_order.quote
        items.future_schedules	            original_order.affiliate	    original_order.checkout	        original_order.salesforce
        original_order.affiliate.ledger	    original_order.coupon	        original_order.shipping
        original_order.auto_order	        original_order.customer_profile	original_order.summary
        original_order.billing	            original_order.digital_order	original_order.taxes
        rebill_orders	                    original_order.edi	            rebill_orders.affiliate
        rebill_orders.affiliate.ledger	    original_order.fraud_score	    rebill_orders.auto_order
        rebill_orders.billing	            original_order.gift	            rebill_orders.buysafe
        rebill_orders.channel_partner	    original_order.gift_certificate	rebill_orders.checkout
        rebill_orders.coupon	            original_order.internal	        rebill_orders.customer_profile
        rebill_orders.digital_order	        original_order.item	            rebill_orders.edi
        rebill_orders.fraud_score	        original_order.linked_shipment	rebill_orders.gift
        rebill_orders.gift_certificate      original_order.marketing	    rebill_orders.internal
        rebill_orders.item	                original_order.payment	        rebill_orders.linked_shipment
        rebill_orders.marketing	            rebill_orders.payment	        rebill_orders.quote
        rebill_orders.payment.transaction	rebill_orders.salesforce	    rebill_orders.shipping
        rebill_orders.summary	            rebill_orders.taxes
        */

        const queryParams = {
            autoOrderCode: undefined,
            originalOrderId: undefined,
            firstName: undefined,
            lastName: undefined,
            company: undefined,
            city: undefined,
            state: undefined,
            postalCode: undefined,
            countryCode: undefined,
            phone: undefined,
            email: "test@ultracart.com", // for this example, we are only filtering on email address
            originalOrderDateBegin: undefined,
            originalOrderDateEnd: undefined,
            nextShipmentDateBegin: undefined,
            nextShipmentDateEnd: undefined,
            cardType: undefined,
            itemId: undefined,
            status: undefined,
            _limit: limit,
            _offset: offset,
            _since: undefined,
            _sort: undefined,
            _expand: expand
        };

        const apiResponse = await new Promise((resolve, reject) => {
            autoOrderApi.getAutoOrders(queryParams, function (error, data, response) {
                if (error) {
                    reject(error);
                } else {
                    resolve(data, response);
                }
            });
        });

        return apiResponse.auto_orders ?? [];
    }
}

// Define an object for the query parameters to make the code more structured
// Note: In JavaScript, we don't need a separate interface definition
<?php

use ultracart\v2\api\AutoOrderApi;

set_time_limit(3000); // pull all orders could take a long time.
ini_set('max_execution_time', 3000);
ini_set('display_errors', 1);

/*

getAutoOrders provides a query service on AutoOrders (aka subscriptions or recurring orders) within the UltraCart
system. It was the first query provided and the most cumbersome to use.  Please use getAutoOrdersByQuery for an
easier query method.  If you have multiple auto_order_oids and need the corresponding objects, consider
getAutoOrdersBatch() to reduce call count.

*/


require_once '../vendor/autoload.php';
require_once '../constants.php';


$auto_order_api = AutoOrderApi::usingApiKey(Constants::API_KEY);


function getAutoOrderChunk(AutoOrderApi $auto_order_api, int $_offset, int $_limit): array
{
    $_expand = "items,original_order,rebill_orders";
    // see www.ultracart.com/api/ for all the expansion fields available (this list below may become stale)
    /*
    Possible Order Expansions:

    add_ons                             items.sample_schedule	        original_order.buysafe	        original_order.payment.transaction
    items	                            original_order	                original_order.channel_partner	original_order.quote
    items.future_schedules	            original_order.affiliate	    original_order.checkout	        original_order.salesforce
    original_order.affiliate.ledger	    original_order.coupon	        original_order.shipping
    original_order.auto_order	        original_order.customer_profile	original_order.summary
    original_order.billing	            original_order.digital_order	original_order.taxes
    rebill_orders	                    original_order.edi	            rebill_orders.affiliate
    rebill_orders.affiliate.ledger	    original_order.fraud_score	    rebill_orders.auto_order
    rebill_orders.billing	            original_order.gift	            rebill_orders.buysafe
    rebill_orders.channel_partner	    original_order.gift_certificate	rebill_orders.checkout
    rebill_orders.coupon	            original_order.internal	        rebill_orders.customer_profile
    rebill_orders.digital_order	        original_order.item	            rebill_orders.edi
    rebill_orders.fraud_score	        original_order.linked_shipment	rebill_orders.gift
    rebill_orders.gift_certificate      original_order.marketing	    rebill_orders.internal
    rebill_orders.item	                original_order.payment	        rebill_orders.linked_shipment
    rebill_orders.marketing	            rebill_orders.payment	        rebill_orders.quote
    rebill_orders.payment.transaction	rebill_orders.salesforce	    rebill_orders.shipping
    rebill_orders.summary	            rebill_orders.taxes

    */

    $auto_order_code = null;
    $original_order_id = null;
    $first_name = null;
    $last_name = null;
    $company = null;
    $city = null;
    $state = null;
    $postal_code = null;
    $country_code = null;
    $phone = null;
    $email = 'test@ultracart.com'; // <-- for this example, we are only filtering on email address.
    $original_order_date_begin = null;
    $original_order_date_end = null;
    $next_shipment_date_begin = null;
    $next_shipment_date_end = null;
    $card_type = null;
    $item_id = null;
    $status = null;
    $_since = null;
    $_sort = null;



    // see all these parameters?  that is why you should use getAutoOrdersByQuery() instead of getAutoOrders()
    $api_response = $auto_order_api->getAutoOrders($auto_order_code, $original_order_id, $first_name, $last_name,
        $company, $city, $state, $postal_code, $country_code, $phone, $email, $original_order_date_begin,
        $original_order_date_end, $next_shipment_date_begin, $next_shipment_date_end, $card_type, $item_id, $status,
        $_limit, $_offset, $_since, $_sort, $_expand);

    if($api_response->getAutoOrders() != null){
        return $api_response->getAutoOrders();
    }
    return [];
}

$auto_orders = [];

$iteration = 1;
$offset = 0;
$limit = 200;
$more_records_to_fetch = true;

while( $more_records_to_fetch ){

    echo "executing iteration " . $iteration . '<br>';
    $chunk_of_auto_orders = getAutoOrderChunk($auto_order_api, $offset, $limit);
    $auto_orders = array_merge($auto_orders, $chunk_of_auto_orders);
    $offset = $offset + $limit;
    $more_records_to_fetch = count($chunk_of_auto_orders) == $limit;
    $iteration++;

}

// this could get verbose...
echo '<html lang="en"><body><pre>';
var_dump($auto_orders);
echo '</pre></body></html>';

from ultracart.apis import AutoOrderApi
from samples import api_client

# getAutoOrders provides a query service on AutoOrders (aka subscriptions or recurring orders) within the UltraCart
# system. It was the first query provided and the most cumbersome to use.  Please use getAutoOrdersByQuery for an
# easier query method.  If you have multiple auto_order_oids and need the corresponding objects, consider
# getAutoOrdersBatch() to reduce call count.

def get_auto_order_chunk(auto_order_api, offset, limit):
    expand = "items,original_order,rebill_orders"
    # see www.ultracart.com/api/ for all the expansion fields available (this list below may become stale)
    """
    Possible Order Expansions:

    add_ons                             items.sample_schedule	        original_order.buysafe	        original_order.payment.transaction
    items	                            original_order	                original_order.channel_partner	original_order.quote
    items.future_schedules	            original_order.affiliate	    original_order.checkout	        original_order.salesforce
    original_order.affiliate.ledger	    original_order.coupon	        original_order.shipping
    original_order.auto_order	        original_order.customer_profile	original_order.summary
    original_order.billing	            original_order.digital_order	original_order.taxes
    rebill_orders	                    original_order.edi	            rebill_orders.affiliate
    rebill_orders.affiliate.ledger	    original_order.fraud_score	    rebill_orders.auto_order
    rebill_orders.billing	            original_order.gift	            rebill_orders.buysafe
    rebill_orders.channel_partner	    original_order.gift_certificate	rebill_orders.checkout
    rebill_orders.coupon	            original_order.internal	        rebill_orders.customer_profile
    rebill_orders.digital_order	        original_order.item	            rebill_orders.edi
    rebill_orders.fraud_score	        original_order.linked_shipment	rebill_orders.gift
    rebill_orders.gift_certificate      original_order.marketing	    rebill_orders.internal
    rebill_orders.item	                original_order.payment	        rebill_orders.linked_shipment
    rebill_orders.marketing	            rebill_orders.payment	        rebill_orders.quote
    rebill_orders.payment.transaction	rebill_orders.salesforce	    rebill_orders.shipping
    rebill_orders.summary	            rebill_orders.taxes
    """

    auto_order_code = None
    original_order_id = None
    first_name = None
    last_name = None
    company = None
    city = None
    state = None
    postal_code = None
    country_code = None
    phone = None
    email = 'test@ultracart.com'  # <-- for this example, we are only filtering on email address.
    original_order_date_begin = None
    original_order_date_end = None
    next_shipment_date_begin = None
    next_shipment_date_end = None
    card_type = None
    item_id = None
    status = None
    since = None
    sort = None

    # see all these parameters?  that is why you should use getAutoOrdersByQuery() instead of getAutoOrders()
    api_response = auto_order_api.get_auto_orders(auto_order_code, original_order_id, first_name, last_name,
        company, city, state, postal_code, country_code, phone, email, original_order_date_begin,
        original_order_date_end, next_shipment_date_begin, next_shipment_date_end, card_type, item_id, status,
        limit, offset, since, sort, expand=expand)

    if api_response.auto_orders is not None:
        return api_response.auto_orders
    return []

def get_all_auto_orders():
    auto_order_api = AutoOrderApi(api_client())
    auto_orders = []

    iteration = 1
    offset = 0
    limit = 200
    more_records_to_fetch = True

    while more_records_to_fetch:
        print(f"executing iteration {iteration}")
        chunk_of_auto_orders = get_auto_order_chunk(auto_order_api, offset, limit)
        auto_orders.extend(chunk_of_auto_orders)
        offset = offset + limit
        more_records_to_fetch = len(chunk_of_auto_orders) == limit
        iteration += 1

    # this could get verbose...
    print(auto_orders)

if __name__ == "__main__":
    get_all_auto_orders()
require 'ultracart_api'
require_relative '../constants'

# getAutoOrders provides a query service on AutoOrders (aka subscriptions or recurring orders) within the UltraCart
# system. It was the first query provided and the most cumbersome to use.  Please use getAutoOrdersByQuery for an
# easier query method.  If you have multiple auto_order_oids and need the corresponding objects, consider
# getAutoOrdersBatch() to reduce call count.

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

def get_auto_order_chunk(auto_order_api, offset, limit)
  expand = "items,original_order,rebill_orders"
  # see www.ultracart.com/api/ for all the expansion fields available (this list below may become stale)
  #
  # Possible Order Expansions:
  #
  # add_ons                             items.sample_schedule	        original_order.buysafe	        original_order.payment.transaction
  # items	                            original_order	                original_order.channel_partner	original_order.quote
  # items.future_schedules	            original_order.affiliate	    original_order.checkout	        original_order.salesforce
  # original_order.affiliate.ledger	    original_order.coupon	        original_order.shipping
  # original_order.auto_order	        original_order.customer_profile	original_order.summary
  # original_order.billing	            original_order.digital_order	original_order.taxes
  # rebill_orders	                    original_order.edi	            rebill_orders.affiliate
  # rebill_orders.affiliate.ledger	    original_order.fraud_score	    rebill_orders.auto_order
  # rebill_orders.billing	            original_order.gift	            rebill_orders.buysafe
  # rebill_orders.channel_partner	    original_order.gift_certificate	rebill_orders.checkout
  # rebill_orders.coupon	            original_order.internal	        rebill_orders.customer_profile
  # rebill_orders.digital_order	        original_order.item	            rebill_orders.edi
  # rebill_orders.fraud_score	        original_order.linked_shipment	rebill_orders.gift
  # rebill_orders.gift_certificate      original_order.marketing	    rebill_orders.internal
  # rebill_orders.item	                original_order.payment	        rebill_orders.linked_shipment
  # rebill_orders.marketing	            rebill_orders.payment	        rebill_orders.quote
  # rebill_orders.payment.transaction	rebill_orders.salesforce	    rebill_orders.shipping
  # rebill_orders.summary	            rebill_orders.taxes

  auto_order_code = nil
  original_order_id = nil
  first_name = nil
  last_name = nil
  company = nil
  city = nil
  state = nil
  postal_code = nil
  country_code = nil
  phone = nil
  email = 'test@ultracart.com' # <-- for this example, we are only filtering on email address.
  original_order_date_begin = nil
  original_order_date_end = nil
  next_shipment_date_begin = nil
  next_shipment_date_end = nil
  card_type = nil
  item_id = nil
  status = nil
  since = nil
  sort = nil

  # see all these parameters?  that is why you should use getAutoOrdersByQuery() instead of getAutoOrders()
  api_response = auto_order_api.get_auto_orders(auto_order_code, original_order_id, first_name, last_name,
    company, city, state, postal_code, country_code, phone, email, original_order_date_begin,
    original_order_date_end, next_shipment_date_begin, next_shipment_date_end, card_type, item_id, status,
    limit, offset, since, sort, { '_expand' => expand })

  api_response.auto_orders || []
end

auto_orders = []

iteration = 1
offset = 0
limit = 200
import { autoOrderApi } from "../api";
import { AutoOrder } from 'ultracart_rest_api_v2_typescript';

/**
 * getAutoOrders provides a query service on AutoOrders (aka subscriptions or recurring orders) within the UltraCart
 * system. It was the first query provided and the most cumbersome to use.  Please use getAutoOrdersByQuery for an
 * easier query method.  If you have multiple auto_order_oids and need the corresponding objects, consider
 * getAutoOrdersBatch() to reduce call count.
 */
export class GetAutoOrders {
    /**
     * Executes the auto orders retrieval process
     */
    public static async execute(): Promise<void> {
        console.log(`--- ${this.name} ---`);

        try {
            const autoOrders: AutoOrder[] = [];

            let iteration = 1;
            let offset = 0;
            const limit = 200;
            let moreRecordsToFetch = true;

            while (moreRecordsToFetch) {
                console.log(`executing iteration ${iteration}`);
                const chunkOfAutoOrders = await this.getAutoOrderChunk(offset, limit);
                autoOrders.push(...chunkOfAutoOrders);
                offset = offset + limit;
                moreRecordsToFetch = chunkOfAutoOrders.length === limit;
                iteration++;
            }

            // Display the auto orders
            for (const autoOrder of autoOrders) {
                console.log(autoOrder);
            }

            console.log(`Total auto orders retrieved: ${autoOrders.length}`);
        }
        catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : String(ex)}`);
            console.error(ex instanceof Error ? ex.stack : 'No stack trace available');
        }
    }

    /**
     * Returns a chunk of auto orders based on query parameters
     * @param offset Pagination offset
     * @param limit Maximum number of records to return
     * @returns List of matching auto orders
     */
    private static async getAutoOrderChunk(
        offset: number,
        limit: number
    ): Promise<AutoOrder[]> {
        const expand = "items,original_order,rebill_orders";
        /*
        Possible Order Expansions:

        add_ons                             items.sample_schedule	        original_order.buysafe	        original_order.payment.transaction
        items	                            original_order	                original_order.channel_partner	original_order.quote
        items.future_schedules	            original_order.affiliate	    original_order.checkout	        original_order.salesforce
        original_order.affiliate.ledger	    original_order.coupon	        original_order.shipping
        original_order.auto_order	        original_order.customer_profile	original_order.summary
        original_order.billing	            original_order.digital_order	original_order.taxes
        rebill_orders	                    original_order.edi	            rebill_orders.affiliate
        rebill_orders.affiliate.ledger	    original_order.fraud_score	    rebill_orders.auto_order
        rebill_orders.billing	            original_order.gift	            rebill_orders.buysafe
        rebill_orders.channel_partner	    original_order.gift_certificate	rebill_orders.checkout
        rebill_orders.coupon	            original_order.internal	        rebill_orders.customer_profile
        rebill_orders.digital_order	        original_order.item	            rebill_orders.edi
        rebill_orders.fraud_score	        original_order.linked_shipment	rebill_orders.gift
        rebill_orders.gift_certificate      original_order.marketing	    rebill_orders.internal
        rebill_orders.item	                original_order.payment	        rebill_orders.linked_shipment
        rebill_orders.marketing	            rebill_orders.payment	        rebill_orders.quote
        rebill_orders.payment.transaction	rebill_orders.salesforce	    rebill_orders.shipping
        rebill_orders.summary	            rebill_orders.taxes
        */

        const queryParams: GetAutoOrdersQueryParams = {
            autoOrderCode: undefined,
            originalOrderId: undefined,
            firstName: undefined,
            lastName: undefined,
            company: undefined,
            city: undefined,
            state: undefined,
            postalCode: undefined,
            countryCode: undefined,
            phone: undefined,
            email: "test@ultracart.com", // for this example, we are only filtering on email address
            originalOrderDateBegin: undefined,
            originalOrderDateEnd: undefined,
            nextShipmentDateBegin: undefined,
            nextShipmentDateEnd: undefined,
            cardType: undefined,
            itemId: undefined,
            status: undefined,
            limit,
            offset,
            since: undefined,
            sort: undefined,
            expand
        };

        const apiResponse = await autoOrderApi.getAutoOrders(queryParams);

        return apiResponse.auto_orders ?? [];
    }
}

// Define an interface for the query parameters to make the code more type-safe
interface GetAutoOrdersQueryParams {
    autoOrderCode?: string;
    originalOrderId?: string;
    firstName?: string;
    lastName?: string;
    company?: string;
    city?: string;
    state?: string;
    postalCode?: string;
    countryCode?: string;
    phone?: string;
    email?: string;
    originalOrderDateBegin?: string;
    originalOrderDateEnd?: string;
    nextShipmentDateBegin?: string;
    nextShipmentDateEnd?: string;
    cardType?: string;
    itemId?: string;
    status?: string;
    limit: number;
    offset: number;
    since?: string;
    sort?: string;
    expand: string;
}

Retrieve auto order batch

Permissions:
  • order_read

Produces: application/json
post
/auto_order/auto_orders/batch

Retrieves a group of auto orders from the account based on an array of auto order oids. If more than 200 auto order ids are specified, the API call will fail with a bad request error.

SDK Function Name: getAutoOrdersBatch

Parameters
Parameter Description Location Data Type Required
auto_order_batch Auto order batch body AutoOrderQueryBatch required
_expand The object expansion to perform on the result. query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrdersResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Collections.Generic;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class GetAutoOrdersBatch
    {
        /*
         * This example illustrates how to retrieve auto orders when you have a list of auto_order_oid.
         * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
         * and may become stale. Please review the master website when in doubt.
         * items
         * items.future_schedules
         * items.sample_schedule
         * original_order
         * original_order.affiliate
         * original_order.affiliate.ledger
         * original_order.auto_order
         * original_order.billing
         * original_order.buysafe
         * original_order.channel_partner
         * original_order.checkout
         * original_order.coupon
         * original_order.customer_profile
         * original_order.digital_order
         * original_order.edi
         * original_order.fraud_score
         * original_order.gift
         * original_order.gift_certificate
         * original_order.internal
         * original_order.item
         * original_order.linked_shipment
         * original_order.marketing
         * original_order.payment
         * original_order.payment.transaction
         * original_order.quote
         * original_order.salesforce
         * original_order.shipping
         * original_order.summary
         * original_order.taxes
         * rebill_orders
         * rebill_orders.affiliate
         * rebill_orders.affiliate.ledger
         * rebill_orders.auto_order
         * rebill_orders.billing
         * rebill_orders.buysafe
         * rebill_orders.channel_partner
         * rebill_orders.checkout
         * rebill_orders.coupon
         * rebill_orders.customer_profile
         * rebill_orders.digital_order
         * rebill_orders.edi
         * rebill_orders.fraud_score
         * rebill_orders.gift
         * rebill_orders.gift_certificate
         * rebill_orders.internal
         * rebill_orders.item
         * rebill_orders.linked_shipment
         * rebill_orders.marketing
         * rebill_orders.payment
         * rebill_orders.payment.transaction
         * rebill_orders.quote
         * rebill_orders.salesforce
         * rebill_orders.shipping
         * rebill_orders.summary
         * rebill_orders.taxes*
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");

            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);

                string expand =
                    "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
                List<int> autoOrderOids = new List<int> { 123456, 234567, 345678, 456789 };

                AutoOrderQueryBatch batchRequest = new AutoOrderQueryBatch();
                batchRequest.AutoOrderOids = autoOrderOids;

                var apiResponse = autoOrderApi.GetAutoOrdersBatch(batchRequest, expand);
                List<AutoOrder> autoOrders = apiResponse.AutoOrders;

                // Display auto orders
                foreach (var autoOrder in autoOrders)
                {
                    Console.WriteLine(autoOrder);
                }

                Console.WriteLine($"Retrieved {autoOrders.Count} auto orders");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.AutoOrder;
import com.ultracart.admin.v2.models.AutoOrderQueryBatch;
import com.ultracart.admin.v2.models.AutoOrdersResponse;
import common.Constants;

import java.util.Arrays;
import java.util.List;

public class GetAutoOrdersBatch {
    /**
     * This example illustrates how to retrieve auto orders when you have a list of auto_order_oid.
     * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
     * and may become stale. Please review the master website when in doubt.
     * items
     * items.future_schedules
     * items.sample_schedule
     * original_order
     * original_order.affiliate
     * original_order.affiliate.ledger
     * original_order.auto_order
     * original_order.billing
     * original_order.buysafe
     * original_order.channel_partner
     * original_order.checkout
     * original_order.coupon
     * original_order.customer_profile
     * original_order.digital_order
     * original_order.edi
     * original_order.fraud_score
     * original_order.gift
     * original_order.gift_certificate
     * original_order.internal
     * original_order.item
     * original_order.linked_shipment
     * original_order.marketing
     * original_order.payment
     * original_order.payment.transaction
     * original_order.quote
     * original_order.salesforce
     * original_order.shipping
     * original_order.summary
     * original_order.taxes
     * rebill_orders
     * rebill_orders.affiliate
     * rebill_orders.affiliate.ledger
     * rebill_orders.auto_order
     * rebill_orders.billing
     * rebill_orders.buysafe
     * rebill_orders.channel_partner
     * rebill_orders.checkout
     * rebill_orders.coupon
     * rebill_orders.customer_profile
     * rebill_orders.digital_order
     * rebill_orders.edi
     * rebill_orders.fraud_score
     * rebill_orders.gift
     * rebill_orders.gift_certificate
     * rebill_orders.internal
     * rebill_orders.item
     * rebill_orders.linked_shipment
     * rebill_orders.marketing
     * rebill_orders.payment
     * rebill_orders.payment.transaction
     * rebill_orders.quote
     * rebill_orders.salesforce
     * rebill_orders.shipping
     * rebill_orders.summary
     * rebill_orders.taxes*
     */
    public static void execute() {
        System.out.println("--- " + GetAutoOrdersBatch.class.getSimpleName() + " ---");

        try {
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);

            String expand =
                "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
            List<Integer> autoOrderOids = Arrays.asList(123456, 234567, 345678, 456789);

            AutoOrderQueryBatch batchRequest = new AutoOrderQueryBatch();
            batchRequest.setAutoOrderOids(autoOrderOids);

            AutoOrdersResponse apiResponse = autoOrderApi.getAutoOrdersBatch(batchRequest, expand);
            List<AutoOrder> autoOrders = apiResponse.getAutoOrders();

            // Display auto orders
            for (AutoOrder autoOrder : autoOrders) {
                System.out.println(autoOrder);
            }

            System.out.println("Retrieved " + autoOrders.size() + " auto orders");
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
}
import {autoOrderApi} from "../api.js";

/**
 * This example illustrates how to retrieve auto orders when you have a list of auto_order_oid.
 * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 *
 * Possible expansion values include:
 * - items
 * - items.future_schedules
 * - items.sample_schedule
 * - original_order
 * - original_order.affiliate
 * ... (full list of expansions from original comment)
 */
export class GetAutoOrdersBatch {
    /**
     * Executes batch retrieval of auto orders
     */
    static async execute() {
        console.log(`--- ${this.name} ---`);

        try {
            // Define expansion fields
            const expand =
                "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need

            // Define auto order OIDs (numbers)
            const autoOrderOids = [123456, 234567, 345678, 456789];

            // Create batch request
            const batchRequest = {
                auto_order_oids: autoOrderOids
            };

            // Retrieve auto orders
            const apiResponse = await new Promise((resolve, reject) => {
                autoOrderApi.getAutoOrdersBatch(batchRequest, {_expand: expand}, function (error, data, response) {
                    if (error) {
                        reject(error);
                    } else {
                        resolve(data, response);
                    }
                });
            });
            const autoOrders = apiResponse.auto_orders ?? [];

            // Display auto orders
            for (const autoOrder of autoOrders) {
                console.log(autoOrder);
            }

            console.log(`Retrieved ${autoOrders.length} auto orders`);
        } catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : String(ex)}`);
            console.error(ex instanceof Error ? ex.stack : 'No stack trace available');
        }
    }
}

// Optionally, if you need to call this
// GetAutoOrdersBatch.execute().catch(console.error);
<?php

set_time_limit(3000); // pull all records could take a long time.
ini_set('max_execution_time', 3000);
ini_set('display_errors', 1);

/*
 * This example illustrates how to retrieve auto orders when you have a list of auto_order_oid.
 */

use ultracart\v2\models\AutoOrderQueryBatch;

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();


/**
 * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 * items
 * items.future_schedules
 * items.sample_schedule
 * original_order
 * original_order.affiliate
 * original_order.affiliate.ledger
 * original_order.auto_order
 * original_order.billing
 * original_order.buysafe
 * original_order.channel_partner
 * original_order.checkout
 * original_order.coupon
 * original_order.customer_profile
 * original_order.digital_order
 * original_order.edi
 * original_order.fraud_score
 * original_order.gift
 * original_order.gift_certificate
 * original_order.internal
 * original_order.item
 * original_order.linked_shipment
 * original_order.marketing
 * original_order.payment
 * original_order.payment.transaction
 * original_order.quote
 * original_order.salesforce
 * original_order.shipping
 * original_order.summary
 * original_order.taxes
 * rebill_orders
 * rebill_orders.affiliate
 * rebill_orders.affiliate.ledger
 * rebill_orders.auto_order
 * rebill_orders.billing
 * rebill_orders.buysafe
 * rebill_orders.channel_partner
 * rebill_orders.checkout
 * rebill_orders.coupon
 * rebill_orders.customer_profile
 * rebill_orders.digital_order
 * rebill_orders.edi
 * rebill_orders.fraud_score
 * rebill_orders.gift
 * rebill_orders.gift_certificate
 * rebill_orders.internal
 * rebill_orders.item
 * rebill_orders.linked_shipment
 * rebill_orders.marketing
 * rebill_orders.payment
 * rebill_orders.payment.transaction
 * rebill_orders.quote
 * rebill_orders.salesforce
 * rebill_orders.shipping
 * rebill_orders.summary
 * rebill_orders.taxes
 */
$expand = "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
$auto_order_oids = [123456, 234567, 345678, 456789];
$batchRequest = new AutoOrderQueryBatch();
$batchRequest->setAutoOrderOids($auto_order_oids);
$api_response = $auto_order_api->getAutoOrdersBatch($batchRequest, $expand);
$auto_orders = $api_response->getAutoOrders();

// this will be verbose...
var_dump($auto_orders);

from ultracart.apis import AutoOrderApi
from ultracart.models import AutoOrderQueryBatch
from samples import api_client


# This example illustrates how to retrieve auto orders when you have a list of auto_order_oid.

def get_auto_orders_batch():
    auto_order_api = AutoOrderApi(api_client())

    # These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
    # and may become stale. Please review the master website when in doubt.
    # items
    # items.future_schedules
    # items.sample_schedule
    # original_order
    # original_order.affiliate
    # original_order.affiliate.ledger
    # original_order.auto_order
    # original_order.billing
    # original_order.buysafe
    # original_order.channel_partner
    # original_order.checkout
    # original_order.coupon
    # original_order.customer_profile
    # original_order.digital_order
    # original_order.edi
    # original_order.fraud_score
    # original_order.gift
    # original_order.gift_certificate
    # original_order.internal
    # original_order.item
    # original_order.linked_shipment
    # original_order.marketing
    # original_order.payment
    # original_order.payment.transaction
    # original_order.quote
    # original_order.salesforce
    # original_order.shipping
    # original_order.summary
    # original_order.taxes
    # rebill_orders
    # rebill_orders.affiliate
    # rebill_orders.affiliate.ledger
    # rebill_orders.auto_order
    # rebill_orders.billing
    # rebill_orders.buysafe
    # rebill_orders.channel_partner
    # rebill_orders.checkout
    # rebill_orders.coupon
    # rebill_orders.customer_profile
    # rebill_orders.digital_order
    # rebill_orders.edi
    # rebill_orders.fraud_score
    # rebill_orders.gift
    # rebill_orders.gift_certificate
    # rebill_orders.internal
    # rebill_orders.item
    # rebill_orders.linked_shipment
    # rebill_orders.marketing
    # rebill_orders.payment
    # rebill_orders.payment.transaction
    # rebill_orders.quote
    # rebill_orders.salesforce
    # rebill_orders.shipping
    # rebill_orders.summary
    # rebill_orders.taxes

    # contact us if you're unsure what you need
    expand = "items,items.future_schedules,original_order,rebill_orders"
    auto_order_oids = [123456, 234567, 345678, 456789]
    batch_request = AutoOrderQueryBatch()
    batch_request.auto_order_oids = auto_order_oids
    api_response = auto_order_api.get_auto_orders_batch(batch_request, expand=expand)
    auto_orders = api_response.auto_orders

    # this will be verbose...
    print(auto_orders)


if __name__ == "__main__":
    get_auto_orders_batch()
require 'ultracart_api'
require_relative '../constants'

# This example illustrates how to retrieve auto orders when you have a list of auto_order_oid.

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

# These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
# and may become stale. Please review the master website when in doubt.
# items
# items.future_schedules
# items.sample_schedule
# original_order
# original_order.affiliate
# original_order.affiliate.ledger
# original_order.auto_order
# original_order.billing
# original_order.buysafe
# original_order.channel_partner
# original_order.checkout
# original_order.coupon
# original_order.customer_profile
# original_order.digital_order
# original_order.edi
# original_order.fraud_score
# original_order.gift
# original_order.gift_certificate
# original_order.internal
# original_order.item
# original_order.linked_shipment
# original_order.marketing
# original_order.payment
# original_order.payment.transaction
# original_order.quote
# original_order.salesforce
# original_order.shipping
# original_order.summary
# original_order.taxes
# rebill_orders
# rebill_orders.affiliate
# rebill_orders.affiliate.ledger
# rebill_orders.auto_order
# rebill_orders.billing
# rebill_orders.buysafe
# rebill_orders.channel_partner
# rebill_orders.checkout
# rebill_orders.coupon
# rebill_orders.customer_profile
# rebill_orders.digital_order
# rebill_orders.edi
# rebill_orders.fraud_score
# rebill_orders.gift
# rebill_orders.gift_certificate
# rebill_orders.internal
# rebill_orders.item
# rebill_orders.linked_shipment
# rebill_orders.marketing
# rebill_orders.payment
# rebill_orders.payment.transaction
# rebill_orders.quote
# rebill_orders.salesforce
# rebill_orders.shipping
# rebill_orders.summary
# rebill_orders.taxes

expand = "items,items.future_schedules,original_order,rebill_orders" # contact us if you're unsure what you need
auto_order_oids = [123456, 234567, 345678, 456789]
batch_request = UltracartClient::AutoOrderQueryBatch.new
batch_request.auto_order_oids = auto_order_oids
api_response = auto_order_api.get_auto_orders_batch(batch_request, { '_expand' => expand })
auto_orders = api_response.auto_orders

# this will be verbose...
puts auto_orders.inspect
import { autoOrderApi } from "../api";
import { AutoOrder, AutoOrderQueryBatch } from 'ultracart_rest_api_v2_typescript';

/**
 * This example illustrates how to retrieve auto orders when you have a list of auto_order_oid.
 * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 *
 * Possible expansion values include:
 * - items
 * - items.future_schedules
 * - items.sample_schedule
 * - original_order
 * - original_order.affiliate
 * ... (full list of expansions from original comment)
 */
export class GetAutoOrdersBatch {
    /**
     * Executes batch retrieval of auto orders
     */
    public static async execute(): Promise<void> {
        console.log(`--- ${this.name} ---`);

        try {
            // Define expansion fields
            const expand =
                "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need

            // Define auto order OIDs (numbers)
            const autoOrderOids: number[] = [123456, 234567, 345678, 456789];

            // Create batch request
            const batchRequest: AutoOrderQueryBatch = {
                auto_order_oids: autoOrderOids
            };

            // Retrieve auto orders
            const apiResponse = await autoOrderApi.getAutoOrdersBatch({autoOrderBatch: batchRequest, expand});
            const autoOrders: AutoOrder[] = apiResponse.auto_orders ?? [];

            // Display auto orders
            for (const autoOrder of autoOrders) {
                console.log(autoOrder);
            }

            console.log(`Retrieved ${autoOrders.length} auto orders`);
        }
        catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : String(ex)}`);
            console.error(ex instanceof Error ? ex.stack : 'No stack trace available');
        }
    }
}

// Optionally, if you need to call this
// GetAutoOrdersBatch.execute().catch(console.error);

Update multiple auto orders

Permissions:
  • auto_order_write

Consumes: application/json
Produces: application/json
put
/auto_order/auto_orders/batch

Update multiple auto orders on the UltraCart account.

SDK Function Name: updateAutoOrdersBatch

Parameters
Parameter Description Location Data Type Required
auto_orders_request Auto orders to update (synchronous maximum 20 / asynchronous maximum 100) body AutoOrdersRequest required
_expand The object expansion to perform on the result. See documentation for examples query string optional
_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. query boolean optional
_async True if the operation should be run async. No result returned query boolean optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrdersResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Collections.Generic;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class UpdateAutoOrdersBatch
    {
        /*
         *
         * This method allows for updating multiple auto orders.
         * Warning: Take great care editing auto orders.  They are complex.
         * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
         * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
         * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
         *
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");
            
            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);
                
                // The _async parameter is what it seems.  True if async.
                // The max records allowed depends on the async flag.  Synch max is 20, Asynch max is 100.
                
                bool async = true; // if true, success returns back a 204 No Content. False returns back the updated orders.
                string expand = null; // since we're async, nothing is returned, so we don't care about expansions.
                // If you are doing a synchronous operation, then set your expand appropriately. set getAutoOrders()
                // sample for expansion samples.
                bool placeholders = false; // mostly used for UI, not needed for a pure scripting operation.
                
                List<AutoOrder> autoOrders = new List<AutoOrder>(); // TODO: This should be a list of auto orders that have been updated. See any getAutoOrders method for retrieval.
                AutoOrdersRequest autoOrdersRequest = new AutoOrdersRequest();
                autoOrdersRequest.AutoOrders = autoOrders;
                
                var apiResponse = autoOrderApi.UpdateAutoOrdersBatch(autoOrdersRequest, expand, placeholders, async);
                if (apiResponse != null)
                {
                    // something went wrong if we have a response.
                    Console.WriteLine(apiResponse);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.AutoOrder;
import com.ultracart.admin.v2.models.AutoOrdersRequest;
import com.ultracart.admin.v2.models.AutoOrdersResponse;
import common.Constants;

import java.util.ArrayList;
import java.util.List;

public class UpdateAutoOrdersBatch {
    /**
     *
     * This method allows for updating multiple auto orders.
     * Warning: Take great care editing auto orders.  They are complex.
     * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
     * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
     * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
     *
     */
    public static void execute() {
        System.out.println("--- " + UpdateAutoOrdersBatch.class.getSimpleName() + " ---");
        
        try {
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);
            
            // The _async parameter is what it seems.  True if async.
            // The max records allowed depends on the async flag.  Synch max is 20, Asynch max is 100.
            
            boolean async = true; // if true, success returns back a 204 No Content. False returns back the updated orders.
            String expand = null; // since we're async, nothing is returned, so we don't care about expansions.
            // If you are doing a synchronous operation, then set your expand appropriately. set getAutoOrders()
            // sample for expansion samples.
            boolean placeholders = false; // mostly used for UI, not needed for a pure scripting operation.
            
            List<AutoOrder> autoOrders = new ArrayList<AutoOrder>(); // TODO: This should be a list of auto orders that have been updated. See any getAutoOrders method for retrieval.
            AutoOrdersRequest autoOrdersRequest = new AutoOrdersRequest();
            autoOrdersRequest.setAutoOrders(autoOrders);
            
            AutoOrdersResponse apiResponse = autoOrderApi.updateAutoOrdersBatch(autoOrdersRequest, expand, placeholders, async);
            if (apiResponse != null) {
                // something went wrong if we have a response.
                System.out.println(apiResponse);
            }
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
}
import { autoOrderApi } from '../api.js';

export class UpdateAutoOrdersBatch {
    /*
     *
     * This method allows for updating multiple auto orders.
     * Warning: Take great care editing auto orders.  They are complex.
     * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
     * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
     * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
     *
     */
    static async execute() {
        console.log(`--- ${this.name} ---`);

        try {
            // Create auto order API instance using API key

            // The _async parameter is what it seems.  True if async.
            // The max records allowed depends on the async flag.  Synch max is 20, Asynch max is 100.

            const async = true; // if true, success returns back a 204 No Content. False returns back the updated orders.
            const expand = undefined; // since we're async, nothing is returned, so we don't care about expansions.
            // If you are doing a synchronous operation, then set your expand appropriately. set getAutoOrders()
            // sample for expansion samples.
            const placeholders = false; // mostly used for UI, not needed for a pure scripting operation.

            const autoOrders = []; // TODO: This should be a list of auto orders that have been updated. See any getAutoOrders method for retrieval.
            const autoOrdersRequest = {
                autoOrders
            };

            const apiResponse = await new Promise((resolve, reject) => {
                autoOrderApi.updateAutoOrdersBatch(
                    autoOrdersRequest, {_expand: expand, _placeholders: placeholders, _async: async },
                    function (error, data, response) {
                        if (error) {
                            reject(error);
                        } else {
                            resolve(data, response);
                        }
                    }
                );
            });

            if (apiResponse) {
                // something went wrong if we have a response.
                console.log(apiResponse);
            }
        } catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : 'Unknown error'}`);
            console.error(ex instanceof Error ? ex.stack : ex);
        }
    }
}

// Example of how to call the method
// UpdateAutoOrdersBatch.execute().catch(console.error);

<?php

use ultracart\v2\models\AutoOrdersRequest;

ini_set('display_errors', 1);

/*
 *
 * This method allows for updating multiple auto orders.
 * Warning: Take great care editing auto orders.  They are complex.
 * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
 * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
 * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
 *
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

// The _async parameter is what it seems.  True if async.
// The max records allowed depends on the async flag.  Synch max is 20, Asynch max is 100.

$_async = true; // if true, success returns back a 204 No Content.  False returns back the updated orders.
$_expand = null;  // since we're async, nothing is returned, so we don't care about expansions.
// If you are doing a synchronous operation, then set your $_expand appropriately.  set getAutoOrders()
// sample for expansion samples.
$_placeholders = false; // mostly used for UI, not needed for a pure scripting operation.

$auto_orders = [];  // TODO: This should be an array of auto orders that have been updated.  See any getAutoOrders method for retrieval.
$autoOrdersRequest = new AutoOrdersRequest();
$api_response = $autoOrdersRequest->setAutoOrders($auto_orders);

$auto_order_api->updateAutoOrdersBatch($autoOrdersRequest, $_expand, $_placeholders, $_async);
if(!is_null($api_response)){
    // something went wrong if we have a response.
    var_dump($api_response);
}


from ultracart.apis import AutoOrderApi
from ultracart.models import AutoOrdersRequest
from samples import api_client

"""
This script demonstrates updating multiple auto orders in a batch.
Warning: Take great care editing auto orders. They are complex.
Sometimes you must change the original_order to affect the auto_order. If you have questions about what fields
to update to achieve your desired change, contact UltraCart support. Better to ask and get it right than to
make a bad assumption and corrupt a thousand auto orders. UltraCart support is ready to assist.
"""

# Initialize the API client
auto_order_api = AutoOrderApi(api_client())

# The async parameter is what it seems. True if async.
# The max records allowed depends on the async flag. Sync max is 20, Async max is 100.
async_flag = True  # if true, success returns back a 204 No Content. False returns back the updated orders.

# Since we're async, nothing is returned, so we don't care about expansions.
# If you are doing a synchronous operation, then set your expand appropriately.
# See getAutoOrders() sample for expansion samples.
expand = None

# Mostly used for UI, not needed for a pure scripting operation
placeholders = False

# TODO: This should be an array of auto orders that have been updated.
# See any getAutoOrders method for retrieval.
auto_orders = []

# Create the request object and set the auto orders
auto_orders_request = AutoOrdersRequest()
auto_orders_request.auto_orders = auto_orders

# Perform the batch update
api_response = auto_order_api.update_auto_orders_batch(auto_orders_request, expand=expand, placeholders=placeholders,
                                                       async_flag=async_flag)

if api_response is not None:
    # Something went wrong if we have a response
    print(api_response)

require 'ultracart_api'
require_relative '../constants'

# This method allows for updating multiple auto orders.
# Warning: Take great care editing auto orders.  They are complex.
# Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
# to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
# make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

# The _async parameter is what it seems.  True if async.
# The max records allowed depends on the async flag.  Synch max is 20, Asynch max is 100.

# if true, success returns back a 204 No Content.  False returns back the updated orders.
async = true

# since we're async, nothing is returned, so we don't care about expansions.
# If you are doing a synchronous operation, then set your expand appropriately.  set get_auto_orders
# sample for expansion samples.
expand = nil

# mostly used for UI, not needed for a pure scripting operation.
placeholders = false

# TODO: This should be an array of auto orders that have been updated.  See any get_auto_orders method for retrieval.
auto_orders = []

auto_orders_request = UltracartClient::AutoOrdersRequest.new
auto_orders_request.auto_orders = auto_orders

opts = {
  _expand: expand,
  _placeholders: placeholders,
  _async: async
}

api_response = auto_order_api.update_auto_orders_batch(auto_orders_request, opts)

# something went wrong if we have a response.
puts api_response.inspect unless api_response.nil?
import {autoOrderApi} from '../api';
import {
    AutoOrder,
    AutoOrdersRequest
} from 'ultracart_rest_api_v2_typescript';

export class UpdateAutoOrdersBatch {
    /*
     *
     * This method allows for updating multiple auto orders.
     * Warning: Take great care editing auto orders.  They are complex.
     * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
     * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
     * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
     *
     */
    public static async execute(): Promise<void> {
        console.log(`--- ${this.name} ---`);

        try {
            // Create auto order API instance using API key

            // The _async parameter is what it seems.  True if async.
            // The max records allowed depends on the async flag.  Synch max is 20, Asynch max is 100.

            const async = true; // if true, success returns back a 204 No Content. False returns back the updated orders.
            const expand = undefined; // since we're async, nothing is returned, so we don't care about expansions.
            // If you are doing a synchronous operation, then set your expand appropriately. set getAutoOrders()
            // sample for expansion samples.
            const placeholders = false; // mostly used for UI, not needed for a pure scripting operation.

            const autoOrders: AutoOrder[] = []; // TODO: This should be a list of auto orders that have been updated. See any getAutoOrders method for retrieval.
            const autoOrdersRequest: AutoOrdersRequest = {
                autoOrders
            };

            const apiResponse = await autoOrderApi.updateAutoOrdersBatch({
                autoOrdersRequest,
                expand,
                placeholders,
                async
            });

            if (apiResponse) {
                // something went wrong if we have a response.
                console.log(apiResponse);
            }
        } catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : 'Unknown error'}`);
            console.error(ex instanceof Error ? ex.stack : ex);
        }
    }
}

// Example of how to call the method
// UpdateAutoOrdersBatch.execute().catch(console.error);

Retrieve an auto order by code

Permissions:
  • auto_order_read

Produces: application/json
get
/auto_order/auto_orders/code/{auto_order_code}

Retrieves a single auto order using the specified reference (original) order id.

SDK Function Name: getAutoOrderByCode

Parameters
Parameter Description Location Data Type Required
auto_order_code The auto order oid to retrieve. path string required
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrderResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class GetAutoOrderByCode
    {
        /*
         * This example illustrates how to query an auto order when you know the 'code'.  Each AutoOrder has a unique
         * identifier used by UltraCart called an OID (Object Identifier).  AutoOrders also have a unique code which
         * is (arguably) an easy way for customers to discuss a specific auto order with a merchant.
         * The codes look like this: "RT2A9CBSX9"
         *
         * It is doubtful that an UltraCart merchant will ever make use of this method.
         *
         * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
         * and may become stale. Please review the master website when in doubt.
         * items
         * items.future_schedules
         * items.sample_schedule
         * original_order
         * original_order.affiliate
         * original_order.affiliate.ledger
         * original_order.auto_order
         * original_order.billing
         * original_order.buysafe
         * original_order.channel_partner
         * original_order.checkout
         * original_order.coupon
         * original_order.customer_profile
         * original_order.digital_order
         * original_order.edi
         * original_order.fraud_score
         * original_order.gift
         * original_order.gift_certificate
         * original_order.internal
         * original_order.item
         * original_order.linked_shipment
         * original_order.marketing
         * original_order.payment
         * original_order.payment.transaction
         * original_order.quote
         * original_order.salesforce
         * original_order.shipping
         * original_order.summary
         * original_order.taxes
         * rebill_orders
         * rebill_orders.affiliate
         * rebill_orders.affiliate.ledger
         * rebill_orders.auto_order
         * rebill_orders.billing
         * rebill_orders.buysafe
         * rebill_orders.channel_partner
         * rebill_orders.checkout
         * rebill_orders.coupon
         * rebill_orders.customer_profile
         * rebill_orders.digital_order
         * rebill_orders.edi
         * rebill_orders.fraud_score
         * rebill_orders.gift
         * rebill_orders.gift_certificate
         * rebill_orders.internal
         * rebill_orders.item
         * rebill_orders.linked_shipment
         * rebill_orders.marketing
         * rebill_orders.payment
         * rebill_orders.payment.transaction
         * rebill_orders.quote
         * rebill_orders.salesforce
         * rebill_orders.shipping
         * rebill_orders.summary
         * rebill_orders.taxes
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");
            
            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);
                
                string expand = "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
                string code = "RT2A9CBSX9";
                var apiResponse = autoOrderApi.GetAutoOrderByCode(code, expand);
                AutoOrder autoOrder = apiResponse.AutoOrder;
                
                // this will be verbose...
                Console.WriteLine(autoOrder);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.*;
import common.Constants;

public class GetAutoOrderByCode {
    /**
     * This example illustrates how to query an auto order when you know the 'code'.  Each AutoOrder has a unique
     * identifier used by UltraCart called an OID (Object Identifier).  AutoOrders also have a unique code which
     * is (arguably) an easy way for customers to discuss a specific auto order with a merchant.
     * The codes look like this: "RT2A9CBSX9"
     *
     * It is doubtful that an UltraCart merchant will ever make use of this method.
     *
     * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
     * and may become stale. Please review the master website when in doubt.
     * items
     * items.future_schedules
     * items.sample_schedule
     * original_order
     * original_order.affiliate
     * original_order.affiliate.ledger
     * original_order.auto_order
     * original_order.billing
     * original_order.buysafe
     * original_order.channel_partner
     * original_order.checkout
     * original_order.coupon
     * original_order.customer_profile
     * original_order.digital_order
     * original_order.edi
     * original_order.fraud_score
     * original_order.gift
     * original_order.gift_certificate
     * original_order.internal
     * original_order.item
     * original_order.linked_shipment
     * original_order.marketing
     * original_order.payment
     * original_order.payment.transaction
     * original_order.quote
     * original_order.salesforce
     * original_order.shipping
     * original_order.summary
     * original_order.taxes
     * rebill_orders
     * rebill_orders.affiliate
     * rebill_orders.affiliate.ledger
     * rebill_orders.auto_order
     * rebill_orders.billing
     * rebill_orders.buysafe
     * rebill_orders.channel_partner
     * rebill_orders.checkout
     * rebill_orders.coupon
     * rebill_orders.customer_profile
     * rebill_orders.digital_order
     * rebill_orders.edi
     * rebill_orders.fraud_score
     * rebill_orders.gift
     * rebill_orders.gift_certificate
     * rebill_orders.internal
     * rebill_orders.item
     * rebill_orders.linked_shipment
     * rebill_orders.marketing
     * rebill_orders.payment
     * rebill_orders.payment.transaction
     * rebill_orders.quote
     * rebill_orders.salesforce
     * rebill_orders.shipping
     * rebill_orders.summary
     * rebill_orders.taxes
     */
    public static void execute() {
        System.out.println("--- " + GetAutoOrderByCode.class.getSimpleName() + " ---");
        
        try {
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);
            
            String expand = "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
            String code = "RT2A9CBSX9";
            AutoOrderResponse apiResponse = autoOrderApi.getAutoOrderByCode(code, expand);
            AutoOrder autoOrder = apiResponse.getAutoOrder();
            
            // this will be verbose...
            System.out.println(autoOrder);
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
}
import {autoOrderApi} from "../api.js";

/**
 * This example illustrates how to query an auto order when you know the 'code'. Each AutoOrder has a unique
 * identifier used by UltraCart called an OID (Object Identifier). AutoOrders also have a unique code which
 * is (arguably) an easy way for customers to discuss a specific auto order with a merchant.
 * The codes look like this: "RT2A9CBSX9"
 *
 * It is doubtful that an UltraCart merchant will ever make use of this method.
 *
 * IMPORTANT: The following is a comprehensive list of possible expansion values for auto orders.
 * This list is taken from www.ultracart.com/api/ and may become stale.
 * Please review the master website when in doubt.
 *
 * Expansion values include (but are not limited to):
 * - items
 * - items.future_schedules
 * - items.sample_schedule
 * - original_order
 * - original_order.affiliate
 * - original_order.affiliate.ledger
 * ... (full list of expansions)
 * - rebill_orders.taxes
 */
export async function getAutoOrderByCode() {
    console.log(`--- ${getAutoOrderByCode.name} ---`);

    try {
        // Contact UltraCart if you're unsure what expansions you need
        const expand = 'items,items.future_schedules,original_order,rebill_orders';

        const code = 'RT2A9CBSX9';
        const apiResponse = await new Promise((resolve, reject) => {
            autoOrderApi.getAutoOrderByCode(code, {_expand: expand}, function (error, data, response) {
                if (error) {
                    reject(error);
                } else {
                    resolve(data, response);
                }
            });
        });
        const autoOrder = apiResponse.auto_order;

        // This will be verbose...
        console.log(autoOrder);
    } catch (error) {
        // Error handling
        console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
        console.error(error instanceof Error ? error.stack : error);
    }
}

// Optional: If you want to call the function
// getAutoOrderByCode().catch(console.error);
<?php

ini_set('display_errors', 1);

/*
 * This example illustrates how to query an auto order when you know the 'code'.  Each AutoOrder has a unique
 * identifier used by UltraCart called an OID (Object Identifier).  AutoOrders also have a unique code which
 * is (arguably) an easy way for customers to discuss a specific auto order with a merchant.
 * The codes look like this: "RT2A9CBSX9"
 *
 * It is doubtful that an UltraCart merchant will ever make use of this method.
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

/**
 * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 * items
 * items.future_schedules
 * items.sample_schedule
 * original_order
 * original_order.affiliate
 * original_order.affiliate.ledger
 * original_order.auto_order
 * original_order.billing
 * original_order.buysafe
 * original_order.channel_partner
 * original_order.checkout
 * original_order.coupon
 * original_order.customer_profile
 * original_order.digital_order
 * original_order.edi
 * original_order.fraud_score
 * original_order.gift
 * original_order.gift_certificate
 * original_order.internal
 * original_order.item
 * original_order.linked_shipment
 * original_order.marketing
 * original_order.payment
 * original_order.payment.transaction
 * original_order.quote
 * original_order.salesforce
 * original_order.shipping
 * original_order.summary
 * original_order.taxes
 * rebill_orders
 * rebill_orders.affiliate
 * rebill_orders.affiliate.ledger
 * rebill_orders.auto_order
 * rebill_orders.billing
 * rebill_orders.buysafe
 * rebill_orders.channel_partner
 * rebill_orders.checkout
 * rebill_orders.coupon
 * rebill_orders.customer_profile
 * rebill_orders.digital_order
 * rebill_orders.edi
 * rebill_orders.fraud_score
 * rebill_orders.gift
 * rebill_orders.gift_certificate
 * rebill_orders.internal
 * rebill_orders.item
 * rebill_orders.linked_shipment
 * rebill_orders.marketing
 * rebill_orders.payment
 * rebill_orders.payment.transaction
 * rebill_orders.quote
 * rebill_orders.salesforce
 * rebill_orders.shipping
 * rebill_orders.summary
 * rebill_orders.taxes
 */
$expand = "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
$code = "RT2A9CBSX9";
$api_response = $auto_order_api->getAutoOrderByCode($code, $expand);
$auto_order = $api_response->getAutoOrder();

// this will be verbose...
var_dump($auto_order);

from ultracart.apis import AutoOrderApi
from samples import api_client


# This example illustrates how to query an auto order when you know the 'code'.  Each AutoOrder has a unique
# identifier used by UltraCart called an OID (Object Identifier).  AutoOrders also have a unique code which
# is (arguably) an easy way for customers to discuss a specific auto order with a merchant.
# The codes look like this: "RT2A9CBSX9"
#
# It is doubtful that an UltraCart merchant will ever make use of this method.

def get_auto_order_by_code():
    auto_order_api = AutoOrderApi(api_client())

    # These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
    # and may become stale. Please review the master website when in doubt.
    # items
    # items.future_schedules
    # items.sample_schedule
    # original_order
    # original_order.affiliate
    # original_order.affiliate.ledger
    # original_order.auto_order
    # original_order.billing
    # original_order.buysafe
    # original_order.channel_partner
    # original_order.checkout
    # original_order.coupon
    # original_order.customer_profile
    # original_order.digital_order
    # original_order.edi
    # original_order.fraud_score
    # original_order.gift
    # original_order.gift_certificate
    # original_order.internal
    # original_order.item
    # original_order.linked_shipment
    # original_order.marketing
    # original_order.payment
    # original_order.payment.transaction
    # original_order.quote
    # original_order.salesforce
    # original_order.shipping
    # original_order.summary
    # original_order.taxes
    # rebill_orders
    # rebill_orders.affiliate
    # rebill_orders.affiliate.ledger
    # rebill_orders.auto_order
    # rebill_orders.billing
    # rebill_orders.buysafe
    # rebill_orders.channel_partner
    # rebill_orders.checkout
    # rebill_orders.coupon
    # rebill_orders.customer_profile
    # rebill_orders.digital_order
    # rebill_orders.edi
    # rebill_orders.fraud_score
    # rebill_orders.gift
    # rebill_orders.gift_certificate
    # rebill_orders.internal
    # rebill_orders.item
    # rebill_orders.linked_shipment
    # rebill_orders.marketing
    # rebill_orders.payment
    # rebill_orders.payment.transaction
    # rebill_orders.quote
    # rebill_orders.salesforce
    # rebill_orders.shipping
    # rebill_orders.summary
    # rebill_orders.taxes

    # contact us if you're unsure what you need
    expand = "items,items.future_schedules,original_order,rebill_orders"
    code = "RT2A9CBSX9"
    api_response = auto_order_api.get_auto_order_by_code(code, expand=expand)
    auto_order = api_response.auto_order

    # this will be verbose...
    print(auto_order)


if __name__ == "__main__":
    get_auto_order_by_code()
require 'ultracart_api'
require_relative '../constants'

# This example illustrates how to query an auto order when you know the 'code'.  Each AutoOrder has a unique
# identifier used by UltraCart called an OID (Object Identifier).  AutoOrders also have a unique code which
# is (arguably) an easy way for customers to discuss a specific auto order with a merchant.
# The codes look like this: "RT2A9CBSX9"
#
# It is doubtful that an UltraCart merchant will ever make use of this method.

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

# These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
# and may become stale. Please review the master website when in doubt.
# items
# items.future_schedules
# items.sample_schedule
# original_order
# original_order.affiliate
# original_order.affiliate.ledger
# original_order.auto_order
# original_order.billing
# original_order.buysafe
# original_order.channel_partner
# original_order.checkout
# original_order.coupon
# original_order.customer_profile
# original_order.digital_order
# original_order.edi
# original_order.fraud_score
# original_order.gift
# original_order.gift_certificate
# original_order.internal
# original_order.item
# original_order.linked_shipment
# original_order.marketing
# original_order.payment
# original_order.payment.transaction
# original_order.quote
# original_order.salesforce
# original_order.shipping
# original_order.summary
# original_order.taxes
# rebill_orders
# rebill_orders.affiliate
# rebill_orders.affiliate.ledger
# rebill_orders.auto_order
# rebill_orders.billing
# rebill_orders.buysafe
# rebill_orders.channel_partner
# rebill_orders.checkout
# rebill_orders.coupon
# rebill_orders.customer_profile
# rebill_orders.digital_order
# rebill_orders.edi
# rebill_orders.fraud_score
# rebill_orders.gift
# rebill_orders.gift_certificate
# rebill_orders.internal
# rebill_orders.item
# rebill_orders.linked_shipment
# rebill_orders.marketing
# rebill_orders.payment
# rebill_orders.payment.transaction
# rebill_orders.quote
# rebill_orders.salesforce
# rebill_orders.shipping
# rebill_orders.summary
# rebill_orders.taxes

expand = "items,items.future_schedules,original_order,rebill_orders" # contact us if you're unsure what you need
code = "RT2A9CBSX9"
api_response = auto_order_api.get_auto_order_by_code(code, { '_expand' => expand })
auto_order = api_response.auto_order

# this will be verbose...
puts auto_order.inspect
import { autoOrderApi } from "../api";
import { AutoOrder } from 'ultracart_rest_api_v2_typescript';

/**
 * This example illustrates how to query an auto order when you know the 'code'. Each AutoOrder has a unique
 * identifier used by UltraCart called an OID (Object Identifier). AutoOrders also have a unique code which
 * is (arguably) an easy way for customers to discuss a specific auto order with a merchant.
 * The codes look like this: "RT2A9CBSX9"
 *
 * It is doubtful that an UltraCart merchant will ever make use of this method.
 *
 * IMPORTANT: The following is a comprehensive list of possible expansion values for auto orders.
 * This list is taken from www.ultracart.com/api/ and may become stale.
 * Please review the master website when in doubt.
 *
 * Expansion values include (but are not limited to):
 * - items
 * - items.future_schedules
 * - items.sample_schedule
 * - original_order
 * - original_order.affiliate
 * - original_order.affiliate.ledger
 * ... (full list of expansions)
 * - rebill_orders.taxes
 */
export async function getAutoOrderByCode(): Promise<void> {
  console.log(`--- ${getAutoOrderByCode.name} ---`);

  try {
    // Contact UltraCart if you're unsure what expansions you need
    const expand = 'items,items.future_schedules,original_order,rebill_orders';

    const code = 'RT2A9CBSX9';
    const apiResponse = await autoOrderApi.getAutoOrderByCode({autoOrderCode: code, expand});
    const autoOrder: AutoOrder|undefined = apiResponse.auto_order;

    // This will be verbose...
    console.log(autoOrder);
  } catch (error) {
    // Error handling
    console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
    console.error(error instanceof Error ? error.stack : error);
  }
}

// Optional: If you want to call the function
// getAutoOrderByCode().catch(console.error);

Retrieve auto orders by query

Permissions:
  • order_read

Produces: application/json
post
/auto_order/auto_orders/query

Retrieves a group of auto orders from the account based on a query object. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.

SDK Function Name: getAutoOrdersByQuery

Parameters
Parameter Description Location Data Type Required
auto_order_query Auto order query body AutoOrderQuery required
_limit The maximum number of records to return on this one API call. (Maximum 200)
Default: 100
query integer optional
_offset Pagination of the record set. Offset is a zero based index.
Default: 0
query integer optional
_sort The sort order of the auto orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
Allowed Values
  • auto_order_code
  • order_id
  • shipping.company
  • shipping.first_name
  • shipping.last_name
  • shipping.city
  • shipping.state_region
  • shipping.postal_code
  • shipping.country_code
  • billing.phone
  • billing.email
  • billing.cc_email
  • billing.company
  • billing.first_name
  • billing.last_name
  • billing.city
  • billing.state
  • billing.postal_code
  • billing.country_code
  • creation_dts
  • payment.payment_dts
  • checkout.screen_branding_theme_code
  • next_shipment_dts
query string optional
_expand The object expansion to perform on the result. query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrdersResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Collections.Generic;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class GetAutoOrdersByQuery
    {
        /*
         * This example illustrates how to retrieve auto orders and handle pagination.
         *
             * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
             * and may become stale. Please review the master website when in doubt.
            items
            items.future_schedules
            items.sample_schedule
            original_order
            original_order.affiliate
            original_order.affiliate.ledger
            original_order.auto_order
            original_order.billing
            original_order.buysafe
            original_order.channel_partner
            original_order.checkout
            original_order.coupon
            original_order.customer_profile
            original_order.digital_order
            original_order.edi
            original_order.fraud_score
            original_order.gift
            original_order.gift_certificate
            original_order.internal
            original_order.item
            original_order.linked_shipment
            original_order.marketing
            original_order.payment
            original_order.payment.transaction
            original_order.quote
            original_order.salesforce
            original_order.shipping
            original_order.summary
            original_order.taxes
            rebill_orders
            rebill_orders.affiliate
            rebill_orders.affiliate.ledger
            rebill_orders.auto_order
            rebill_orders.billing
            rebill_orders.buysafe
            rebill_orders.channel_partner
            rebill_orders.checkout
            rebill_orders.coupon
            rebill_orders.customer_profile
            rebill_orders.digital_order
            rebill_orders.edi
            rebill_orders.fraud_score
            rebill_orders.gift
            rebill_orders.gift_certificate
            rebill_orders.internal
            rebill_orders.item
            rebill_orders.linked_shipment
            rebill_orders.marketing
            rebill_orders.payment
            rebill_orders.payment.transaction
            rebill_orders.quote
            rebill_orders.salesforce
            rebill_orders.shipping
            rebill_orders.summary
            rebill_orders.taxes
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");

            try
            {
                List<AutoOrder> autoOrders = new List<AutoOrder>();

                int iteration = 1;
                int offset = 0;
                int limit = 200;
                bool moreRecordsToFetch = true;

                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);

                while (moreRecordsToFetch)
                {
                    Console.WriteLine($"executing iteration {iteration}");

                    List<AutoOrder> chunkOfOrders = GetAutoOrderChunk(autoOrderApi, offset, limit);
                    autoOrders.AddRange(chunkOfOrders);
                    offset = offset + limit;
                    moreRecordsToFetch = chunkOfOrders.Count == limit;
                    iteration++;
                }

                // Display auto orders
                foreach (var autoOrder in autoOrders)
                {
                    Console.WriteLine(autoOrder);
                }

                Console.WriteLine($"Retrieved {autoOrders.Count} auto orders");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"ApiException occurred on iteration");
                Console.WriteLine(ex);
                Environment.Exit(1);
            }
        }

        /// <summary>
        /// Returns a chunk of auto orders based on query parameters
        /// </summary>
        /// <param name="autoOrderApi">The auto order API instance</param>
        /// <param name="offset">Pagination offset</param>
        /// <param name="limit">Maximum number of records to return</param>
        /// <returns>List of matching auto orders</returns>
        public static List<AutoOrder> GetAutoOrderChunk(AutoOrderApi autoOrderApi, int offset, int limit)
        {
            string expand =
                "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need

            /*
             * These are the supported sorting fields:
            auto_order_code
            order_id
            shipping.company
            shipping.first_name
            shipping.last_name
            shipping.city
            shipping.state_region
            shipping.postal_code
            shipping.country_code
            billing.phone
            billing.email
            billing.cc_email
            billing.company
            billing.first_name
            billing.last_name
            billing.city
            billing.state
            billing.postal_code
            billing.country_code
            creation_dts
            payment.payment_dts
            checkout.screen_branding_theme_code
            next_shipment_dts
             */
            
            string sort = "next_shipment_dts";
            AutoOrderQuery query = new AutoOrderQuery();
            query.Email = "support@ultracart.com";
            var apiResponse = autoOrderApi.GetAutoOrdersByQuery(query, limit, offset, sort, expand);

            if (apiResponse.AutoOrders != null)
            {
                return apiResponse.AutoOrders;
            }

            return new List<AutoOrder>();
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.AutoOrder;
import com.ultracart.admin.v2.models.AutoOrderQuery;
import com.ultracart.admin.v2.models.AutoOrdersResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;

import java.util.ArrayList;
import java.util.List;

public class GetAutoOrdersByQuery {
  /**
   * This example illustrates how to retrieve auto orders and handle pagination.
   * <p>
   * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
   * and may become stale. Please review the master website when in doubt.
   * items
   * items.future_schedules
   * items.sample_schedule
   * original_order
   * original_order.affiliate
   * original_order.affiliate.ledger
   * original_order.auto_order
   * original_order.billing
   * original_order.buysafe
   * original_order.channel_partner
   * original_order.checkout
   * original_order.coupon
   * original_order.customer_profile
   * original_order.digital_order
   * original_order.edi
   * original_order.fraud_score
   * original_order.gift
   * original_order.gift_certificate
   * original_order.internal
   * original_order.item
   * original_order.linked_shipment
   * original_order.marketing
   * original_order.payment
   * original_order.payment.transaction
   * original_order.quote
   * original_order.salesforce
   * original_order.shipping
   * original_order.summary
   * original_order.taxes
   * rebill_orders
   * rebill_orders.affiliate
   * rebill_orders.affiliate.ledger
   * rebill_orders.auto_order
   * rebill_orders.billing
   * rebill_orders.buysafe
   * rebill_orders.channel_partner
   * rebill_orders.checkout
   * rebill_orders.coupon
   * rebill_orders.customer_profile
   * rebill_orders.digital_order
   * rebill_orders.edi
   * rebill_orders.fraud_score
   * rebill_orders.gift
   * rebill_orders.gift_certificate
   * rebill_orders.internal
   * rebill_orders.item
   * rebill_orders.linked_shipment
   * rebill_orders.marketing
   * rebill_orders.payment
   * rebill_orders.payment.transaction
   * rebill_orders.quote
   * rebill_orders.salesforce
   * rebill_orders.shipping
   * rebill_orders.summary
   * rebill_orders.taxes
   */
  public static void execute() {
    System.out.println("--- " + GetAutoOrdersByQuery.class.getSimpleName() + " ---");

    try {
      List<AutoOrder> autoOrders = new ArrayList<AutoOrder>();

      int iteration = 1;
      int offset = 0;
      int limit = 200;
      boolean moreRecordsToFetch = true;

      // Create auto order API instance using API key
      AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);

      while (moreRecordsToFetch) {
        System.out.println("executing iteration " + iteration);

        List<AutoOrder> chunkOfOrders = getAutoOrderChunk(autoOrderApi, offset, limit);
        autoOrders.addAll(chunkOfOrders);
        offset = offset + limit;
        moreRecordsToFetch = chunkOfOrders.size() == limit;
        iteration++;
      }

      // Display auto orders
      for (AutoOrder autoOrder : autoOrders) {
        System.out.println(autoOrder);
      }

      System.out.println("Retrieved " + autoOrders.size() + " auto orders");
    } catch (Exception ex) {
      System.out.println("ApiException occurred on iteration");
      System.out.println(ex);
      System.exit(1);
    }
  }

  /**
   * Returns a chunk of auto orders based on query parameters
   *
   * @param autoOrderApi The auto order API instance
   * @param offset       Pagination offset
   * @param limit        Maximum number of records to return
   * @return List of matching auto orders
   */
  public static List<AutoOrder> getAutoOrderChunk(AutoOrderApi autoOrderApi, int offset, int limit) throws ApiException {
    String expand =
        "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need

        /*
         * These are the supported sorting fields:
        auto_order_code
        order_id
        shipping.company
        shipping.first_name
        shipping.last_name
        shipping.city
        shipping.state_region
        shipping.postal_code
        shipping.country_code
        billing.phone
        billing.email
        billing.cc_email
        billing.company
        billing.first_name
        billing.last_name
        billing.city
        billing.state
        billing.postal_code
        billing.country_code
        creation_dts
        payment.payment_dts
        checkout.screen_branding_theme_code
        next_shipment_dts
         */

    String sort = "next_shipment_dts";
    AutoOrderQuery query = new AutoOrderQuery();
    query.setEmail("support@ultracart.com");
    AutoOrdersResponse apiResponse = autoOrderApi.getAutoOrdersByQuery(query, limit, offset, sort, expand);

    if (apiResponse.getAutoOrders() != null) {
      return apiResponse.getAutoOrders();
    }

    return new ArrayList<AutoOrder>();
  }
}
import {DateTime} from 'luxon';
import {autoOrderApi} from '../api.js';

/**
 * This example illustrates how to retrieve auto orders and handle pagination.
 *
 * These are the possible expansion values for auto orders. This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 * Expansion options include:
 *            items
 *             items.future_schedules
 *             items.sample_schedule
 *             original_order
 *             original_order.affiliate
 *             original_order.affiliate.ledger
 *             original_order.auto_order
 *             original_order.billing
 *             original_order.buysafe
 *             original_order.channel_partner
 *             original_order.checkout
 *             original_order.coupon
 *             original_order.customer_profile
 *             original_order.digital_order
 *             original_order.edi
 *             original_order.fraud_score
 *             original_order.gift
 *             original_order.gift_certificate
 *             original_order.internal
 *             original_order.item
 *             original_order.linked_shipment
 *             original_order.marketing
 *             original_order.payment
 *             original_order.payment.transaction
 *             original_order.quote
 *             original_order.salesforce
 *             original_order.shipping
 *             original_order.summary
 *             original_order.taxes
 *             rebill_orders
 *             rebill_orders.affiliate
 *             rebill_orders.affiliate.ledger
 *             rebill_orders.auto_order
 *             rebill_orders.billing
 *             rebill_orders.buysafe
 *             rebill_orders.channel_partner
 *             rebill_orders.checkout
 *             rebill_orders.coupon
 *             rebill_orders.customer_profile
 *             rebill_orders.digital_order
 *             rebill_orders.edi
 *             rebill_orders.fraud_score
 *             rebill_orders.gift
 *             rebill_orders.gift_certificate
 *             rebill_orders.internal
 *             rebill_orders.item
 *             rebill_orders.linked_shipment
 *             rebill_orders.marketing
 *             rebill_orders.payment
 *             rebill_orders.payment.transaction
 *             rebill_orders.quote
 *             rebill_orders.salesforce
 *             rebill_orders.shipping
 *             rebill_orders.summary
 *             rebill_orders.taxes
 */
export class GetAutoOrdersByQuery {
    /**
     * Executes the auto order retrieval process
     */
    static async execute() {
        console.log(`--- ${this.name} ---`);

        try {
            const autoOrders = [];

            let iteration = 1;
            let offset = 0;
            const limit = 200;
            let moreRecordsToFetch = true;

            while (moreRecordsToFetch) {
                console.log(`executing iteration ${iteration}`);

                const chunkOfOrders = await this.getAutoOrderChunk(offset, limit);
                autoOrders.push(...chunkOfOrders);
                offset = offset + limit;
                moreRecordsToFetch = chunkOfOrders.length === limit;
                iteration++;
            }

            // Display auto orders
            for (const autoOrder of autoOrders) {
                console.log(autoOrder);
            }

            console.log(`Retrieved ${autoOrders.length} auto orders`);
        } catch (ex) {
            console.error('ApiException occurred on iteration');
            console.error(ex);
            process.exit(1);
        }
    }

    /**
     * Returns a chunk of auto orders based on query parameters
     * @param offset Pagination offset
     * @param limit Maximum number of records to return
     * @returns List of matching auto orders
     */
    static async getAutoOrderChunk(offset, limit) {
        // Expansions for retrieving additional data
        const expand =
            "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need

        /*
         * Supported sorting fields:
         * auto_order_code
         * order_id
         * shipping.company
         * shipping.first_name
         * shipping.last_name
         * shipping.city
         * shipping.state_region
         * shipping.postal_code
         * shipping.country_code
         * billing.phone
         * billing.email
         * billing.cc_email
         * billing.company
         * billing.first_name
         * billing.last_name
         * billing.city
         * billing.state
         * billing.postal_code
         * billing.country_code
         * creation_dts
         * payment.payment_dts
         * checkout.screen_branding_theme_code
         * next_shipment_dts
         */
        const sort = "next_shipment_dts";

        const query = {
            email: "support@ultracart.com"
        };

        const apiResponse = await new Promise((resolve, reject) => {
            autoOrderApi.getAutoOrdersByQuery(
                query, {
                    _limit: limit,
                    _offset: offset,
                    _sort: sort,
                    _expand: expand
                }, function (error, data, response) {
                    if (error) {
                        reject(error);
                    } else {
                        resolve(data, response);
                    }
                });
        });

        return apiResponse.auto_orders ?? [];
    }
}

// Example of how to call the method
// GetAutoOrdersByQuery.execute().catch(console.error);
<?php

set_time_limit(3000); // pull all records could take a long time.
ini_set('max_execution_time', 3000);
ini_set('display_errors', 1);

/*
 * This example illustrates how to retrieve auto orders and handle pagination.
 */

use ultracart\v2\api\AutoOrderApi;
use ultracart\v2\ApiException;

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();


/**
 * @throws ApiException
 */
function getAutoOrderChunk(AutoOrderApi $auto_order_api, int $offset, int $limit): array
{

    /**
     * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
     * and may become stale. Please review the master website when in doubt.
    items
    items.future_schedules
    items.sample_schedule
    original_order
    original_order.affiliate
    original_order.affiliate.ledger
    original_order.auto_order
    original_order.billing
    original_order.buysafe
    original_order.channel_partner
    original_order.checkout
    original_order.coupon
    original_order.customer_profile
    original_order.digital_order
    original_order.edi
    original_order.fraud_score
    original_order.gift
    original_order.gift_certificate
    original_order.internal
    original_order.item
    original_order.linked_shipment
    original_order.marketing
    original_order.payment
    original_order.payment.transaction
    original_order.quote
    original_order.salesforce
    original_order.shipping
    original_order.summary
    original_order.taxes
    rebill_orders
    rebill_orders.affiliate
    rebill_orders.affiliate.ledger
    rebill_orders.auto_order
    rebill_orders.billing
    rebill_orders.buysafe
    rebill_orders.channel_partner
    rebill_orders.checkout
    rebill_orders.coupon
    rebill_orders.customer_profile
    rebill_orders.digital_order
    rebill_orders.edi
    rebill_orders.fraud_score
    rebill_orders.gift
    rebill_orders.gift_certificate
    rebill_orders.internal
    rebill_orders.item
    rebill_orders.linked_shipment
    rebill_orders.marketing
    rebill_orders.payment
    rebill_orders.payment.transaction
    rebill_orders.quote
    rebill_orders.salesforce
    rebill_orders.shipping
    rebill_orders.summary
    rebill_orders.taxes
     */
    $expand = "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
    
    /*
     * These are the supported sorting fields:
    auto_order_code 
    order_id
    shipping.company 
    shipping.first_name 
    shipping.last_name 
    shipping.city 
    shipping.state_region
    shipping.postal_code 
    shipping.country_code 
    billing.phone 
    billing.email 
    billing.cc_email
    billing.company 
    billing.first_name 
    billing.last_name 
    billing.city 
    billing.state
    billing.postal_code 
    billing.country_code 
    creation_dts 
    payment.payment_dts
    checkout.screen_branding_theme_code
    next_shipment_dts
     */

    $_since = null;
    $_sort = "next_shipment_dts";
    $query = new ultracart\v2\models\AutoOrderQuery();
    $query->setEmail("support@ultracart.com");
    $api_response = $auto_order_api->getAutoOrdersByQuery($query, $limit, $offset, $_sort, $expand);

    if ($api_response->getAutoOrders() != null) {
        return $api_response->getAutoOrders();
    }
    return [];
}

$auto_orders = [];

$iteration = 1;
$offset = 0;
$limit = 200;
$more_records_to_fetch = true;

try {
    while ($more_records_to_fetch) {

        echo "executing iteration " . $iteration . '<br>';

        $chunk_of_orders = getAutoOrderChunk($auto_order_api, $offset, $limit);
        $orders = array_merge($auto_orders, $chunk_of_orders);
        $offset = $offset + $limit;
        $more_records_to_fetch = count($chunk_of_orders) == $limit;
        $iteration++;
    }
} catch (ApiException $e) {
    echo 'ApiException occurred on iteration ' . $iteration;
    var_dump($e);
    die(1);
}


// this will be verbose...
var_dump($auto_orders);

import time
from typing import List
from ultracart.apis import AutoOrderApi
from ultracart.models import AutoOrderQuery
from ultracart.exceptions import ApiException
from samples import api_client

# Initialize the API client
auto_order_api = AutoOrderApi(api_client())


def get_auto_order_chunk(auto_order_api: AutoOrderApi, offset: int, limit: int) -> List:
    """
    Retrieve a chunk of auto orders with pagination.

    Args:
        auto_order_api: The AutoOrderApi instance
        offset: Starting position for fetching records
        limit: Maximum number of records to fetch

    Returns:
        List of auto orders for the current chunk
    """
    # These expansion values are from www.ultracart.com/api/
    # Please review the master website for the most current list
    expand = "items,items.future_schedules,original_order,rebill_orders"  # contact us if you're unsure what you need

    # Available sorting fields are documented in the original PHP file
    sort = "next_shipment_dts"

    query = AutoOrderQuery()
    query.email = "support@ultracart.com"

    api_response = auto_order_api.get_auto_orders_by_query(query, limit=limit, offset=offset, sort=sort, expand=expand)

    if api_response.auto_orders is not None:
        return api_response.auto_orders
    return []


def main():
    auto_orders = []
    iteration = 1
    offset = 0
    limit = 200
    more_records_to_fetch = True

    try:
        while more_records_to_fetch:
            print(f"executing iteration {iteration}")

            chunk_of_orders = get_auto_order_chunk(auto_order_api, offset, limit)
            auto_orders.extend(chunk_of_orders)
            offset += limit
            more_records_to_fetch = len(chunk_of_orders) == limit
            iteration += 1

    except ApiException as e:
        print(f"ApiException occurred on iteration {iteration}")
        print(e)
        exit(1)

    # Print the results
    print(auto_orders)


if __name__ == "__main__":
    main()
require 'ultracart_api'
require_relative '../constants'

# This example illustrates how to retrieve auto orders and handle pagination.

# Initialize the API
auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

def get_auto_order_chunk(auto_order_api, offset, limit)
  # These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
  # and may become stale. Please review the master website when in doubt.
  # items
  # items.future_schedules
  # items.sample_schedule
  # original_order
  # original_order.affiliate
  # original_order.affiliate.ledger
  # original_order.auto_order
  # original_order.billing
  # original_order.buysafe
  # original_order.channel_partner
  # original_order.checkout
  # original_order.coupon
  # original_order.customer_profile
  # original_order.digital_order
  # original_order.edi
  # original_order.fraud_score
  # original_order.gift
  # original_order.gift_certificate
  # original_order.internal
  # original_order.item
  # original_order.linked_shipment
  # original_order.marketing
  # original_order.payment
  # original_order.payment.transaction
  # original_order.quote
  # original_order.salesforce
  # original_order.shipping
  # original_order.summary
  # original_order.taxes
  # rebill_orders
  # rebill_orders.affiliate
  # rebill_orders.affiliate.ledger
  # rebill_orders.auto_order
  # rebill_orders.billing
  # rebill_orders.buysafe
  # rebill_orders.channel_partner
  # rebill_orders.checkout
  # rebill_orders.coupon
  # rebill_orders.customer_profile
  # rebill_orders.digital_order
  # rebill_orders.edi
  # rebill_orders.fraud_score
  # rebill_orders.gift
  # rebill_orders.gift_certificate
  # rebill_orders.internal
  # rebill_orders.item
  # rebill_orders.linked_shipment
  # rebill_orders.marketing
  # rebill_orders.payment
  # rebill_orders.payment.transaction
  # rebill_orders.quote
  # rebill_orders.salesforce
  # rebill_orders.shipping
  # rebill_orders.summary
  # rebill_orders.taxes

  # contact us if you're unsure what you need
  expand = "items,items.future_schedules,original_order,rebill_orders"

  # These are the supported sorting fields:
  # auto_order_code
  # order_id
  # shipping.company
  # shipping.first_name
  # shipping.last_name
  # shipping.city
  # shipping.state_region
  # shipping.postal_code
  # shipping.country_code
  # billing.phone
  # billing.email
  # billing.cc_email
  # billing.company
  # billing.first_name
  # billing.last_name
  # billing.city
  # billing.state
  # billing.postal_code
  # billing.country_code
  # creation_dts
  # payment.payment_dts
  # checkout.screen_branding_theme_code
  # next_shipment_dts

  query = UltracartClient::AutoOrderQuery.new
  query.email = "support@ultracart.com"

  opts = {
    _limit: limit,
    _offset: offset,
    _sort: "next_shipment_dts",
    _expand: expand
  }

  api_response = auto_order_api.get_auto_orders_by_query(query, opts)

  return [] if api_response.auto_orders.nil?
  api_response.auto_orders
end

auto_orders = []
iteration = 1
offset = 0
limit = 200
more_records_to_fetch = true

begin
  while more_records_to_fetch
    puts "executing iteration #{iteration}"

    chunk_of_orders = get_auto_order_chunk(auto_order_api, offset, limit)
    auto_orders.concat(chunk_of_orders)
    offset += limit
    more_records_to_fetch = chunk_of_orders.length == limit
    iteration += 1
  end
rescue UltracartClient::ApiError => e
  puts "ApiError occurred on iteration #{iteration}"
  puts e.inspect
  exit 1
end

# this will be verbose...
puts auto_orders.inspect
import {DateTime} from 'luxon';
import {autoOrderApi} from '../api';
import {
    AutoOrderApi,
    AutoOrder,
    AutoOrderQuery
} from 'ultracart_rest_api_v2_typescript';

/**
 * This example illustrates how to retrieve auto orders and handle pagination.
 *
 * These are the possible expansion values for auto orders. This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 * Expansion options include:
 *            items
 *             items.future_schedules
 *             items.sample_schedule
 *             original_order
 *             original_order.affiliate
 *             original_order.affiliate.ledger
 *             original_order.auto_order
 *             original_order.billing
 *             original_order.buysafe
 *             original_order.channel_partner
 *             original_order.checkout
 *             original_order.coupon
 *             original_order.customer_profile
 *             original_order.digital_order
 *             original_order.edi
 *             original_order.fraud_score
 *             original_order.gift
 *             original_order.gift_certificate
 *             original_order.internal
 *             original_order.item
 *             original_order.linked_shipment
 *             original_order.marketing
 *             original_order.payment
 *             original_order.payment.transaction
 *             original_order.quote
 *             original_order.salesforce
 *             original_order.shipping
 *             original_order.summary
 *             original_order.taxes
 *             rebill_orders
 *             rebill_orders.affiliate
 *             rebill_orders.affiliate.ledger
 *             rebill_orders.auto_order
 *             rebill_orders.billing
 *             rebill_orders.buysafe
 *             rebill_orders.channel_partner
 *             rebill_orders.checkout
 *             rebill_orders.coupon
 *             rebill_orders.customer_profile
 *             rebill_orders.digital_order
 *             rebill_orders.edi
 *             rebill_orders.fraud_score
 *             rebill_orders.gift
 *             rebill_orders.gift_certificate
 *             rebill_orders.internal
 *             rebill_orders.item
 *             rebill_orders.linked_shipment
 *             rebill_orders.marketing
 *             rebill_orders.payment
 *             rebill_orders.payment.transaction
 *             rebill_orders.quote
 *             rebill_orders.salesforce
 *             rebill_orders.shipping
 *             rebill_orders.summary
 *             rebill_orders.taxes
 */
export class GetAutoOrdersByQuery {
    /**
     * Executes the auto order retrieval process
     */
    public static async execute(): Promise<void> {
        console.log(`--- ${this.name} ---`);

        try {
            const autoOrders: AutoOrder[] = [];

            let iteration = 1;
            let offset = 0;
            const limit = 200;
            let moreRecordsToFetch = true;

            while (moreRecordsToFetch) {
                console.log(`executing iteration ${iteration}`);

                const chunkOfOrders = await this.getAutoOrderChunk(offset, limit);
                autoOrders.push(...chunkOfOrders);
                offset = offset + limit;
                moreRecordsToFetch = chunkOfOrders.length === limit;
                iteration++;
            }

            // Display auto orders
            for (const autoOrder of autoOrders) {
                console.log(autoOrder);
            }

            console.log(`Retrieved ${autoOrders.length} auto orders`);
        } catch (ex) {
            console.error('ApiException occurred on iteration');
            console.error(ex);
            process.exit(1);
        }
    }

    /**
     * Returns a chunk of auto orders based on query parameters
     * @param offset Pagination offset
     * @param limit Maximum number of records to return
     * @returns List of matching auto orders
     */
    private static async getAutoOrderChunk(offset: number, limit: number): Promise<AutoOrder[]> {
        // Expansions for retrieving additional data
        const expand =
            "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need

        /*
         * Supported sorting fields:
         * auto_order_code
         * order_id
         * shipping.company
         * shipping.first_name
         * shipping.last_name
         * shipping.city
         * shipping.state_region
         * shipping.postal_code
         * shipping.country_code
         * billing.phone
         * billing.email
         * billing.cc_email
         * billing.company
         * billing.first_name
         * billing.last_name
         * billing.city
         * billing.state
         * billing.postal_code
         * billing.country_code
         * creation_dts
         * payment.payment_dts
         * checkout.screen_branding_theme_code
         * next_shipment_dts
         */
        const sort = "next_shipment_dts";

        const query: AutoOrderQuery = {
            email: "support@ultracart.com"
        };

        const apiResponse = await autoOrderApi.getAutoOrdersByQuery({
            autoOrderQuery: query,
            limit,
            offset,
            sort,
            expand
        });

        return apiResponse.auto_orders ?? [];
    }
}

// Example of how to call the method
// GetAutoOrdersByQuery.execute().catch(console.error);

Retrieve an auto order by order id

Permissions:
  • auto_order_read

Produces: application/json
get
/auto_order/auto_orders/reference_order_id/{reference_order_id}

Retrieves a single auto order using the specified reference (original) order id.

SDK Function Name: getAutoOrderByReferenceOrderId

Parameters
Parameter Description Location Data Type Required
reference_order_id The auto order oid to retrieve. path string required
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrderResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class GetAutoOrderByReferenceOrderId
    {
        /*
         * This example illustrates how to query an auto order when you know the original order id.
         * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
         * and may become stale. Please review the master website when in doubt.
         * items
         * items.future_schedules
         * items.sample_schedule
         * original_order
         * original_order.affiliate
         * original_order.affiliate.ledger
         * original_order.auto_order
         * original_order.billing
         * original_order.buysafe
         * original_order.channel_partner
         * original_order.checkout
         * original_order.coupon
         * original_order.customer_profile
         * original_order.digital_order
         * original_order.edi
         * original_order.fraud_score
         * original_order.gift
         * original_order.gift_certificate
         * original_order.internal
         * original_order.item
         * original_order.linked_shipment
         * original_order.marketing
         * original_order.payment
         * original_order.payment.transaction
         * original_order.quote
         * original_order.salesforce
         * original_order.shipping
         * original_order.summary
         * original_order.taxes
         * rebill_orders
         * rebill_orders.affiliate
         * rebill_orders.affiliate.ledger
         * rebill_orders.auto_order
         * rebill_orders.billing
         * rebill_orders.buysafe
         * rebill_orders.channel_partner
         * rebill_orders.checkout
         * rebill_orders.coupon
         * rebill_orders.customer_profile
         * rebill_orders.digital_order
         * rebill_orders.edi
         * rebill_orders.fraud_score
         * rebill_orders.gift
         * rebill_orders.gift_certificate
         * rebill_orders.internal
         * rebill_orders.item
         * rebill_orders.linked_shipment
         * rebill_orders.marketing
         * rebill_orders.payment
         * rebill_orders.payment.transaction
         * rebill_orders.quote
         * rebill_orders.salesforce
         * rebill_orders.shipping
         * rebill_orders.summary
         * rebill_orders.taxes
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");

            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);

                string expand =
                    "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
                string originalOrderId = "DEMO-12345678";
                var apiResponse = autoOrderApi.GetAutoOrderByReferenceOrderId(originalOrderId, expand);
                AutoOrder autoOrder = apiResponse.AutoOrder;

                // this will be verbose...
                Console.WriteLine(autoOrder);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.*;
import common.Constants;

public class GetAutoOrderByReferenceOrderId {
    /**
     * This example illustrates how to query an auto order when you know the original order id.
     * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
     * and may become stale. Please review the master website when in doubt.
     * items
     * items.future_schedules
     * items.sample_schedule
     * original_order
     * original_order.affiliate
     * original_order.affiliate.ledger
     * original_order.auto_order
     * original_order.billing
     * original_order.buysafe
     * original_order.channel_partner
     * original_order.checkout
     * original_order.coupon
     * original_order.customer_profile
     * original_order.digital_order
     * original_order.edi
     * original_order.fraud_score
     * original_order.gift
     * original_order.gift_certificate
     * original_order.internal
     * original_order.item
     * original_order.linked_shipment
     * original_order.marketing
     * original_order.payment
     * original_order.payment.transaction
     * original_order.quote
     * original_order.salesforce
     * original_order.shipping
     * original_order.summary
     * original_order.taxes
     * rebill_orders
     * rebill_orders.affiliate
     * rebill_orders.affiliate.ledger
     * rebill_orders.auto_order
     * rebill_orders.billing
     * rebill_orders.buysafe
     * rebill_orders.channel_partner
     * rebill_orders.checkout
     * rebill_orders.coupon
     * rebill_orders.customer_profile
     * rebill_orders.digital_order
     * rebill_orders.edi
     * rebill_orders.fraud_score
     * rebill_orders.gift
     * rebill_orders.gift_certificate
     * rebill_orders.internal
     * rebill_orders.item
     * rebill_orders.linked_shipment
     * rebill_orders.marketing
     * rebill_orders.payment
     * rebill_orders.payment.transaction
     * rebill_orders.quote
     * rebill_orders.salesforce
     * rebill_orders.shipping
     * rebill_orders.summary
     * rebill_orders.taxes
     */
    public static void execute() {
        System.out.println("--- " + GetAutoOrderByReferenceOrderId.class.getSimpleName() + " ---");

        try {
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);

            String expand =
                "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
            String originalOrderId = "DEMO-12345678";
            AutoOrderResponse apiResponse = autoOrderApi.getAutoOrderByReferenceOrderId(originalOrderId, expand);
            AutoOrder autoOrder = apiResponse.getAutoOrder();

            // this will be verbose...
            System.out.println(autoOrder);
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
}
import {autoOrderApi} from "../api.js";

/**
 * This example illustrates how to query an auto order when you know the original order id.
 * These are the possible expansion values for auto orders. This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 *
 * Expansion values include (but are not limited to):
 * - items
 * - items.future_schedules
 * - items.sample_schedule
 * - original_order
 * - original_order.affiliate
 * - original_order.affiliate.ledger
 * ... (full list of expansions)
 * - rebill_orders.taxes
 */
export async function getAutoOrderByReferenceOrderId() {
    console.log(`--- ${getAutoOrderByReferenceOrderId.name} ---`);

    try {
        // Contact UltraCart if you're unsure what expansions you need
        const expand = 'items,items.future_schedules,original_order,rebill_orders';

        const originalOrderId = 'DEMO-12345678';
        const apiResponse = await new Promise((resolve, reject) => {
            autoOrderApi.getAutoOrderByReferenceOrderId(originalOrderId, {_expand: expand}, function (error, data, response) {
                if (error) {
                    reject(error);
                } else {
                    resolve(data, response);
                }
            });
        });
        const autoOrder = apiResponse.auto_order;

        // This will be verbose...
        console.log(autoOrder);
    } catch (error) {
        // Error handling
        console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
        console.error(error instanceof Error ? error.stack : error);
    }
}

// Optional: If you want to call the function
// getAutoOrderByReferenceOrderId().catch(console.error);
<?php

ini_set('display_errors', 1);

/*
 * This example illustrates how to query an auto order when you know the original order id.
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

/**
 * These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 * items
 * items.future_schedules
 * items.sample_schedule
 * original_order
 * original_order.affiliate
 * original_order.affiliate.ledger
 * original_order.auto_order
 * original_order.billing
 * original_order.buysafe
 * original_order.channel_partner
 * original_order.checkout
 * original_order.coupon
 * original_order.customer_profile
 * original_order.digital_order
 * original_order.edi
 * original_order.fraud_score
 * original_order.gift
 * original_order.gift_certificate
 * original_order.internal
 * original_order.item
 * original_order.linked_shipment
 * original_order.marketing
 * original_order.payment
 * original_order.payment.transaction
 * original_order.quote
 * original_order.salesforce
 * original_order.shipping
 * original_order.summary
 * original_order.taxes
 * rebill_orders
 * rebill_orders.affiliate
 * rebill_orders.affiliate.ledger
 * rebill_orders.auto_order
 * rebill_orders.billing
 * rebill_orders.buysafe
 * rebill_orders.channel_partner
 * rebill_orders.checkout
 * rebill_orders.coupon
 * rebill_orders.customer_profile
 * rebill_orders.digital_order
 * rebill_orders.edi
 * rebill_orders.fraud_score
 * rebill_orders.gift
 * rebill_orders.gift_certificate
 * rebill_orders.internal
 * rebill_orders.item
 * rebill_orders.linked_shipment
 * rebill_orders.marketing
 * rebill_orders.payment
 * rebill_orders.payment.transaction
 * rebill_orders.quote
 * rebill_orders.salesforce
 * rebill_orders.shipping
 * rebill_orders.summary
 * rebill_orders.taxes
 */
$expand = "items,items.future_schedules,original_order,rebill_orders"; // contact us if you're unsure what you need
$original_order_id = "DEMO-12345678";
$api_response = $auto_order_api->getAutoOrderByReferenceOrderId($original_order_id, $expand);
$auto_order = $api_response->getAutoOrder();

// this will be verbose...
var_dump($auto_order);

from ultracart.apis import AutoOrderApi
from samples import api_client


# This example illustrates how to query an auto order when you know the original order id.

def get_auto_order_by_reference_order_id():
    auto_order_api = AutoOrderApi(api_client())

    # These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
    # and may become stale. Please review the master website when in doubt.
    # items
    # items.future_schedules
    # items.sample_schedule
    # original_order
    # original_order.affiliate
    # original_order.affiliate.ledger
    # original_order.auto_order
    # original_order.billing
    # original_order.buysafe
    # original_order.channel_partner
    # original_order.checkout
    # original_order.coupon
    # original_order.customer_profile
    # original_order.digital_order
    # original_order.edi
    # original_order.fraud_score
    # original_order.gift
    # original_order.gift_certificate
    # original_order.internal
    # original_order.item
    # original_order.linked_shipment
    # original_order.marketing
    # original_order.payment
    # original_order.payment.transaction
    # original_order.quote
    # original_order.salesforce
    # original_order.shipping
    # original_order.summary
    # original_order.taxes
    # rebill_orders
    # rebill_orders.affiliate
    # rebill_orders.affiliate.ledger
    # rebill_orders.auto_order
    # rebill_orders.billing
    # rebill_orders.buysafe
    # rebill_orders.channel_partner
    # rebill_orders.checkout
    # rebill_orders.coupon
    # rebill_orders.customer_profile
    # rebill_orders.digital_order
    # rebill_orders.edi
    # rebill_orders.fraud_score
    # rebill_orders.gift
    # rebill_orders.gift_certificate
    # rebill_orders.internal
    # rebill_orders.item
    # rebill_orders.linked_shipment
    # rebill_orders.marketing
    # rebill_orders.payment
    # rebill_orders.payment.transaction
    # rebill_orders.quote
    # rebill_orders.salesforce
    # rebill_orders.shipping
    # rebill_orders.summary
    # rebill_orders.taxes

    # contact us if you're unsure what you need
    expand = "items,items.future_schedules,original_order,rebill_orders"
    original_order_id = "DEMO-12345678"
    api_response = auto_order_api.get_auto_order_by_reference_order_id(original_order_id, expand=expand)
    auto_order = api_response.auto_order

    # this will be verbose...
    print(auto_order)


if __name__ == "__main__":
    get_auto_order_by_reference_order_id()
require 'ultracart_api'
require_relative '../constants'

# This example illustrates how to query an auto order when you know the original order id.

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

# These are the possible expansion values for auto orders.  This list is taken from www.ultracart.com/api/
# and may become stale. Please review the master website when in doubt.
# items
# items.future_schedules
# items.sample_schedule
# original_order
# original_order.affiliate
# original_order.affiliate.ledger
# original_order.auto_order
# original_order.billing
# original_order.buysafe
# original_order.channel_partner
# original_order.checkout
# original_order.coupon
# original_order.customer_profile
# original_order.digital_order
# original_order.edi
# original_order.fraud_score
# original_order.gift
# original_order.gift_certificate
# original_order.internal
# original_order.item
# original_order.linked_shipment
# original_order.marketing
# original_order.payment
# original_order.payment.transaction
# original_order.quote
# original_order.salesforce
# original_order.shipping
# original_order.summary
# original_order.taxes
# rebill_orders
# rebill_orders.affiliate
# rebill_orders.affiliate.ledger
# rebill_orders.auto_order
# rebill_orders.billing
# rebill_orders.buysafe
# rebill_orders.channel_partner
# rebill_orders.checkout
# rebill_orders.coupon
# rebill_orders.customer_profile
# rebill_orders.digital_order
# rebill_orders.edi
# rebill_orders.fraud_score
# rebill_orders.gift
# rebill_orders.gift_certificate
# rebill_orders.internal
# rebill_orders.item
# rebill_orders.linked_shipment
# rebill_orders.marketing
# rebill_orders.payment
# rebill_orders.payment.transaction
# rebill_orders.quote
# rebill_orders.salesforce
# rebill_orders.shipping
# rebill_orders.summary
# rebill_orders.taxes

expand = "items,items.future_schedules,original_order,rebill_orders" # contact us if you're unsure what you need
original_order_id = "DEMO-12345678"
api_response = auto_order_api.get_auto_order_by_reference_order_id(original_order_id, { '_expand' => expand })
auto_order = api_response.auto_order

# this will be verbose...
puts auto_order.inspect
import { autoOrderApi } from "../api";
import { AutoOrder } from 'ultracart_rest_api_v2_typescript';

/**
 * This example illustrates how to query an auto order when you know the original order id.
 * These are the possible expansion values for auto orders. This list is taken from www.ultracart.com/api/
 * and may become stale. Please review the master website when in doubt.
 *
 * Expansion values include (but are not limited to):
 * - items
 * - items.future_schedules
 * - items.sample_schedule
 * - original_order
 * - original_order.affiliate
 * - original_order.affiliate.ledger
 * ... (full list of expansions)
 * - rebill_orders.taxes
 */
export async function getAutoOrderByReferenceOrderId(): Promise<void> {
  console.log(`--- ${getAutoOrderByReferenceOrderId.name} ---`);

  try {
    // Contact UltraCart if you're unsure what expansions you need
    const expand = 'items,items.future_schedules,original_order,rebill_orders';

    const originalOrderId = 'DEMO-12345678';
    const apiResponse = await autoOrderApi.getAutoOrderByReferenceOrderId({referenceOrderId: originalOrderId, expand});
    const autoOrder: AutoOrder|undefined = apiResponse.auto_order;

    // This will be verbose...
    console.log(autoOrder);
  } catch (error) {
    // Error handling
    console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
    console.error(error instanceof Error ? error.stack : error);
  }
}

// Optional: If you want to call the function
// getAutoOrderByReferenceOrderId().catch(console.error);

Establish an auto order by referencing a regular order id

Permissions:
  • auto_order_write

Produces: application/json
post
/auto_order/auto_orders/reference_order_id/{reference_order_id}

Establish an auto order by referencing a regular order id. The result will be an auto order without any items. You should add the items and perform an update call. Orders must be less than 60 days old and use a credit card payment.

SDK Function Name: establishAutoOrderByReferenceOrderId

Parameters
Parameter Description Location Data Type Required
reference_order_id The order id to attach this auto order to path string required
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrderResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Collections.Generic;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class EstablishAutoOrderByReferenceOrderId
    {
        /*
         *
         * This method takes a normal order id and creates an empty auto order from it.  While this might seem useless having
         * an auto order with no items, the original_order is used for shipping, billing, and payment information.
         * Once you have your empty auto order, add items to it and call updateAutoOrder.
         *
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");
            
            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);
                
                string expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
                
                string originalOrderId = "DEMO-123457";
                var apiResponse = autoOrderApi.EstablishAutoOrderByReferenceOrderId(originalOrderId, expand);
                
                AutoOrder emptyAutoOrder = apiResponse.AutoOrder;
                int autoOrderOid = emptyAutoOrder.AutoOrderOid;
                
                List<AutoOrderItem> items = new List<AutoOrderItem>();
                AutoOrderItem item = new AutoOrderItem();
                item.OriginalItemId = "ITEM_ABC"; // This item should be configured with auto order features.
                item.OriginalQuantity = 1;
                item.ArbitraryUnitCost = 59.99m;
                // Valid Frequencies
                // "Weekly", "Biweekly", "Every...", "Every 10 Days", "Every 4 Weeks", "Every 6 Weeks", "Every 8 Weeks", "Every 24 Days", "Every 28 Days", "Monthly",
                // "Every 45 Days", "Every 2 Months", "Every 3 Months", "Every 4 Months", "Every 5 Months", "Every 6 Months", "Yearly"
                item.Frequency = AutoOrderItem.FrequencyEnum.Monthly;
                items.Add(item);
                emptyAutoOrder.Items = items;
                
                string validateOriginalOrder = "No";
                var updateResponse = autoOrderApi.UpdateAutoOrder(autoOrderOid, emptyAutoOrder, validateOriginalOrder, expand);
                AutoOrder updatedAutoOrder = updateResponse.AutoOrder;
                Console.WriteLine(updatedAutoOrder);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.AutoOrder;
import com.ultracart.admin.v2.models.AutoOrderItem;
import com.ultracart.admin.v2.models.AutoOrderResponse;
import common.Constants;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class EstablishAutoOrderByReferenceOrderId {
    /**
     *
     * This method takes a normal order id and creates an empty auto order from it.  While this might seem useless having
     * an auto order with no items, the original_order is used for shipping, billing, and payment information.
     * Once you have your empty auto order, add items to it and call updateAutoOrder.
     *
     */
    public static void execute() {
        System.out.println("--- " + EstablishAutoOrderByReferenceOrderId.class.getSimpleName() + " ---");

        try {
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);

            String expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list

            String originalOrderId = "DEMO-123457";
            AutoOrderResponse apiResponse = autoOrderApi.establishAutoOrderByReferenceOrderId(originalOrderId, expand);

            AutoOrder emptyAutoOrder = apiResponse.getAutoOrder();
            int autoOrderOid = emptyAutoOrder.getAutoOrderOid();

            List<AutoOrderItem> items = new ArrayList<>();
            AutoOrderItem item = new AutoOrderItem();
            item.setOriginalItemId("ITEM_ABC"); // This item should be configured with auto order features.
            item.setOriginalQuantity(BigDecimal.valueOf(1));
            item.setArbitraryUnitCost(BigDecimal.valueOf(59.99));
            // Valid Frequencies
            // "Weekly", "Biweekly", "Every...", "Every 10 Days", "Every 4 Weeks", "Every 6 Weeks", "Every 8 Weeks", "Every 24 Days", "Every 28 Days", "Monthly",
            // "Every 45 Days", "Every 2 Months", "Every 3 Months", "Every 4 Months", "Every 5 Months", "Every 6 Months", "Yearly"
            item.setFrequency(AutoOrderItem.FrequencyEnum.MONTHLY);
            items.add(item);
            emptyAutoOrder.setItems(items);

            String validateOriginalOrder = "No";
            AutoOrderResponse updateResponse = autoOrderApi.updateAutoOrder(autoOrderOid, emptyAutoOrder, validateOriginalOrder, expand);
            AutoOrder updatedAutoOrder = updateResponse.getAutoOrder();
            System.out.println(updatedAutoOrder);
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
}
import {autoOrderApi} from "../api.js";

/**
 * This method takes a normal order id and creates an empty auto order from it.  While this might seem useless having
 * an auto order with no items, the original_order is used for shipping, billing, and payment information.
 * Once you have your empty auto order, add items to it and call updateAutoOrder.
 */
export async function establishAutoOrderByReferenceOrderId() {
    console.log(`--- ${establishAutoOrderByReferenceOrderId.name} ---`);

    try {
        // Expand parameter to include additional details
        const expand = 'items,items.future_schedules,original_order,rebill_orders';
        // see https://www.ultracart.com/api/#resource_auto_order.html for list

        const originalOrderId = 'DEMO-123457';
        const apiResponse = await new Promise((resolve, reject) => {
            autoOrderApi.establishAutoOrderByReferenceOrderId(originalOrderId, {_expand: expand}, function (error, data, response) {
                if (error) {
                    reject(error);
                } else {
                    resolve(data, response);
                }
            });
        });

        const emptyAutoOrderOrUndefined = apiResponse.auto_order;
        if (emptyAutoOrderOrUndefined !== undefined) {
            let emptyAutoOrder = emptyAutoOrderOrUndefined;
            const autoOrderOid = emptyAutoOrder.auto_order_oid || 0;

            // Create items for the auto order
            const items = [];
            const item = {
                original_item_id: 'ITEM_ABC', // This item should be configured with auto order features
                original_quantity: 1,
                arbitrary_unit_cost: 59.99,
                // Valid Frequencies:
                // "Weekly", "Biweekly", "Every...", "Every 10 Days", "Every 4 Weeks", "Every 6 Weeks", "Every 8 Weeks",
                // "Every 24 Days", "Every 28 Days", "Monthly", "Every 45 Days", "Every 2 Months", "Every 3 Months",
                // "Every 4 Months", "Every 5 Months", "Every 6 Months", "Yearly"
                frequency: 'Monthly'
            };
            items.push(item);
            emptyAutoOrder.items = items;

            const validateOriginalOrder = 'No';
            const updateResponse = await new Promise((resolve, reject) => {
                autoOrderApi.updateAutoOrder(
                    autoOrderOid,
                    emptyAutoOrder, {validate_original_order: validateOriginalOrder, _expand: expand}, function (error, data, response) {
                    if (error) {
                        reject(error);
                    } else {
                        resolve(data, response);
                    }
                });
            });
            //     autoOrderOid: number;
            // autoOrder: AutoOrder;
            // validateOriginalOrder?: string;
            // expand?: string;

            const updatedAutoOrder = updateResponse.auto_order;
            console.log(updatedAutoOrder);

        }
    } catch (error) {
        // Error handling
        console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
        console.error(error instanceof Error ? error.stack : error);
    }
}

// Optional: If you want to call the function
// establishAutoOrderByReferenceOrderId().catch(console.error);
<?php


use ultracart\v2\models\AutoOrderItem;

ini_set('display_errors', 1);

/*
 *
 * This method takes a normal order id and creates an empty auto order from it.  While this might seem useless having
 * an auto order with no items, the original_order is used for shipping, billing, and payment information.
 * Once you have your empty auto order, add items to it and call updateAutoOrder.
 *
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

$_expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list

$original_order_id = "DEMO-123457";
$api_response = $auto_order_api->establishAutoOrderByReferenceOrderId($original_order_id, $_expand);

$empty_auto_order = $api_response->getAutoOrder();
$auto_order_oid = $empty_auto_order->getAutoOrderOid();

$items = [];
$item = new AutoOrderItem();
$item->setOriginalItemId("ITEM_ABC"); // This item should be configured with auto order features.
$item->setOriginalQuantity(1);
$item->setArbitraryUnitCost(59.99);
// Valid Frequencies
// "Weekly", "Biweekly", "Every...", "Every 10 Days", "Every 4 Weeks", "Every 6 Weeks", "Every 8 Weeks", "Every 24 Days", "Every 28 Days", "Monthly",
// "Every 45 Days", "Every 2 Months", "Every 3 Months", "Every 4 Months", "Every 5 Months", "Every 6 Months", "Yearly"
$item->setFrequency("Monthly");
$items[] = $item;
$empty_auto_order->setItems($items);

$validate_original_order = 'No';
$api_response = $auto_order_api->updateAutoOrder($auto_order_oid, $empty_auto_order, $validate_original_order, $_expand);
$updated_auto_order = $api_response->getAutoOrder();
var_dump($updated_auto_order);
from ultracart.apis import AutoOrderApi
from ultracart.models import AutoOrderItem
from samples import api_client


# This method takes a normal order id and creates an empty auto order from it.  While this might seem useless having
# an auto order with no items, the original_order is used for shipping, billing, and payment information.
# Once you have your empty auto order, add items to it and call updateAutoOrder.

def establish_and_update_auto_order():
    auto_order_api = AutoOrderApi(api_client())

    # see https://www.ultracart.com/api/#resource_auto_order.html for list
    expand = "items,items.future_schedules,original_order,rebill_orders"

    original_order_id = "DEMO-123457"
    api_response = auto_order_api.establish_auto_order_by_reference_order_id(original_order_id, expand=expand)

    empty_auto_order = api_response.auto_order
    auto_order_oid = empty_auto_order.auto_order_oid

    items = []
    item = AutoOrderItem()
    item.original_item_id = "ITEM_ABC"  # This item should be configured with auto order features.
    item.original_quantity = 1
    item.arbitrary_unit_cost = 59.99

    # Valid Frequencies
    # "Weekly", "Biweekly", "Every...", "Every 10 Days", "Every 4 Weeks", "Every 6 Weeks", "Every 8 Weeks", "Every 24 Days", "Every 28 Days", "Monthly",
    # "Every 45 Days", "Every 2 Months", "Every 3 Months", "Every 4 Months", "Every 5 Months", "Every 6 Months", "Yearly"
    item.frequency = "Monthly"
    items.append(item)
    empty_auto_order.items = items

    validate_original_order = 'No'
    api_response = auto_order_api.update_auto_order(auto_order_oid, empty_auto_order, validate_original_order, expand=expand)
    updated_auto_order = api_response.auto_order
    print(updated_auto_order)


if __name__ == "__main__":
    establish_and_update_auto_order()
require 'ultracart_api'
require_relative '../constants'

# This method takes a normal order id and creates an empty auto order from it.  While this might seem useless having
# an auto order with no items, the original_order is used for shipping, billing, and payment information.
# Once you have your empty auto order, add items to it and call updateAutoOrder.

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

# see https://www.ultracart.com/api/#resource_auto_order.html for list
expand = "items,items.future_schedules,original_order,rebill_orders"

original_order_id = "DEMO-123457"
api_response = auto_order_api.establish_auto_order_by_reference_order_id(original_order_id, { '_expand' => expand })

empty_auto_order = api_response.auto_order
auto_order_oid = empty_auto_order.auto_order_oid

items = []
item = UltracartClient::AutoOrderItem.new
item.original_item_id = "ITEM_ABC" # This item should be configured with auto order features.
item.original_quantity = 1
item.arbitrary_unit_cost = 59.99
# Valid Frequencies
# "Weekly", "Biweekly", "Every...", "Every 10 Days", "Every 4 Weeks", "Every 6 Weeks", "Every 8 Weeks", "Every 24 Days", "Every 28 Days", "Monthly",
# "Every 45 Days", "Every 2 Months", "Every 3 Months", "Every 4 Months", "Every 5 Months", "Every 6 Months", "Yearly"
item.frequency = "Monthly"
items << item
empty_auto_order.items = items

validate_original_order = 'No'
api_response = auto_order_api.update_auto_order(auto_order_oid, empty_auto_order,  { '_expand' => expand, validate_original_order: validate_original_order })
updated_auto_order = api_response.auto_order
puts updated_auto_order.inspect
import {autoOrderApi} from "../api";
import {
    AutoOrder,
    AutoOrderItem
} from 'ultracart_rest_api_v2_typescript';

/**
 * This method takes a normal order id and creates an empty auto order from it.  While this might seem useless having
 * an auto order with no items, the original_order is used for shipping, billing, and payment information.
 * Once you have your empty auto order, add items to it and call updateAutoOrder.
 */
export async function establishAutoOrderByReferenceOrderId(): Promise<void> {
    console.log(`--- ${establishAutoOrderByReferenceOrderId.name} ---`);

    try {
        // Expand parameter to include additional details
        const expand = 'items,items.future_schedules,original_order,rebill_orders';
        // see https://www.ultracart.com/api/#resource_auto_order.html for list

        const originalOrderId = 'DEMO-123457';
        const apiResponse = await autoOrderApi.establishAutoOrderByReferenceOrderId({referenceOrderId: originalOrderId, expand});

        const emptyAutoOrderOrUndefined: AutoOrder | undefined = apiResponse.auto_order;
        if (emptyAutoOrderOrUndefined !== undefined) {
            let emptyAutoOrder = emptyAutoOrderOrUndefined;
            const autoOrderOid: number = emptyAutoOrder.auto_order_oid || 0;

            // Create items for the auto order
            const items: AutoOrderItem[] = [];
            const item: AutoOrderItem = {
                original_item_id: 'ITEM_ABC', // This item should be configured with auto order features
                original_quantity: 1,
                arbitrary_unit_cost: 59.99,
                // Valid Frequencies:
                // "Weekly", "Biweekly", "Every...", "Every 10 Days", "Every 4 Weeks", "Every 6 Weeks", "Every 8 Weeks",
                // "Every 24 Days", "Every 28 Days", "Monthly", "Every 45 Days", "Every 2 Months", "Every 3 Months",
                // "Every 4 Months", "Every 5 Months", "Every 6 Months", "Yearly"
                frequency: 'Monthly'
            };
            items.push(item);
            emptyAutoOrder.items = items;

            const validateOriginalOrder = 'No';
            const updateResponse = await autoOrderApi.updateAutoOrder({
                autoOrderOid,
                autoOrder: emptyAutoOrder,
                validateOriginalOrder,
                expand
            });
            //     autoOrderOid: number;
            // autoOrder: AutoOrder;
            // validateOriginalOrder?: string;
            // expand?: string;

            const updatedAutoOrder: AutoOrder | undefined = updateResponse.auto_order;
            console.log(updatedAutoOrder);

        }
    } catch (error) {
        // Error handling
        console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
        console.error(error instanceof Error ? error.stack : error);
    }
}

// Optional: If you want to call the function
// establishAutoOrderByReferenceOrderId().catch(console.error);

Retrieve an auto order by oid

Permissions:
  • auto_order_read

Produces: application/json
get
/auto_order/auto_orders/{auto_order_oid}

Retrieves a single auto order using the specified auto order oid.

SDK Function Name: getAutoOrder

Parameters
Parameter Description Location Data Type Required
auto_order_oid The auto order oid to retrieve. path integer (int32) required
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrderResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class GetAutoOrder
    {
        /*
         * retrieves an auto_order given the auto_order_oid;
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");
            
            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);
                
                string expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
                int autoOrderOid = 123456789; // If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
                
                var apiResponse = autoOrderApi.GetAutoOrder(autoOrderOid, expand);
                AutoOrder autoOrder = apiResponse.AutoOrder;
                
                Console.WriteLine(autoOrder);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.*;
import common.Constants;

public class GetAutoOrder {
    /**
     * retrieves an auto_order given the auto_order_oid;
     */
    public static void execute() {
        System.out.println("--- " + GetAutoOrder.class.getSimpleName() + " ---");
        
        try {
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);
            
            String expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
            int autoOrderOid = 123456789; // If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
            
            AutoOrderResponse apiResponse = autoOrderApi.getAutoOrder(autoOrderOid, expand);
            AutoOrder autoOrder = apiResponse.getAutoOrder();
            
            System.out.println(autoOrder);
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
}
import { autoOrderApi } from "../api.js";

/**
 * Retrieves an auto_order given the auto_order_oid.
 */
export async function getAutoOrder() {
  console.log(`--- ${getAutoOrder.name} ---`);

  try {
    // Expand parameter to include additional details
    const expand = 'items,items.future_schedules,original_order,rebill_orders';
    // See https://www.ultracart.com/api/#resource_auto_order.html for list

    // If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
    const autoOrderOid = 123456789;

    const apiResponse = await new Promise((resolve, reject) => {
      autoOrderApi.getAutoOrder(autoOrderOid, {_expand: expand}, function (error, data, response) {
        if (error) {
          reject(error);
        } else {
          resolve(data, response);
        }
      });
    });
    const autoOrder = apiResponse.auto_order;

    console.log(autoOrder);
  } catch (error) {
    // Error handling
    console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
    console.error(error instanceof Error ? error.stack : error);
  }
}

// Optional: If you want to call the function
// getAutoOrder().catch(console.error);
<?php

ini_set('display_errors', 1);

/*
 * retrieves an auto_order given the auto_order_oid;
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

$_expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
$auto_order_oid = 123456789; // If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
$api_response = $auto_order_api->getAutoOrder($auto_order_oid, $_expand);
$auto_order = $api_response->getAutoOrder();
var_dump($auto_order);
from ultracart.apis import AutoOrderApi
from samples import api_client


# retrieves an auto_order given the auto_order_oid

def get_auto_order():
    auto_order_api = AutoOrderApi(api_client())

    # see https://www.ultracart.com/api/#resource_auto_order.html for list
    expand = "items,items.future_schedules,original_order,rebill_orders"

    # If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
    auto_order_oid = 123456789
    api_response = auto_order_api.get_auto_order(auto_order_oid, expand=expand)
    auto_order = api_response.auto_order
    print(auto_order)


if __name__ == "__main__":
    get_auto_order()
require 'ultracart_api'
require_relative '../constants'

# retrieves an auto_order given the auto_order_oid;

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

# see https://www.ultracart.com/api/#resource_auto_order.html for list
expand = "items,items.future_schedules,original_order,rebill_orders"
auto_order_oid = 123456789 # If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
api_response = auto_order_api.get_auto_order(auto_order_oid, { '_expand' => expand })
auto_order = api_response.auto_order
puts auto_order.inspect
import { autoOrderApi } from "../api";
import { AutoOrder } from 'ultracart_rest_api_v2_typescript';

/**
 * Retrieves an auto_order given the auto_order_oid.
 */
export async function getAutoOrder(): Promise<void> {
  console.log(`--- ${getAutoOrder.name} ---`);

  try {
    // Expand parameter to include additional details
    const expand = 'items,items.future_schedules,original_order,rebill_orders';
    // See https://www.ultracart.com/api/#resource_auto_order.html for list

    // If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
    const autoOrderOid: number = 123456789;

    const apiResponse = await autoOrderApi.getAutoOrder({autoOrderOid, expand});
    const autoOrder: AutoOrder|undefined = apiResponse.auto_order;

    console.log(autoOrder);
  } catch (error) {
    // Error handling
    console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
    console.error(error instanceof Error ? error.stack : error);
  }
}

// Optional: If you want to call the function
// getAutoOrder().catch(console.error);

Update an auto order

Permissions:
  • auto_order_write

Consumes: application/json
Produces: application/json
put
/auto_order/auto_orders/{auto_order_oid}

Update an auto order on the UltraCart account.

SDK Function Name: updateAutoOrder

Parameters
Parameter Description Location Data Type Required
auto_order Auto order to update body AutoOrder required
auto_order_oid The auto order oid to update. path integer (int32) required
validate_original_order Validate original order before updating query string optional
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrderResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class UpdateAutoOrder
    {
        /*
         *
         * This method allows for updating an auto order.
         * Warning: Take great care editing auto orders.  They are complex.
         * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
         * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
         * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
         *
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");
            
            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);
                
                string expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
                int autoOrderOid = 123456789; // get an auto order and update it. There are many ways to retrieve an auto order.
                var apiResponse = autoOrderApi.GetAutoOrder(autoOrderOid);
                AutoOrder autoOrder = apiResponse.AutoOrder;
                string validateOriginalOrder = "No";
                
                // for this example, the customer supplied the wrong postal code when ordering. So to change the postal code for
                // all subsequent auto orders, we change the original order.
                autoOrder.OriginalOrder.Billing.PostalCode = "44233";
                
                var updateResponse = autoOrderApi.UpdateAutoOrder(autoOrderOid, autoOrder, validateOriginalOrder, expand);
                AutoOrder updatedAutoOrder = updateResponse.AutoOrder;
                Console.WriteLine(updatedAutoOrder);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.*;
import common.Constants;

public class UpdateAutoOrder {
    /**
     *
     * This method allows for updating an auto order.
     * Warning: Take great care editing auto orders.  They are complex.
     * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
     * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
     * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
     *
     */
    public static void execute() {
        System.out.println("--- " + UpdateAutoOrder.class.getSimpleName() + " ---");
        
        try {
            // Create auto order API instance using API key
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);
            
            String expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
            int autoOrderOid = 123456789; // get an auto order and update it. There are many ways to retrieve an auto order.
            AutoOrderResponse apiResponse = autoOrderApi.getAutoOrder(autoOrderOid, null);
            AutoOrder autoOrder = apiResponse.getAutoOrder();
            String validateOriginalOrder = "No";
            
            // for this example, the customer supplied the wrong postal code when ordering. So to change the postal code for
            // all subsequent auto orders, we change the original order.
            autoOrder.getOriginalOrder().getBilling().setPostalCode("44233");
            
            AutoOrderResponse updateResponse = autoOrderApi.updateAutoOrder(autoOrderOid, autoOrder, validateOriginalOrder, expand);
            AutoOrder updatedAutoOrder = updateResponse.getAutoOrder();
            System.out.println(updatedAutoOrder);
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
            ex.printStackTrace();
        }
    }
}
import {autoOrderApi} from '../api.js';

export class UpdateAutoOrder {
    /*
     *
     * This method allows for updating an auto order.
     * Warning: Take great care editing auto orders.  They are complex.
     * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
     * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
     * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
     *
     */
    static async execute() {
        console.log(`--- ${this.name} ---`);

        try {
            // Create auto order API instance using API key
            const expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
            const autoOrderOid = 123456789; // get an auto order and update it. There are many ways to retrieve an auto order.
            const apiResponse = await new Promise((resolve, reject) => {
                autoOrderApi.getAutoOrder(autoOrderOid, {_expand: expand}, function (error, data, response) {
                    if (error) {
                        reject(error);
                    } else {
                        resolve(data, response);
                    }
                });
            });
            const autoOrderOrUndefined = apiResponse.auto_order;
            const validateOriginalOrder = "No";

            if (autoOrderOrUndefined !== undefined) {
                const autoOrder = autoOrderOrUndefined;

                // for this example, the customer supplied the wrong postal code when ordering. So to change the postal code for
                // all subsequent auto orders, we change the original order.
                if (autoOrder?.original_order && autoOrder.original_order.billing) {
                    autoOrder.original_order.billing.postal_code = "44233";
                }

                const updateResponse = await new Promise((resolve, reject) => {
                    autoOrderApi.updateAutoOrder(
                        autoOrderOid,
                        autoOrder, {
                            validate_original_order: validateOriginalOrder,
                            _expand: expand
                        }, function (error, data, response) {
                            if (error) {
                                reject(error);
                            } else {
                                resolve(data, response);
                            }
                        });
                });

                const updatedAutoOrder = updateResponse.auto_order;
                console.log(updatedAutoOrder);
            }
        } catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : 'Unknown error'}`);
            console.error(ex instanceof Error ? ex.stack : ex);
        }
    }
}

// Example of how to call the method
UpdateAutoOrder.execute().catch(console.error);
<?php

ini_set('display_errors', 1);

/*
 *
 * This method allows for updating an auto order.
 * Warning: Take great care editing auto orders.  They are complex.
 * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
 * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
 * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
 *
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

$_expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
$auto_order_oid = 123456789; // get an auto order and update it.  There are many ways to retrieve an auto order.
$api_response = $auto_order_api->getAutoOrder($auto_order_oid);
$auto_order = $api_response->getAutoOrder();
$validate_original_order = 'No';

// for this example, the customer supplied the wrong postal code when ordering.  So to change the postal code for
// all subsequent auto orders, we change the original order.
$auto_order->getOriginalOrder()->getBilling()->setPostalCode('44233');

$api_response = $auto_order_api->updateAutoOrder($auto_order_oid, $auto_order, $validate_original_order, $_expand);
$updated_auto_order = $api_response->getAutoOrder();
var_dump($updated_auto_order);



from ultracart.apis import AutoOrderApi
from samples import api_client

"""
This script demonstrates updating an auto order.
Warning: Take great care editing auto orders. They are complex.
Sometimes you must change the original_order to affect the auto_order. If you have questions about what fields
to update to achieve your desired change, contact UltraCart support. Better to ask and get it right than to
make a bad assumption and corrupt a thousand auto orders. UltraCart support is ready to assist.
"""

# Initialize the API client
auto_order_api = AutoOrderApi(api_client())

# See https://www.ultracart.com/api/#resource_auto_order.html for complete list
expand = "items,items.future_schedules,original_order,rebill_orders"

# Get an auto order and update it. There are many ways to retrieve an auto order.
auto_order_oid = 123456789

# Retrieve the auto order
api_response = auto_order_api.get_auto_order(auto_order_oid)
auto_order = api_response.auto_order
validate_original_order = 'No'

# For this example, the customer supplied the wrong postal code when ordering.
# So to change the postal code for all subsequent auto orders, we change the original order.
auto_order.original_order.billing.postal_code = '44233'

# Update the auto order
api_response = auto_order_api.update_auto_order(auto_order_oid, auto_order,
                                                validate_original_order=validate_original_order, expand=expand)
updated_auto_order = api_response.auto_order
print(updated_auto_order)

# frozen_string_literal: true

# Rules for updating auto orders (recurring orders)
# To change the item that is delivered, change the AutoOrder.items[x].arbitrary_item_id
# To change the schedule (frequency) of when an item is delivered, change the original item.  It controls schedule
# To change the original item:  AutoOrder.items[x].original_item_id
#
# Alternate method:  Replace the item altogether.  Delete the current one and replace it with another item
# Note: The replacement item must be an auto order item.  (Edit item in backend, click on Auto Order tab)
# This is more complex as you must supply all the required fields.

require 'json'
require 'ultracart_api'

simple_key = '109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00'
# ao is short for 'auto order', and is used heavily below.
ao_api = UltracartClient::AutoOrderApi.new_using_api_key(simple_key, false, false)
email = 'test@test.com'


query = UltracartClient::AutoOrderQuery.new
query.email = email
expansion = 'items,items.future_schedules,items.simple_schedule,rebill_orders'
ao_response = ao_api.get_auto_orders_by_query(query, { _expand: expansion })

# there should only be one auto order for a customer.  that's typical.
# If you are marketing more than one, than you must loop through the result set
# and find the auto order you're looking for manually

auto_order = ao_response.auto_orders[0]

existing_item = 'OldItemID'
upgrade_item = 'NewItemID'

auto_order.items.each do |auto_order_item|
  auto_order_item.arbitrary_item_id = upgrade_item if auto_order_item.original_item_id = existing_item
end

# save the auto order with the updated item.
ao_api.update_auto_order(auto_order, auto_order.auto_order_oid, { _expand: expansion })





import {autoOrderApi} from '../api';
import {
    AutoOrder
} from 'ultracart_rest_api_v2_typescript';

export class UpdateAutoOrder {
    /*
     *
     * This method allows for updating an auto order.
     * Warning: Take great care editing auto orders.  They are complex.
     * Sometimes you must change the original_order to affect the auto_order.  If you have questions about what fields
     * to update to achieve your desired change, contact UltraCart support.  Better to ask and get it right than to
     * make a bad assumption and corrupt a thousand auto orders.  UltraCart support is ready to assist.
     *
     */
    public static async execute(): Promise<void> {
        console.log(`--- ${this.name} ---`);

        try {
            // Create auto order API instance using API key
            const expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
            const autoOrderOid: number = 123456789; // get an auto order and update it. There are many ways to retrieve an auto order.
            const apiResponse = await autoOrderApi.getAutoOrder({autoOrderOid, expand: expand});
            const autoOrderOrUndefined = apiResponse.auto_order;
            const validateOriginalOrder = "No";

            if (autoOrderOrUndefined !== undefined) {
                const autoOrder = autoOrderOrUndefined as AutoOrder;

                // for this example, the customer supplied the wrong postal code when ordering. So to change the postal code for
                // all subsequent auto orders, we change the original order.
                if (autoOrder?.original_order && autoOrder.original_order.billing) {
                    autoOrder.original_order.billing.postal_code = "44233";
                }

                const updateResponse = await autoOrderApi.updateAutoOrder({
                    autoOrderOid,
                    autoOrder,
                    validateOriginalOrder,
                    expand
                });

                const updatedAutoOrder = updateResponse.auto_order;
                console.log(updatedAutoOrder);
            }
        } catch (ex) {
            console.error(`Error: ${ex instanceof Error ? ex.message : 'Unknown error'}`);
            console.error(ex instanceof Error ? ex.stack : ex);
        }
    }
}

// Example of how to call the method
// UpdateAutoOrder.execute().catch(console.error);

Consolidates multiple auto orders

Permissions:
  • auto_order_write

Consumes: application/json
Produces: application/json
put
/auto_order/auto_orders/{auto_order_oid}/consolidate

Consolidates mutliple auto orders on the UltraCart account.

SDK Function Name: consolidateAutoOrders

Parameters
Parameter Description Location Data Type Required
auto_order_consolidate Auto orders to consolidate body AutoOrderConsolidate required
auto_order_oid The auto order oid to consolidate into. path integer (int32) required
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrderResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using System;
using System.Collections.Generic;
using System.Reflection;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.auto_order
{
    public class ConsolidateAutoOrders
    {
        /*
         *
         * consolidateAutoOrders
         * an auto order with no items, the original_order is used for shipping, billing, and payment information.
         * Once you have your empty auto order, add items to it and call updateAutoOrder.
         *
         */
        public static void Execute()
        {
            Console.WriteLine("--- " + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + " ---");
            
            try
            {
                // Create auto order API instance using API key
                AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);
                
                string expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
                
                int targetAutoOrderOid = 123456789; // set getAutoOrdersByQuery for retrieving auto orders where you can get their auto_order_oid.
                AutoOrderConsolidate consolidateRequest = new AutoOrderConsolidate();
                consolidateRequest.SourceAutoOrderOids = new List<int> { 23456789, 3456789 }; // these are the autoorder_oids you wish to consolidate into the target.
                
                var apiResponse = autoOrderApi.ConsolidateAutoOrders(targetAutoOrderOid, consolidateRequest, expand);
                
                var consolidatedAutoOrder = apiResponse.AutoOrder;
                
                // TODO: make sure the consolidated order has all the items and history of all orders.
                Console.WriteLine(consolidatedAutoOrder);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
            }
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.AutoOrder;
import com.ultracart.admin.v2.models.AutoOrderConsolidate;
import com.ultracart.admin.v2.models.AutoOrderResponse;
import common.Constants;

import java.util.Arrays;

public class ConsolidateAutoOrders {
  /**
   * consolidateAutoOrders
   * an auto order with no items, the original_order is used for shipping, billing, and payment information.
   * Once you have your empty auto order, add items to it and call updateAutoOrder.
   */
  public static void execute() {
    System.out.println("--- " + ConsolidateAutoOrders.class.getSimpleName() + " ---");

    try {
      // Create auto order API instance using API key
      AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.API_KEY);

      String expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list

      int targetAutoOrderOid = 123456789; // set getAutoOrdersByQuery for retrieving auto orders where you can get their auto_order_oid.
      AutoOrderConsolidate consolidateRequest = new AutoOrderConsolidate();
      consolidateRequest.setSourceAutoOrderOids(Arrays.asList(23456789, 3456789)); // these are the autoorder_oids you wish to consolidate into the target.

      AutoOrderResponse apiResponse = autoOrderApi.consolidateAutoOrders(targetAutoOrderOid, consolidateRequest, expand);

      AutoOrder consolidatedAutoOrder = apiResponse.getAutoOrder();

      // TODO: make sure the consolidated order has all the items and history of all orders.
      System.out.println(consolidatedAutoOrder);
    } catch (Exception ex) {
      System.out.println("Error: " + ex.getMessage());
      ex.printStackTrace();
    }
  }
}
import {autoOrderApi} from "../api.js";

/**
 * Consolidate Auto Orders
 *
 * An auto order with no items, the original_order is used for shipping, billing, and payment information.
 * Once you have your empty auto order, add items to it and call updateAutoOrder.
 */
export async function consolidateAutoOrders() {
    console.log(`--- ${consolidateAutoOrders.name} ---`);

    try {

        // Expand parameter to include additional details
        const expand = 'items,items.future_schedules,original_order,rebill_orders';
        // See https://www.ultracart.com/api/#resource_auto_order.html for full list of expand options

        // Target auto order OID (replace with actual value)
        const targetAutoOrderOid = 123456789;

        // Consolidate request object
        const consolidateRequest = {
            source_auto_order_oids: [23456789, 3456789] // Auto order OIDs to consolidate into the target
        };

        // Perform the consolidation
        const apiResponse = await new Promise((resolve, reject) => {
            autoOrderApi.consolidateAutoOrders(targetAutoOrderOid, consolidateRequest, {_expand: expand}, function (error, data, response) {
                if (error) {
                    reject(error);
                } else {
                    resolve(data, response);
                }
            });
        });

        // Extracted consolidated auto order
        const consolidatedAutoOrder = apiResponse.auto_order;

        // TODO: Verify the consolidated order has all items and history from source orders
        console.log(consolidatedAutoOrder);
    } catch (error) {
        // Error handling
        console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
        console.error(error instanceof Error ? error.stack : error);
    }
}

// Optional: If you want to call the function
// consolidateAutoOrders().catch(console.error);
<?php


use ultracart\v2\models\AutoOrderConsolidate;

ini_set('display_errors', 1);

/*
 *
 * consolidateAutoOrders
 * an auto order with no items, the original_order is used for shipping, billing, and payment information.
 * Once you have your empty auto order, add items to it and call updateAutoOrder.
 *
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

$_expand = "items,items.future_schedules,original_order,rebill_orders"; // see https://www.ultracart.com/api/#resource_auto_order.html for list

$target_auto_order_oid = 123456789; // set getAutoOrdersByQuery for retrieving auto orders where you can get their auto_order_oid.
$consolidateRequest = new AutoOrderConsolidate();
$consolidateRequest->setSourceAutoOrderOids([23456789, 3456789]);  // these are the autoorder_oids you wish to consolidate into the target.

$api_response = $auto_order_api->consolidateAutoOrders($target_auto_order_oid, $consolidateRequest, $_expand);

$conslidated_auto_order = $api_response->getAutoOrder();

// TODO: make sure the consolidated order has all the items and history of all orders.
var_dump($conslidated_auto_order);
from ultracart.apis import AutoOrderApi
from ultracart.models import AutoOrderConsolidate
from samples import api_client


# consolidateAutoOrders
# an auto order with no items, the original_order is used for shipping, billing, and payment information.
# Once you have your empty auto order, add items to it and call updateAutoOrder.

def consolidate_auto_orders():
    auto_order_api = AutoOrderApi(api_client())

    # see https://www.ultracart.com/api/#resource_auto_order.html for list
    expand = "items,items.future_schedules,original_order,rebill_orders"

    # set getAutoOrdersByQuery for retrieving auto orders where you can get their auto_order_oid
    target_auto_order_oid = 123456789

    consolidate_request = AutoOrderConsolidate()
    # these are the autoorder_oids you wish to consolidate into the target
    consolidate_request.source_auto_order_oids = [23456789, 3456789]

    api_response = auto_order_api.consolidate_auto_orders(
        target_auto_order_oid,
        consolidate_request,
        expand=expand
    )

    consolidated_auto_order = api_response.auto_order

    # TODO: make sure the consolidated order has all the items and history of all orders
    print(consolidated_auto_order)


if __name__ == "__main__":
    consolidate_auto_orders()
require 'ultracart_api'
require_relative '../constants'

# consolidateAutoOrders
# an auto order with no items, the original_order is used for shipping, billing, and payment information.
# Once you have your empty auto order, add items to it and call updateAutoOrder.

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

# see https://www.ultracart.com/api/#resource_auto_order.html for list
expand = "items,items.future_schedules,original_order,rebill_orders"

target_auto_order_oid = 123456789 # set getAutoOrdersByQuery for retrieving auto orders where you can get their auto_order_oid.
consolidate_request = UltracartClient::AutoOrderConsolidate.new
consolidate_request.source_auto_order_oids = [23456789, 3456789] # these are the autoorder_oids you wish to consolidate into the target.

api_response = auto_order_api.consolidate_auto_orders(target_auto_order_oid, consolidate_request, { '_expand' => expand })

consolidated_auto_order = api_response.auto_order

# TODO: make sure the consolidated order has all the items and history of all orders.
puts consolidated_auto_order.inspect
import { AutoOrderConsolidate, AutoOrder } from 'ultracart_rest_api_v2_typescript';
import {autoOrderApi} from "../api";

/**
 * Consolidate Auto Orders
 *
 * An auto order with no items, the original_order is used for shipping, billing, and payment information.
 * Once you have your empty auto order, add items to it and call updateAutoOrder.
 */
export async function consolidateAutoOrders(): Promise<void> {
  console.log(`--- ${consolidateAutoOrders.name} ---`);

  try {

    // Expand parameter to include additional details
    const expand = 'items,items.future_schedules,original_order,rebill_orders';
    // See https://www.ultracart.com/api/#resource_auto_order.html for full list of expand options

    // Target auto order OID (replace with actual value)
    const targetAutoOrderOid: number = 123456789;

    // Consolidate request object
    const consolidateRequest: AutoOrderConsolidate = {
      source_auto_order_oids: [23456789, 3456789] // Auto order OIDs to consolidate into the target
    };

    // Perform the consolidation
      const apiResponse = await autoOrderApi.consolidateAutoOrders({
              autoOrderOid: targetAutoOrderOid,
              autoOrderConsolidate: consolidateRequest,
              expand: expand
          }
      );

    // Extracted consolidated auto order
    const consolidatedAutoOrder: AutoOrder | undefined = apiResponse.auto_order;

    // TODO: Verify the consolidated order has all items and history from source orders
    console.log(consolidatedAutoOrder);
  } catch (error) {
    // Error handling
    console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
    console.error(error instanceof Error ? error.stack : error);
  }
}

// Optional: If you want to call the function
// consolidateAutoOrders().catch(console.error);

Pause auto order

Permissions:
  • auto_order_write

Consumes: application/json
Produces: application/json
put
/auto_order/auto_orders/{auto_order_oid}/pause

Completely pause an auto order

SDK Function Name: pauseAutoOrder

Parameters
Parameter Description Location Data Type Required
auto_order Auto order to pause body AutoOrder required
auto_order_oid The auto order oid to pause. path integer (int32) required
_expand The object expansion to perform on the result. See documentation for examples query string optional
Responses
Status Code Reason Response Model
200
Successful response AutoOrderResponse
400
Bad Request 400
401
Unauthorized 401
410
Authorized Application Disabled 410
429
Too Many Requests 429
500
Server Side 500
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;

namespace SdkSample.channel_partner
{
    public class PauseAutoOrder
    {
        /*
         * This is a convenience method created for an UltraCart merchant to pause a large number of auto orders
         * due to an inventory shortage. This is not new functionality and can be accomplished with the normal updateAutoOrder
         * call. It does the following logic to an auto order:
         * for each item in the auto order:
         *    if the item is not paused, pause it, setPause(true)
         * save the changes by calling updateAutoOrder()
         *
         * Some warnings if you choose to use this method.
         * There are no convenience methods to unpause auto orders.
         * There are no convenience methods to query which auto orders are paused.
         * We do not recommend pausing auto orders and the merchant is on their own to manage auto order state if they
         * choose to begin pausing orders. Keep good track of what you're doing.
         *
         */
        public static void Execute()
        {
            AutoOrderApi autoOrderApi = new AutoOrderApi(Constants.ApiKey);

            string expand = "items"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
            int autoOrderOid = 123456789; // get an auto order and update it. There are many ways to retrieve an auto order.
            AutoOrderResponse getResponse = autoOrderApi.GetAutoOrder(autoOrderOid);
            AutoOrder autoOrder = getResponse.AutoOrder;

            AutoOrderResponse pauseResponse = autoOrderApi.PauseAutoOrder(autoOrderOid, autoOrder);
            AutoOrder pausedAutoOrder = pauseResponse.AutoOrder;
            System.Console.WriteLine(pausedAutoOrder);
        }
    }
}
package auto_order;

import com.ultracart.admin.v2.AutoOrderApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;

public class PauseAutoOrder {
    /*
     * This is a convenience method created for an UltraCart merchant to pause a large number of auto orders
     * due to an inventory shortage. This is not new functionality and can be accomplished with the normal updateAutoOrder
     * call. It does the following logic to an auto order:
     * for each item in the auto order:
     *    if the item is not paused, pause it, setPause(true)
     * save the changes by calling updateAutoOrder()
     *
     * Some warnings if you choose to use this method.
     * There are no convenience methods to unpause auto orders.
     * There are no convenience methods to query which auto orders are paused.
     * We do not recommend pausing auto orders and the merchant is on their own to manage auto order state if they
     * choose to begin pausing orders. Keep good track of what you're doing.
     *
     */
    public static void execute() {
        AutoOrderApi autoOrderApi = new AutoOrderApi(common.Constants.API_KEY);

        String expand = "items"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
        int autoOrderOid = 123456789; // get an auto order and update it. There are many ways to retrieve an auto order.
        try {
            AutoOrderResponse getResponse = autoOrderApi.getAutoOrder(autoOrderOid, expand);
            AutoOrder autoOrder = getResponse.getAutoOrder();

            AutoOrderResponse pauseResponse = autoOrderApi.pauseAutoOrder(autoOrderOid, autoOrder, expand);
            AutoOrder pausedAutoOrder = pauseResponse.getAutoOrder();
            System.out.println(pausedAutoOrder);
        } catch (ApiException e) {
            System.err.println("Exception when calling AutoOrderApi#getAutoOrder");
            e.printStackTrace();
        }
    }
}
import { autoOrderApi } from '../api.js';

/**
 * This is a convenience method created for an UltraCart merchant to pause a large number of auto orders
 * due to an inventory shortage. This is not new functionality and can be accomplished with the normal updateAutoOrder
 * call. It does the following logic to an auto order:
 * for each item in the auto order:
 *    if the item is not paused, pause it, setPause(true)
 * save the changes by calling updateAutoOrder()
 *
 * Some warnings if you choose to use this method.
 * There are no convenience methods to unpause auto orders.
 * There are no convenience methods to query which auto orders are paused.
 * We do not recommend pausing auto orders and the merchant is on their own to manage auto order state if they
 * choose to begin pausing orders. Keep good track of what you're doing.
 */
export async function execute() {
  // see https://www.ultracart.com/api/#resource_auto_order.html for list
  const expand = "items";

  // get an auto order and update it. There are many ways to retrieve an auto order.
  const autoOrderOid = 123456789;

  const getResponse = await new Promise((resolve, reject) => {
    autoOrderApi.getAutoOrder(autoOrderOid, function (error, data, response) {
      if (error) {
        reject(error);
      } else {
        resolve(data, response);
      }
    });
  });

  const autoOrder = getResponse.auto_order;

  const pauseResponse = await new Promise((resolve, reject) => {
    autoOrderApi.pauseAutoOrder(autoOrderOid, autoOrder, function (error, data, response) {
      if (error) {
        reject(error);
      } else {
        resolve(data, response);
      }
    });
  });

  const pausedAutoOrder = pauseResponse.auto_order;
  console.log(pausedAutoOrder);
}
<?php

ini_set('display_errors', 1);

/*
 * This is a convenience method created for an UltraCart merchant to pause a large number of auto orders
 * due to an inventory shortage.  This is not new functionality and can be accomplished with the normal updateAutoOrder
 * call.  It does the following logic to an auto order:
 * for each item in the auto order:
 *    if the item is not paused, pause it, setPause(true)
 * save the changes by calling updateAutoOrder()
 *
 * Some warnings if you choose to use this method.
 * There are no convenience methods to unpause auto orders.
 * There are no convenience methods to query which auto orders are paused.
 * We do not recommend pausing auto orders and the merchant is on their own to manage auto order state if they
 * choose to begin pausing orders.  Keep good track of what you're doing.
 *
 */

require_once '../vendor/autoload.php';
require_once '../samples.php';


$auto_order_api = Samples::getAutoOrderApi();

$_expand = "items"; // see https://www.ultracart.com/api/#resource_auto_order.html for list
$auto_order_oid = 123456789; // get an auto order and update it.  There are many ways to retrieve an auto order.
$get_response = $auto_order_api->getAutoOrder($auto_order_oid);
$auto_order = $get_response->getAutoOrder();

$pause_response = $auto_order_api->pauseAutoOrder($auto_order_oid, $auto_order);
$paused_auto_order = $pause_response->getAutoOrder();
var_dump($paused_auto_order);
# This is a convenience method created for an UltraCart merchant to pause a large number of auto orders
# due to an inventory shortage.  This is not new functionality and can be accomplished with the normal updateAutoOrder
# call.  It does the following logic to an auto order:
# for each item in the auto order:
#    if the item is not paused, pause it, setPause(true)
# save the changes by calling updateAutoOrder()
#
# Some warnings if you choose to use this method.
# There are no convenience methods to unpause auto orders.
# There are no convenience methods to query which auto orders are paused.
# We do not recommend pausing auto orders and the merchant is on their own to manage auto order state if they
# choose to begin pausing orders.  Keep good track of what you're doing.

from ultracart.apis import AutoOrderApi
from samples import api_client

auto_order_api = AutoOrderApi(api_client())

expand = "items"  # see https://www.ultracart.com/api/#resource_auto_order.html for list
auto_order_oid = 123456789  # get an auto order and update it.  There are many ways to retrieve an auto order.
get_response = auto_order_api.get_auto_order(auto_order_oid, expand=expand)
auto_order = get_response.auto_order

pause_response = auto_order_api.pause_auto_order(auto_order_oid, auto_order)
paused_auto_order = pause_response.auto_order
print(paused_auto_order)
# This is a convenience method created for an UltraCart merchant to pause a large number of auto orders
# due to an inventory shortage. This is not new functionality and can be accomplished with the normal updateAutoOrder
# call. It does the following logic to an auto order:
# for each item in the auto order:
#    if the item is not paused, pause it, setPause(true)
# save the changes by calling updateAutoOrder()
#
# Some warnings if you choose to use this method.
# There are no convenience methods to unpause auto orders.
# There are no convenience methods to query which auto orders are paused.
# We do not recommend pausing auto orders and the merchant is on their own to manage auto order state if they
# choose to begin pausing orders. Keep good track of what you're doing.

require_relative '../constants'
require 'ultracart_api'

auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)

expand = "items" # see https://www.ultracart.com/api/#resource_auto_order.html for list
auto_order_oid = 123456789 # get an auto order and update it. There are many ways to retrieve an auto order.
get_response = auto_order_api.get_auto_order(auto_order_oid, {_expand: expand})
auto_order = get_response.auto_order

pause_response = auto_order_api.pause_auto_order(auto_order_oid, auto_order)
paused_auto_order = pause_response.auto_order
puts paused_auto_order.inspect
import { autoOrderApi } from '../api';
import { AutoOrder } from 'ultracart_rest_api_v2_typescript';

/**
 * This is a convenience method created for an UltraCart merchant to pause a large number of auto orders
 * due to an inventory shortage. This is not new functionality and can be accomplished with the normal updateAutoOrder
 * call. It does the following logic to an auto order:
 * for each item in the auto order:
 *    if the item is not paused, pause it, setPause(true)
 * save the changes by calling updateAutoOrder()
 *
 * Some warnings if you choose to use this method.
 * There are no convenience methods to unpause auto orders.
 * There are no convenience methods to query which auto orders are paused.
 * We do not recommend pausing auto orders and the merchant is on their own to manage auto order state if they
 * choose to begin pausing orders. Keep good track of what you're doing.
 */
export async function execute(): Promise<void> {
  // see https://www.ultracart.com/api/#resource_auto_order.html for list
  const expand = "items";

  // get an auto order and update it. There are many ways to retrieve an auto order.
  const autoOrderOid: number = 123456789;

  const getResponse = await autoOrderApi.getAutoOrder({
    autoOrderOid: autoOrderOid
  });

  const autoOrderMaybe = getResponse.auto_order;
  const autoOrder: AutoOrder = autoOrderMaybe as AutoOrder;

  const pauseResponse = await autoOrderApi.pauseAutoOrder({
    autoOrderOid: autoOrderOid,
    autoOrder: autoOrder
  });

  const pausedAutoOrder = pauseResponse.auto_order;
  console.log(pausedAutoOrder);
}

Webhooks

The following webhook events are generated for this resource.

Event Description Response Expansion
auto_order_cancel Trigger when an auto order canceled AutoOrder Yes
auto_order_create Trigger when an auto order is created AutoOrder Yes
auto_order_decline Trigger when an auto order is declined AutoOrder Yes
auto_order_disable Trigger when an auto order is disabled AutoOrder Yes
auto_order_rebill Trigger when an auto order is rebilled AutoOrder Yes
auto_order_update Trigger when an auto order is updated AutoOrder Yes
auto_order_preshipment Trigger when an auto order generates a new pre-shipment notice AutoOrder Yes

Activity

Attributes
Name Data Type Description
action string
channel string
metric string
storefront_oid integer (int32)
subject string
ts integer (int64)
type string
uuid string

AutoOrder

Attributes
Name Data Type Description
add_ons array of AutoOrderAddonItem Array of addon objects instructing which items to add to auto order and how many times they should be added.
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
logs (read only) array of AutoOrderLog Logs associated with this auto order
management (read only) AutoOrderManagement Management information for this auto order.
merchant_id (read only) string UltraCart merchant ID owning this order
merged_dts (read only) string (dateTime) The date/time the auto order was merged into another auto order
merged_into_auto_order_oid (read only) integer (int32) The auto order that this auto order was merged into
next_attempt string (dateTime) The next time that the auto order will be attempted for processing
original_order Order The original order that this auto order is associated with.
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
  • active
  • canceled
  • disabled
  • merged

AutoOrderAddonItem

Attributes
Name Data Type Description
arbitrary_unit_cost number
free_shipping boolean
item_id string
next_x_orders integer (int32)
options array of AutoOrderAddonItemOption Options associated with this item
quantity integer (int32)

AutoOrderAddonItemOption

Attributes
Name Data Type Description
label string(50) Label
value string(1024) Value

AutoOrderConsolidate

Attributes
Name Data Type Description
source_auto_order_oids array of integer (int32)

AutoOrderItem

Attributes
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
  • Weekly
  • Biweekly
  • Every...
  • Every 10 Days
  • Every 24 Days
  • Every 28 Days
  • Monthly
  • Every 45 Days
  • Every 2 Months
  • Every 3 Months
  • Every 4 Months
  • Every 5 Months
  • Every 6 Months
  • Yearly
  • Every 4 Weeks
  • Every 6 Weeks
  • Every 8 Weeks
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

AutoOrderItemFutureSchedule

Attributes
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

AutoOrderItemOption

Attributes
Name Data Type Description
label string(50) Label
value string(1024) Value

AutoOrderItemSimpleSchedule

Attributes
Name Data Type Description
frequency (read only) string Frequency of the rebill if not a fixed schedule
Allowed Values
  • Weekly
  • Biweekly
  • Every...
  • Every 10 Days
  • Every 24 Days
  • Every 28 Days
  • Monthly
  • Every 45 Days
  • Every 2 Months
  • Every 3 Months
  • Every 4 Months
  • Every 5 Months
  • Every 6 Months
  • Yearly
  • Every 4 Weeks
  • Every 6 Weeks
  • Every 8 Weeks
item_id (read only) string Item ID that should rebill
repeat_count integer (int32) The number of times this simple schedule is configured for

AutoOrderLog

Attributes
Name Data Type Description
log_dts string (dateTime) Date/time that the log message was added
log_message string Log message

AutoOrderManagement

Attributes
Name Data Type Description
update_billing_url (read only) string URL where the customer can go to update their billing information.

AutoOrderQuery

Attributes
Name Data Type Description
auto_order_code string Auto order code
card_type string(100) Card type
city string City
company string Company
country_code string(2) ISO-3166 two letter country code
customer_profile_oid integer (int32) Customer profile object identifier
email string(100) Email
first_name string First name
item_id string Item ID. Deprecated query field. This incorrectly meant the original order contained this item id.
last_name string Last name
next_item_id string Next Item ID that is supposed to ship. This is calculated based upon the schedule associated with the original item id.
next_shipment_date_begin string (dateTime) Next shipment date begin
next_shipment_date_end string (dateTime) Next shipment date end
original_item_id string Original Item ID purchased on auto order.
original_order_date_begin string (dateTime) Original order date begin
original_order_date_end string (dateTime) Original order date end
original_order_id string Original order ID
phone string(25) Phone
postal_code string Postal code
state string State
status string Status

AutoOrderQueryBatch

Attributes
Name Data Type Description
auto_order_oids array of integer (int32) Auto order oids

AutoOrderResponse

Attributes
Name Data Type Description
auto_order AutoOrder Auto order
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

AutoOrdersRequest

Attributes
Name Data Type Description
autoOrders array of AutoOrder auto_orders

AutoOrdersResponse

Attributes
Name Data Type Description
auto_orders array of AutoOrder
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

Browser

Attributes
Name Data Type Description
device BrowserDevice
os BrowserOS
user_agent BrowserUserAgent

BrowserDevice

Attributes
Name Data Type Description
family string

BrowserOS

Attributes
Name Data Type Description
family string
major string
minor string
patch string
patch_minor string

BrowserUserAgent

Attributes
Name Data Type Description
family string
major string
minor string
patch string

Currency

Attributes
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

Customer

Attributes
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
email 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

CustomerActivity

Attributes
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

CustomerAttachment

Attributes
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

CustomerBilling

Attributes
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

CustomerCard

Attributes
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

CustomerEDI

Attributes
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.

CustomerEmail

Attributes
Name Data Type Description
customer_profile_email_oid integer (int32) ID of the email
email string(100) Email
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

CustomerLoyalty

Attributes
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

CustomerLoyaltyLedger

Attributes
Name Data Type Description
created_by (read only) string Created By
created_dts (read only) string (dateTime) Created date
description (read only) string Description
email (read only) string Email
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

CustomerLoyaltyRedemption

Attributes
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

CustomerOrdersSummary

Attributes
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

CustomerPricingTier

Attributes
Name Data Type Description
name string(50) Name
pricing_tier_oid integer (int32) Pricing Tier Oid

CustomerPrivacy

Attributes
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

CustomerProperty

Attributes
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

CustomerQuotesSummary

Attributes
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

CustomerReviewer

Attributes
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

CustomerShipping

Attributes
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

CustomerSoftwareEntitlement

Attributes
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

CustomerTag

Attributes
Name Data Type Description
tag_value string(250) Tag Value

CustomerTaxCodes

Attributes
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

Distance

Attributes
Name Data Type Description
uom string Unit of measure
Allowed Values
  • IN
  • CM
value number The distance measured in UOM

Error

Attributes
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

ErrorResponse

Attributes
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

GiftCertificate

Attributes
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.
email 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.

GiftCertificateLedgerEntry

Attributes
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.

ListSegmentMembership

Attributes
Name Data Type Description
name string
type string
uuid string

Metric

Attributes
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

Order

Attributes
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
  • ARS
  • AUD
  • BRL
  • CAD
  • CHF
  • COP
  • EUR
  • GBP
  • JPY
  • MXN
  • MYR
  • NOK
  • NZD
  • RUB
  • SEK
  • SGD
  • TRY
  • USD
current_stage string Current stage that the order is in.
Allowed Values
  • Accounts Receivable
  • Pending Clearance
  • Fraud Review
  • Rejected
  • Shipping Department
  • Completed Order
  • Quote Request
  • Quote Sent
  • Least Cost Routing
  • Unknown
  • Pre-ordered
  • Advanced Order Routing
  • Hold
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

OrderAffiliate

This object is read only. Changing the affiliate association should be with via the user interface.
Attributes
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

OrderAffiliateLedger

This object is read only.
Attributes
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
  • Pending
  • Posted
  • Approved
  • Paid
  • Rejected
  • Partially Paid

OrderAutoOrder

Attributes
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
  • active
  • canceled
  • disabled

OrderBilling

Attributes
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)
email string(100) Email
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

OrderBuysafe

Attributes
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

OrderChannelPartner

This object is read-only except for inserts.
Attributes
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

OrderCheckout

Attributes
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

OrderCoupon

Attributes
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

OrderCurrentStageHistory

Attributes
Name Data Type Description
after_stage string New stage that the order is in.
Allowed Values
  • Accounts Receivable
  • Pending Clearance
  • Fraud Review
  • Rejected
  • Shipping Department
  • Completed Order
  • Quote Request
  • Quote Sent
  • Least Cost Routing
  • Unknown
  • Pre-ordered
  • Advanced Order Routing
  • Hold
before_stage string Previous stage that the order was in.
Allowed Values
  • Accounts Receivable
  • Pending Clearance
  • Fraud Review
  • Rejected
  • Shipping Department
  • Completed Order
  • Quote Request
  • Quote Sent
  • Least Cost Routing
  • Unknown
  • Pre-ordered
  • Advanced Order Routing
  • Hold
transition_dts (read only) string (dateTime) Date/time that the stage transitioned

OrderDigitalItem

Attributes
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

OrderDigitalOrder

Attributes
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

OrderEdi

Attributes
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

OrderFraudScore

The fraud score for the order. This entire object is read only and the details are provided to help you make a more educated decision on whether the order should be approved or rejected if the score is above your threshold.
Attributes
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
  • NA
  • No
  • NotFound
  • Yes
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

OrderGift

Attributes
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

OrderGiftCertificate

Attributes
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

OrderInternal

Attributes
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

OrderItem

Attributes
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
  • Book or Software
  • Music
  • Editorial
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
  • digital
  • physical
  • service
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

OrderItemEdi

This object is read only.
Attributes
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

OrderItemEdiIdentification

This object is read only.
Attributes
Name Data Type Description
identification string Identification value
quantity integer (int32) Quantity associated with this identifier

OrderItemEdiLot

This object is read only.
Attributes
Name Data Type Description
lot_expiration string (dateTime) Log expiration
lot_number string Lot number
lot_quantity integer (int32) Lot quantity

OrderItemOption

Attributes
Name Data Type Description
additional_dimension_application string How the additional dimensions are applied to the item.
Allowed Values
  • none
  • set item to
  • add item
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

OrderItemOptionFileAttachment

This object is read only
Attributes
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

OrderItemProperty

Attributes
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

OrderItemTag

Attributes
Name Data Type Description
tag_value string(100) Tag Value

OrderLinkedShipment

This object is read only.
Attributes
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

OrderMarketing

Attributes
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

OrderPayment

Attributes
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
  • Affirm
  • Amazon
  • Amazon Pay
  • Amazon SC
  • Cash
  • Check
  • COD
  • Credit Card
  • eBay
  • eCheck
  • Google Shopping
  • Insurance
  • Link
  • LoanHero
  • Money Order
  • PayPal
  • Purchase Order
  • Quote Request
  • Unknown
  • Wire Transfer
  • Walmart
  • Shop.com
  • Sezzle
  • Venmo
  • Apple Pay
  • Google Pay
  • Health Benefit Card
  • PayPal Fastlane
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
  • Unprocessed
  • Authorized
  • Capture Failed
  • Processed
  • Declined
  • Voided
  • Refunded
  • Skipped
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

OrderPaymentCheck

Attributes
Name Data Type Description
check_number string Check number

OrderPaymentCreditCard

Attributes
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
  • AMEX
  • Diners Club
  • Discover
  • JCB
  • MasterCard
  • VISA
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

OrderPaymentCreditCardDualVaulted

Attributes
Name Data Type Description
gateway_name string
properties array of OrderPaymentCreditCardDualVaultedProperty
rotating_transaction_gateway_code string

OrderPaymentCreditCardDualVaultedProperty

Attributes
Name Data Type Description
name string
value string

OrderPaymentECheck

Attributes
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
  • Checking
  • Savings
bank_name string(50) Bank name
bank_owner_type string Bank owner type
Allowed Values
  • Personal
  • Business
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

OrderPaymentHealthBenefitCard

Attributes
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

OrderPaymentInsurance

Attributes
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

OrderPaymentPayPal

Attributes
Name Data Type Description
customer_id (read only) string PayPal Customer ID
vault_id (read only) string PayPal Vault ID

OrderPaymentPurchaseOrder

Attributes
Name Data Type Description
purchase_order_number string Purchase order number

OrderPaymentTransaction

This object is read only.
Attributes
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

OrderPaymentTransactionDetail

This object is read only.
Attributes
Name Data Type Description
name string Name
type string Type
value string Value

OrderPointOfSale

Attributes
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.

OrderProperty

Attributes
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

OrderQuote

This object is read only.
Attributes
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

OrderSalesforce

This object is read only
Attributes
Name Data Type Description
salesforce_opportunity_id string Salesforce.com opportunity id

OrderShipping

Attributes
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

OrderSummary

Attributes
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

OrderTag

Attributes
Name Data Type Description
tag_value string(100) Tag Value

OrderTaxes

Attributes
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

OrderTrackingNumberDetail

Attributes
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

OrderTrackingNumberDetails

Attributes
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

OrderTransactionalMerchantNote

Attributes
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

OrderUtm

Attributes
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

PointOfSaleLocation

Attributes
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

PointOfSaleReader

Attributes
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
  • stripe
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

PointOfSaleRegister

Attributes
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.

Property

Attributes
Name Data Type Description
name string
value string

ResponseMetadata

Attributes
Name Data Type Description
payload_name string Payload name
result_set ResultSet Result set

ResultSet

Attributes
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.

Warning

Attributes
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

Weight

Attributes
Name Data Type Description
uom string Unit of measure
Allowed Values
  • KG
  • G
  • LB
  • OZ
value number Weight

400
Status Code 400: bad request input such as invalid json

Headers
Name Data Type Description
UC-REST-ERROR string Contains human readable error message
Response
Name Data Type
body ErrorResponse

401
Status Code 401: invalid credentials supplied

Headers
Name Data Type Description
UC-REST-ERROR string Contains human readable error message
Response
Name Data Type
body ErrorResponse

410
Status Code 410: Your authorized application has been disabled by UltraCart

Headers
Name Data Type Description
UC-REST-ERROR string Contains human readable error message
Response
Name Data Type
body ErrorResponse

429
Status Code 429: you have exceeded the allowed API call rate limit for your application.

Headers
Name Data Type Description
UC-REST-ERROR string Contains human readable error message
Response
Name Data Type
body ErrorResponse

500
Status Code 500: any server side error. the body will contain a generic server error message

Headers
Name Data Type Description
UC-REST-ERROR string Contains human readable error message
Response
Name Data Type
body ErrorResponse