Orders: createtestorder

Requires authorization

Sandbox only. Creates a test order. Try it now.

You should specify one of the two fields:

  • use templateName if you want to quickly create an example order using our templates,
  • use testOrder if you want to fully specify your own order.

Note that you can also get the template with gettestordertemplate call, modify it to your needs, and submit it in testOrder field.

Request

HTTP request

POST https://www.googleapis.com/content/v2sandbox/merchantId/testorders

Parameters

Parameter name Value Description
Path parameters
merchantId unsigned long The ID of the account that should manage the order. This cannot be a multi-client account.

Authorization

This request requires authorization with the following scope (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/content

Request body

In the request body, supply data with the following structure:

{
  "testOrder": {
    "kind": "content#testOrder",
    "lineItems": [
      {
        "product": {
          "offerId": string,
          "channel": string,
          "targetCountry": string,
          "contentLanguage": string,
          "title": string,
          "price": {
            "value": string,
            "currency": string
          },
          "condition": string,
          "gtin": string,
          "brand": string,
          "mpn": string,
          "variantAttributes": [
            {
              "dimension": string,
              "value": string
            }
          ],
          "itemGroupId": string,
          "imageLink": string
        },
        "quantityOrdered": unsigned integer,
        "unitTax": {
          "value": string,
          "currency": string
        },
        "shippingDetails": {
          "method": {
            "methodName": string,
            "carrier": string,
            "minDaysInTransit": unsigned integer,
            "maxDaysInTransit": unsigned integer
          },
          "shipByDate": string,
          "deliverByDate": string
        },
        "returnInfo": {
          "isReturnable": boolean,
          "daysToReturn": integer,
          "policyUrl": string
        }
      }
    ],
    "shippingOption": string,
    "customer": {
      "fullName": string,
      "email": string,
      "explicitMarketingPreference": boolean
    },
    "predefinedDeliveryAddress": string,
    "paymentMethod": {
      "type": string,
      "lastFourDigits": string,
      "predefinedBillingAddress": string,
      "expirationMonth": integer,
      "expirationYear": integer
    },
    "shippingCost": {
      "value": string,
      "currency": string
    },
    "shippingCostTax": {
      "value": string,
      "currency": string
    },
    "promotions": [
      {
        "id": string,
        "productApplicability": string,
        "longTitle": string,
        "effectiveDates": string,
        "redemptionChannel": string,
        "genericRedemptionCode": string,
        "benefits": [
          {
            "offerIds": [
              string
            ],
            "type": string,
            "subType": string,
            "discount": {
              "value": string,
              "currency": string
            },
            "taxImpact": {
              "value": string,
              "currency": string
            }
          }
        ]
      }
    ]
  },
  "templateName": string
}
Property name Value Description Notes
testOrder nested object The test order to create.
testOrder.kind string Identifies what kind of resource this is. Value: the fixed string "content#testOrder".
testOrder.lineItems[] list Line items that are ordered. At least one line item must be provided.
testOrder.lineItems[].product nested object Product data from the time of the order placement.
testOrder.lineItems[].product.offerId string An identifier of the item.
testOrder.lineItems[].product.channel string The item's channel.

Acceptable values are:
  • "online"
testOrder.lineItems[].product.targetCountry string The CLDR territory code of the target country of the product.
testOrder.lineItems[].product.contentLanguage string The two-letter ISO 639-1 language code for the item.

Acceptable values are:
  • "en"
testOrder.lineItems[].product.title string The title of the product.
testOrder.lineItems[].product.price nested object The price for the product.
testOrder.lineItems[].product.price.value string The price represented as a number. writable
testOrder.lineItems[].product.price.currency string The currency of the price. writable
testOrder.lineItems[].product.condition string Condition or state of the item.

Acceptable values are:
  • "new"
testOrder.lineItems[].product.gtin string Global Trade Item Number (GTIN) of the item. Optional.
testOrder.lineItems[].product.brand string Brand of the item.
testOrder.lineItems[].product.mpn string Manufacturer Part Number (MPN) of the item. Optional.
testOrder.lineItems[].product.variantAttributes[] list Variant attributes for the item. Optional.
testOrder.lineItems[].product.variantAttributes[].dimension string The dimension of the variant.
testOrder.lineItems[].product.variantAttributes[].value string The value for the dimension.
testOrder.lineItems[].product.itemGroupId string Shared identifier for all variants of the same product. Optional.
testOrder.lineItems[].quantityOrdered unsigned integer Number of items ordered.
testOrder.lineItems[].unitTax nested object Unit tax for the line item.
testOrder.lineItems[].unitTax.value string The price represented as a number. writable
testOrder.lineItems[].unitTax.currency string The currency of the price. writable
testOrder.lineItems[].shippingDetails nested object Details of the requested shipping for the line item.
testOrder.lineItems[].shippingDetails.method nested object Details of the shipping method.
testOrder.lineItems[].shippingDetails.method.methodName string The name of the shipping method.
testOrder.lineItems[].shippingDetails.method.carrier string The carrier for the shipping. Optional. See shipments[].carrier in the Orders resource representation for a list of acceptable values.
testOrder.lineItems[].shippingDetails.method.minDaysInTransit unsigned integer Minimum transit time.
testOrder.lineItems[].shippingDetails.method.maxDaysInTransit unsigned integer Maximum transit time.
testOrder.lineItems[].shippingDetails.shipByDate string The ship by date, in ISO 8601 format.
testOrder.lineItems[].shippingDetails.deliverByDate string The delivery by date, in ISO 8601 format.
testOrder.lineItems[].returnInfo nested object Details of the return policy for the line item.
testOrder.lineItems[].returnInfo.isReturnable boolean Whether the item is returnable.
testOrder.lineItems[].returnInfo.daysToReturn integer How many days later the item can be returned.
testOrder.lineItems[].returnInfo.policyUrl string URL of the item return policy.
testOrder.shippingOption string The requested shipping option.

Acceptable values are:
  • "economy"
  • "expedited"
  • "oneDay"
  • "sameDay"
  • "standard"
  • "twoDay"
testOrder.customer nested object The details of the customer who placed the order.
testOrder.customer.fullName string Full name of the customer.
testOrder.customer.email string Email address of the customer.

Acceptable values are:
  • "pog.dwight.schrute@gmail.com"
  • "pog.jim.halpert@gmail.com"
  • "pog.pam.beesly@gmail.com"
testOrder.customer.explicitMarketingPreference boolean If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow. Optional.
testOrder.predefinedDeliveryAddress string Identifier of one of the predefined delivery addresses for the delivery.

Acceptable values are:
  • "dwight"
  • "jim"
  • "pam"
testOrder.paymentMethod nested object The details of the payment method.
testOrder.paymentMethod.type string The type of instrument. Note that real orders might have different values than the four values accepted by createTestOrder.

Acceptable values are:
  • "AMEX"
  • "DISCOVER"
  • "MASTERCARD"
  • "VISA"
testOrder.paymentMethod.lastFourDigits string The last four digits of the card number.
testOrder.paymentMethod.predefinedBillingAddress string The billing address.

Acceptable values are:
  • "dwight"
  • "jim"
  • "pam"
testOrder.paymentMethod.expirationMonth integer The card expiration month (January = 1, February = 2 etc.).
testOrder.paymentMethod.expirationYear integer The card expiration year (4-digit, e.g. 2015).
testOrder.shippingCost nested object The total cost of shipping for all items.
testOrder.shippingCost.value string The price represented as a number. writable
testOrder.shippingCost.currency string The currency of the price. writable
testOrder.shippingCostTax nested object The tax for the total shipping cost.
testOrder.shippingCostTax.value string The price represented as a number. writable
testOrder.shippingCostTax.currency string The currency of the price. writable
templateName string The test order template to use. Specify as an alternative to testOrder as a shortcut for retrieving a template and then creating an order using that template.

Acceptable values are:
  • "template1"
  • "template1a"
  • "template1b"
  • "template2"
testOrder.promotions[] list The details of the merchant provided promotions applied to the order. More details about the program are here.
testOrder.promotions[].id string The unique ID of the promotion.
testOrder.promotions[].productApplicability string Whether the promotion is applicable to all products or only specific products.

Acceptable values are:
  • "allProducts"
  • "specificProducts"
testOrder.promotions[].longTitle string The full title of the promotion.
testOrder.promotions[].effectiveDates string The date and time frame when the promotion is active and ready for validation review. Note that the promotion live time may be delayed for a few hours due to the validation review.
Start date and end date are separated by a forward slash (/). The start date is specified by the format (YYYY-MM-DD), followed by the letter ?T?, the time of the day when the sale starts (in Greenwich Mean Time, GMT), followed by an expression of the time zone for the sale. The end date is in the same format.
testOrder.promotions[].redemptionChannel string Indicates that the promotion is valid online.

Acceptable values are:
  • "online"
testOrder.promotions[].genericRedemptionCode string Optional. The text code that corresponds to the promotion when applied on the retailer?s website.
testOrder.promotions[].benefits[] list
testOrder.promotions[].benefits[].offerIds[] list The OfferId(s) that were purchased in this order and map to this specific benefit of the promotion.
testOrder.promotions[].benefits[].type string Describes whether the promotion applies to products (e.g. 20% off) or to shipping (e.g. Free Shipping).

Acceptable values are:
  • "product"
  • "shipping"
testOrder.promotions[].benefits[].subType string Further describes the benefit of the promotion. Note that we will expand on this enumeration as we support new promotion sub-types.

Acceptable values are:
  • "freeOvernightShipping"
  • "freeShipping"
  • "freeTwoDayShipping"
  • "moneyOff"
  • "percentageOff"
testOrder.promotions[].benefits[].discount nested object The discount in the order price when the promotion is applied.
testOrder.promotions[].benefits[].discount.value string The price represented as a number. writable
testOrder.promotions[].benefits[].discount.currency string The currency of the price. writable
testOrder.promotions[].benefits[].taxImpact nested object The impact on tax when the promotion is applied.
testOrder.promotions[].benefits[].taxImpact.value string The price represented as a number. writable
testOrder.promotions[].benefits[].taxImpact.currency string The currency of the price. writable

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "content#ordersCreateTestOrderResponse",
  "orderId": string
}
Property name Value Description Notes
kind string Identifies what kind of resource this is. Value: the fixed string "content#ordersCreateTestOrderResponse".
orderId string The ID of the newly created test order.

Send feedback about...

Content API for Shopping