Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

ISD Commerce - Intel® Commerce Services REST API Reference

$
0
0

Intel® Commerce Services REST API Reference

 

This is the complete reference for Intel® Commerce Services REST Interface Version 1. This discussion assumes that you already have a basic understanding of Commerce Services REST APIs. If not, see the Intel Commerce Services REST Developer's Guide.

The following list provides basic information to help implement Commerce Services API calls:

  • The term user in this document refers to the consumer, the person using the app to perform a commerce activity such as making a purchase.
  • All developers must have an Intel® Identity Services account established and a commerce store established. See the Intel Commerce Services REST Developer's Guide for more information on this.
  • Calls to execute purchases require the user to have an Intel Identity Services account and to have given permission to the app to access their information.
  • Your app must place the access token for Commerce calls in the HTTP header (or in the URI) prior to executing each call. The descriptions below assume that authorization is already complete and that the app already has a valid access token.
  • Commerce Services returns response status for each call in JSON (JavaScript* Object Notation) format only.
  • Data transferred between apps and Commerce Services data structures (for example, cartStructure) is performed in JSON format.
  • Some of the cart calls support limited anonymous browsing sessions by end-users . Anonymous browsing means one of the following:
    • The user does not have an Intel Identity account.
    • The user has not yet given permission to share their information with Commerce Services.
    • The application has not provided the user's information.

    Anonymous use allows users to create carts and add items to the cart or remove them (but not purchase carts), without sharing their identities with the app.
  • The URL for REST calls is the same for apps that are being developed and have been released (except when testing commerce transactions).
  • A testing path with a base URL of https://api.intel.com/test-commerce/v1/ is provided so you can test commerce transactions without incurring actual credit card charges.
  • You will also need to create test user accounts that use test credit cards to test commerce transactions. These test accounts are actually full Intel Identity Services accounts, but with a separate URL to manage test users. This separate URL is https://test-commerce.intel.com/profile/paymentmethods2.aspx. Consult your Intel representative for information on creating these accounts.

Note: Because tokens are long, in API calls we usually substitute {access_token} or {refresh_token} for the real tokens. For calls that include elements like client ID, client secret, and user ID, we usually substitute {client_id}, {client_secret}, and {userid} for the real elements. In some cases, like initial use, we may show the real token or element. An example access token is shown below:

2/gAAAAB-gK_mJ8IW5-PQX8LkMkHXAl4viM0vRppECIkBVmfR1SOeQgvhLQnQzrwWKnbbsW1AKBzKss6eD0H3p0HMtIwtbgFQpeiqf0hDUEQlXTbt4UpKphIcV95Gc0C3PtkgNboV1TLGCC_bu5gLFXQJGAhmB6lkcJ5UwHGyn8BxFoayTdAEAAIAAAACDjEGPraEwMdWDz5MHNkulggsPdX41i4dMrdVcQdSBOcAP9vt9n0GwVNnJljsSCOH4UNHjosPpm7iwcOfF_4i_4InxRa-jRC0RWJWMxk9Xl-Uhtdv9WlxMgNZeSrSt9ySKCtREeCxYEBI1qwrnAy4a4zZ5aXAevtiXx41T7IQGu3QV2oq_4etvssMPhokSYkRAhk_nSz9dcThH2u8w-NXZl3av-rS9eiGaVxQvqqmRG79F1iw-fu5frOirJSLEofvc9nlGGZOEMk53tC0siRuP8rJOqaBJsOuPWN5widmNlirKuMjkTVShAaw-j03zMS4L39P3iuY-d9zLZUpyP3zh9poaRGEUKU5UXayGZIk76HcSsZBriPjV_84prhbh93F83XkWSOcWk1uwU_5GLPP2vu0VRxTuU_G4d1a3-aIjxE0T_OuFVSY0Lw5aAH2urUCljxbU8XDhKaOG8fi1-_HwII-5v-zLit83yy3QbOEFQ

 

Table of Calls

The following table lists each call by its call group and summarizes the function of the call.

Commerce Services REST API Call Groups
CART
CallDescription
Post CartCreate a new cart.
Delete CartDelete an existing cart.
Update CartUpdate contents of an existing cart.
Get CartGet the contents of an existing cart.
Get Multiple CartsGet the contents of multiple existing carts.
Get Cart StatusGet the status of an existing cart.
Get Cart TaxDetermine taxes on contents of an existing cart.
ORDER
CallDescription
Put Cart PurchasePut Cart Purchase submits an existing cart for purchase.
Post Cart PurchasePost Cart Purchase creates a cart and submits it for purchase in a single call.
Get OrderGet details of an order.
Get Multiple OrdersGet details of multiple orders.
Put RefundSubmit a full or partial refund for a past order.
PROFILE
CallDescription
Get Billing ProfileGet relevant information related to user's commerce billing profile.
SUBSCRIPTION
CallDescription
Post SubscriptionCreates a new subscription.
Put SubscriptionActivates a subscription that was previously created.
Get SubscriptionsGets information on specified subscriptions.
Put Subscription RefundRefund a subscription or part of a subscription.
Cancel Subscription by IDCancels the specified subscription.

Reference Tables

Cart Structure

cartStructure is a structure used by many of the API calls. The following table lists the elements of cartStructure. Not every field appears in every JSON Request or Response. For example, orderId does not appear in Responses until a cart has been purchased. JSON Requests have fewer fields than JSON Responses. The minimum JSON Requests for a call are shown in the discussion for that call.

PARAMETERSREQUIRED?INPUT/OUTPUTDESCRIPTION
actualPriceYesInputActual price of item. Must be equal to or less than listPrice. VAT inclusive but US tax exclusive. See notes below for valid values.
billingCountryNo
(Yes for Get Cart Tax and Put Cart Purchase)
InputBilling country code. Follows ISO 3166-1 alpha-2 format.
cartIdYesOutput
Input
First returned when cart is created. Then used as input for other calls.
commodityCodeYesInputCommodity code used to identify tax rate. These are predefined UNSPSC (United Nations Standard Products and Service Code) values that apps must use for proper taxation on transactions. See the Commodity Codes table for valid values and their meaning.
currencyTypeYesInputCurrency of item prices in cart in ISO 4217 format. See Currency, Currency Codes, and Location Support table for valid values and their meaning.
dateNoOutputThe date of the transaction in UTC. Follows RFC 3339 (ISO 8601) format.
extendedPriceNoOutputquantity * actualPrice. VAT inclusive but US tax exclusive. See notes below for valid values.
externalProductCodeYesInputProvided for developers to use for their own product codes. Maximum number of characters is 100.
idYesOutput
(Input for refund)
Output: unique identifier for each cart line item. id is only required as Input for refund. Valid value: Integer greater than 0.
isTaxCalculatedNoOutputBoolean: 1=yes; 0=no.
lineItemTaxNoOutputTotal tax associated with a given line item. See notes below for valid values.
listPriceYesInputList price of item. Must be equal to or greater than actualPrice. See notes below for valid values.
localeYesInputLocale of items / descriptions / email templates related to a given line item in RFC 5646 format. See Locale Codes and Locales table for valid values and their meaning.
nameYesInputLine item name that you want to appear in invoices. Maximum number of characters is 100.
orderIdYesOutput
(Input for refund)
Returned when cart is purchased. Then used as input to get order information or for a refund (if needed).
orderTotalNoOutputSum of: extendedPrice of all id items + lineItemTax of all id items. See notes below for valid values. See Payment Types, Codes, and Maximum Amounts table below for payment types, codes, and maximum purchase limits.
paymentTypeNoOutputThe payment type that was used to either calculate the tax or make the purchase. Examples: a string such as "VISA" or "AMEX". May be an empty string. See Payment Types, Codes, and Maximum Amounts table below for payment types, codes, and maximum purchase limits.
paymentTypeIdNoOutput
Input
This is returned in some calls such as Update Cart or Get Cart Tax. Can be used by Put Cart Purchase. This number uniquely identifies the paymentType associated with the cart and is influenced by billingCountry and Currency. This is a more precise way to specify the method of payment than paymentType in cases where more than one card of the same paymentType exists (for example, two VISA cards).
quantityYesInputQuantity of item. Valid value is an integer greater than 0.
refundExtendedPriceNoOutputExtended price for refund for a given line item. VAT inclusive but US tax exclusive. See notes below for valid values.
refundLineItemTaxNoOutputRefunded tax for a given line item. See notes below for valid values.
refundQuantityYes*Input
Output
Provided by developers and updated by commerce system. Required for partial refunds only and is returned to represent the quantity that was refunded. Valid value: Decimal number with 2 or fewer decimal places.
refundSubtotalNoOutputSum of refundExtendedPrice for all line items. See notes below for valid values.
refundTaxtotalNoOutputSum of refundLineItemTax from all line items. See notes below for valid values.
refundTotalNoOutputSum of: refundSubtotal + refundTaxTotal for non-VAT countries. For VAT countries, this is the sum of all refundSubtotal entries. See notes below for valid values.
statusNoOutputThis code is returned to show the status of the cart. See Cart Status Codes for valid values and their meaning.
subtotalNoOutputFor non-VAT countries, sum of extendedPrice of all id items. For VAT countries, sum across all id items of (extendedPrice - lineItemTax). See notes below for valid values.
taxTotalNoOutputTotal of all taxes for all id items. See notes below for valid values.
taxTypeNoOutputThis code is returned in Get Cart, Get Carts. Get Order, Put/Post Cart Purchase, Get Cart Tax, and Put Refund to specify the tax type. Valid values are: "none", "vat", and "sales".
userIdNoOutput0=Anonymous; otherwise this is the userId of the user.
Notes
  • Prices are decimal numbers with two or fewer decimal places.
  • When using decimals, use a period as the decimal separator. Do not use a comma as the decimal separator.
  • Responses from cartStructure REST API calls can contain values such as an empty string or the value zero based on factors such as: (1) whether a cart is associated with a user, (2) availability of a user's Billing Profile Information, and (3) whether taxes have been calculated.

Commodity Codes

PRODUCT TYPECOMMODITY CODE
Software4323.120
Video Rental551115.400
eBook551115
Electronic Publication55111506.120
Video Sale55111510.120
Music55111512.100
Data Service811120
Business Use Application Service81112106.100
Service81112201.420

Locales and Locale Codes

LOCALE/LANGUAGELOCALE CODENOTES
Danishda 
Dutchnl 
Englishen 
Finnishfi 
Frenchfr 
Germande 
Italianit 
Japaneseja 
Koreanko 
NorwegiannbAlso maps "no" to Norwegian
Polishpl 
Portuguesept 
Russianru 
Simplified Chinesezh-HANSAlso maps all combinations starting with "zh" to Simplified Chinese, except those listed below for Traditional Chinese.
Spanishes 
Swedishsv 
Traditional Chinesezh-HANTAlso maps the following to Traditional Chinese: "zh-ht", "zh-mo", "zh-tw", and zh-CHT

Currency, Currency Codes, and Currency-to-Location Support

CURRENCYCURRENCY CODESUPPORTED LOCATIONSSUPPORTED PAYMENT TYPES
Brazilian RealBRLBrazilMSCD, VISA, PAYPAL
Canadian DollarCADCanadaAMEX, MSCD, VISA, PAYPAL
EUROEURAland Islands, Austria, Belgium, Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Ireland, Israel, Italy, Latvia, Lithuania, Luxembourg, Malta , Netherlands, Norway, Poland, Portugal, Romania, Serbia (not PayPal), Slovakia, Slovenia, Spain, Sweden, Switzerland, South Africa, Turkey, United Arab Emirates, VenezuelaMSCD, VISA, PAYPAL
Great Britain PoundGBPGuernsey, Isle of Man, Jersey, United KingdomMSCD, VISA, PAYPAL
Japanese YenJPYJapanAMEX, MSCD, VISA, PAYPAL
Mexican PesoMXNMexicoMSCD, VISA, PAYPAL
Russian RubleRUBRussiaMSCD, VISA
United States DollarUSDArgentina, Chile, Colombia, Costa Rica, Ecuador, United States, Australia, Hong Kong, India, Indonesia, Malaysia, New Zealand, Philippines, Singapore, South Korea, Taiwan, ThailandAMEX, MSCD, VISA, PAYPAL

Payment Types, Payment Codes, and Maximum Amounts

PAYMENT TYPETYPE CODEMAXIMUM PURCHASE AMOUNT
American Express*AMEXMaximum amount must be less than $50,000 USD.
Carte Bleue*CARTEBLEUE-SSLMaximum amount must be less than $50,000 USD.
Cartes Bancaires*CB-SSLMaximum amount must be less than $50,000 USD.
MasterCard*MSCDMaximum amount must be less than $50,000 USD.
VISA*VISAMaximum amount must be less than $50,000 USD.
PayPal*PAYPALMaximum amount must be less than $10,000 USD, £550 GBP, €8000.

Cart Status Codes

STATUSDESCRIPTION
pendingCart has been created and may be modified.
awaiting_web_confirmationA web confirmation is in the process of being shown to the user or has been shown. Awaiting confirmation result to process the cart.
awaiting_sms_confirmationAn SMS confirmation is in the process of being sent to the user or has been sent. Awaiting confirmation result to process the cart.
deletedCart was deleted.
processing_paymentThe purchase process has been initiated and the cart is in the process of being processed.
processing_refundThe refund process has been initiated and the order is in the process of being refunded.
order_completedOrder was completed.
error_payment_systemDuring a purchase attempt, an error occurred not related to the user's payment information, such as tax systems being down, payment processor being down, or a Commerce Services system error.
error_invalid_payment_detailsThe user's payment information was invalid during a purchase. Possible cause are an expired credit card, canceled credit card, credit card that was refused to be processed, or payment information that was invalidated by an administrator.
error_refund_invalid_payment_detailsThe user's payment information was invalid during a refund. Possible causes are an expired credit card, canceled credit card, credit card that was refused to be processed, or payment information that was invalidated by an administrator.
error_refund_systemDuring a refund attempt, an error occurred not related to the user's payment information, such as tax systems being down, payment processor being down, or a Commerce Services system error.
partially_refundedPartial order was refunded.
refundedOrder was refunded.

Example JSON cartStructure showing US Tax

{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "PP14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0.09,"extendedPrice": 1.99,"refundQuantity": 0.5,"refundLineItemTax": 0.05,"refundExtendedPrice": 1.00
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "PP13","quantity": 2,"actualPrice": 2.49,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0.22,"extendedPrice": 4.98,"refundQuantity": 2,"refundLineItemTax": 0.22,"refundExtendedPrice": 4.98
    }
],"cartId": "f776fd54-e171-42d6-a4ab-2dbf5d376db2","orderId": "f776fd54-e171-42d6-a4ab-2dbf5d376db2","userId": "6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025","currencyType": "USD","locale": "en","subtotal": 6.97,"isTaxCalculated": 1,"orderTotal": 7.28,"taxTotal": 0.31,"refundSubtotal": 5.98,"refundTaxTotal": 0.27,"refundTotal": 6.25,"billingCountry": "US","paymentType": "VISA","paymentTypeId": 4,"date": "2012-06-26T05:49:36Z","taxType": "sales","status": "partially_refunded"
}     

Example JSON cartStructure showing VAT

{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "PP14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0.33,"extendedPrice": 1.99,"refundQuantity": 0.5,"refundLineItemTax": 0.17,"refundExtendedPrice": 1.00
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "PP13","quantity": 2,"actualPrice": 2.49,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0.83,"extendedPrice": 4.98,"refundQuantity": 2,"refundLineItemTax": 0.83,"refundExtendedPrice": 4.98
    }
],"cartId": "f776fd54-e171-42d6-a4ab-2dbf5d376db2","orderId": "f776fd54-e171-42d6-a4ab-2dbf5d376db2","userId": "6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025","currencyType": "EUR","locale": "en","subtotal": 5.81,"isTaxCalculated": 1,"orderTotal": 6.97,"taxTotal": 1.16,"refundSubtotal": 4.98,"refundTaxTotal": 1.00,"refundTotal": 5.98,"billingCountry": "DE","paymentType": "VISA","paymentTypeId": 4,"date": "2012-06-26T05:49:36Z""taxType": "vat","status": "partially_refunded"
}
}

Basic Commerce Calls

Post Cart

The base URL for all calls in this document points to the Commerce Services Test path (test-commerce in the path). You need to change your base URL (that is, remove the test- element from the path) when moving to the released stage.

Creates a new shopping cart using the information in {cartStructure}. For application authorization, the call returns a shopping cart ID that supports anonymous creation of shopping carts. For user authorization, the call uses a user ID from Intel Identity Services, which returns a shopping cart ID that enables purchases to be made.

The following is the application authorization HTTP method, including the access token in the HTTP header:

MethodPOST
URL Structurehttps://api.intel.com/test-commerce/v1/carts
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Body(see JSON Request below)

The following is the user authorization HTTP method, including the user ID from Intel Identity Services in the URI and the access token in the HTTP header:

MethodPOST
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userid}/carts
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Body(see JSON Request below)
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
cartstructureYesRequest bodySee cartStructure description earlier in this document for details.
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
useridNoURIUser identity from Intel Identity Services. The user's identity is only available if the user gives the application access to user information.
Example Usage

Application authorization call:

MethodPOST
URLhttps://api.intel.com/test-commerce/v1/carts
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Body(see JSON Request below)

User authorization call with user ID from Intel Identity Services:

MethodPOST
URLhttps://api.intel.com/test-commerce/v1/users/02cb74de-4401-4f54-beee-577cd09134a1/carts
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Body(see JSON Request below)
JSON Request
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99

    },
    {
        "id": 2,"name": "Some Name 2","externalProductCode": "P13","quantity": 2,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99
    }
],"currencyType": "USD","locale": "en","billingCountry": "US"
}
}
Response Codes
HTTP Error/CodeService Error CodeMessageDescription
201N/AOperation successful. Cart was created successfully.Cart ID is returned. Location Header in response returns location of cart. Example: https://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10001Invalid Request: Prices must be positive values, contain only 2 or fewer decimal places. When using decimals, use a period as the decimal separator not a commaThe Price is not formatted correctly, such as actualPrice: 0.999.
400CMR-10002Invalid Request: Cart structure or refund structure is wrong.The cart or refund structure is incorrect, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10004Invalid Request: Invalid billing country or unsupported billing country.Occurs when the billing country syntax is invalid, such as 11, or the billing country is unsupported.
400CMR-10008Invalid Request: The store is not configured.Occurs if your store is not present in the system or it is not configured for currencies, countries, and/or payment methods.
400CMR-10009Invalid Request: Either the store is not configured or there exists an invalid value for billing country or currency or locale type.May be generated by invalid data or if the store not present in the system. The store must also be configured for currencies, countries, and payment methods.
404CMR-10015Not Found: The commodity code is invalid.The commodity code is not one of the approved commodity codes.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10021Conflict: Maximum order total is reached.The total is equal to or greater than 50,000.01 USD or 41,000.01 EUR or 32,000.01 GBP.
409CMR-10022Conflict: The maximum number of line items is reached.The number of line items exceeds the 100 line item limit.
409CMR-10024Conflict: The maximum length of the line item is exceeded.The line item name exceeds the 100 character limit.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.
JSON Response
{"cartId": "6d1d2aa9-0059-4f64-93d8-894ea74800cf"
}       
Notes
  • Once a cart is assigned to a user, it cannot be reassigned to another user or unassigned.
  • If a user is assigned to a cart during this call, and no country or payment method are associated with the cart, then a country and payment method are automatically assigned based on the currency for the cart and the user's preferred payment method. (If the user's preferred payment method does not match the currency for the cart, then the store's preferred payment method is used.)
  • Subsequent calls to access the cart append the cartId to the URI as shown in the following Get Cart call:
Method

GET

URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a

Delete Cart

Deletes the specified shopping cart. This operation requires that the application include the access token in the HTTP header and the cartid of the shopping cart that's going to be deleted in the URI:

MethodDELETE
URL Structurehttps://api.intel.com/test-commerce/v1/carts/{cartid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
cartidYesURIUnique identifier for the shopping cart to be deleted.
acceptYesRequest headerValue must be "application/json".
Example Usage
MethodDELETE
URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
204N/AOperation successful.The specified cart was deleted.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.The store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Possible causes:
  • The cart/order does not exist.
  • The app does not have access to the cart/order.
  • The cart is already deleted.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10023Conflict: Status of cart/order prevents the requested action.Possible causes:
  • Cart is ordered then a delete request is submitted before the delete request is done.
  • Cart is ordered then an update request is submitted before the order is done.

Note: Carts with a purchase currently in process cannot be deleted.

Update Cart

Updates the shopping cart specified by {cartid}, using the information in {cartStructure}. For application authorization, the call updates a shopping cart during an anonymous browsing session. For user authorization, the call includes the user ID from Intel Identity Services, which updates a shopping cart that enables purchases.

Application authorization call includes access token in the HTTP header and the cart ID in the URI:

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/carts/{cartid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Body(see JSON Request below)

User authorization call includes access token in the HTTP header and both the user ID from Intel Identity Services and the cart ID in the URI:

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/{userid}/carts/{cartid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Body(see JSON Request below)
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
cartstructureYesRequest bodySee cart structure earlier in this section for details.
cartidYesURIUnique identifier for the shopping cart to be updated.
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
useridNoURIUser's identity from Intel Identity Services. For the user's identity to be available, the user must authorize access to their information.
Example Usage

Application authorization call:

MethodPUT
URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Body(see JSON Request below)

User authorization call with the user ID from Intel Identity Services:

MethodPUT
URLhttps://api.intel.com/test-commerce/v1/users/02cb74de-4401-4f54-beee-577cd09134a1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Body(see JSON Request below)
JSON Request
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99

    },
    {
        "id": 2,"name": "Some Name 3","externalProductCode": "P15","quantity": 1,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99
    }
],"currencyType": "USD","locale": "en","billingCountry": "US"
}
}
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful. Cart was updated successfully.Cart ID is returned. Location Header in response returns location of cart. Example: https://api.intel.com/test-commerce/v1/carts/12345678-1234-1234-1234-123456789ABC
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10001Invalid Request: Prices must be positive values, contain only 2 or fewer decimal places. When using decimals, use a period as the decimal separator not a comma.The Price is not formatted correctly, such as actualPrice: 0.999.
400CMR-10002Invalid Request: Cart structure or refund structure is wrong.The cart or refund structure is incorrect, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10004Invalid Request: Invalid billing country or unsupported billing country.Occurs when the billing country syntax is invalid, such as 11, or the billing country is unsupported.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10009Invalid Request: Either the store is not configured or there exists an invalid value for billing country or currency or locale type.May be generated by invalid data or by the store not being present in the system. The store must also be configured for currencies, countries, and payment methods.
404CMR-10015Not Found: The commodity code is invalid.The commodity code is not one of the approved commodity codes.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10021Conflict: Maximum order total is reached.The order total exceeds 50,000 USD (that is, the total is equal to or greater than 50,000.01 USD or 41,000.01 EUR or 32,000.01 GBP).
409CMR-10022Conflict: The maximum number of line items is reached.The number of line items exceeds the 100 line item limit.
409CMR-10023Conflict: Status of cart/order prevents the requested action.Occurs if: (1) Cart is ordered then a delete request is submitted. (2) Cart is ordered then an update request is submitted.
409CMR-10024Conflict: The maximum length of the line item is exceeded.The line item name exceeds the 100 character limit.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.
JSON Response
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 1.99
    },
    {"id": 2,"name": "Some Name 3","externalProductCode": "P15","quantity": 1,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 1.99
    }
],"cartId": "cf2bb891-1da0-473f-a01c-10cca01073ad","userId": "0","currencyType": "USD","locale": "en","isTaxCalculated": 0,"billingCountry": "US","paymentType": "","paymentTypeId": 0,"date": "2013-08-07T23:50:58Z","status": "pending","subtotal": 3.98,"orderTotal": 3.98,"taxTotal": 0,"refundSubtotal": 0,"refundTaxTotal": 0,"refundTotal": 0,"taxType": "none"
}
}
Notes
  • The userId value has a value of 0 until a cart is assigned to a user.
  • Once a cart is assigned to a user, it cannot be reassigned to another user, or unassigned.
  • If a user is assigned to a cart during this call, and no country or payment method are associated with the cart, then a country and payment method are automatically assigned based on the currency for the cart and the user's preferred payment method. (If the user's preferred payment method does not match the currency for the cart, then your store's preferred payment method is used.)

Get Cart

Get contents of the specified cart. If a cart has already been put into purchase, this call returns the contents of the order associated with cartid.

The application must include the access token in the HTTP header and the cart ID for the cart in the URI:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/carts/{cartid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
cartidYesURIUnique identifier for the shopping cart you are requesting contents for.
acceptYesRequest headerValue must be "application/json".
Example Usage
MethodGET
URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.The structure for the specified cart was returned. See below for example.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10007Invalid Request: Date format is invalid.The date format is not valid or the start date is before the minimum start date of 20120101. (Format is YYYYMMDD.)
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-30310Invalid Request: Status is not recognized.The status of the cart is not a valid value.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
JSON Response
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 1.99
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "P13","quantity": 2,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 3.98
    }
],"cartId": "cf2bb891-1da0-473f-a01c-10cca01073ad","userId": "0","currencyType": "USD","locale": "en","isTaxCalculated": 0,"billingCountry": "US","paymentType": "","paymentTypeId": 0,"date": "2013-08-07T23:50:58Z","status": "pending","subtotal": 5.97,"orderTotal": 5.97,"taxTotal": 0,"refundSubtotal": 0,"refundTaxTotal": 0,"refundTotal": 0,"taxType": "none"
}
}

Note: The userId value will be 0 until a cart is assigned to a user.

Get Multiple Carts

Gets all the carts or carts for the specified user. This call enables filtering by dates and/or cart status. This call also enables results to be paged. For application authorization, the call returns shopping cart information regardless of user. For user authorization, the call includes a user ID from Intel Identity Services, which allows information to be gathered for a specific user's carts.

Application authorization call, including the access token in the HTTP header and the date range and paging parameters:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/carts?start_date={YYYYMMDD}&end_date={YYYYMMDD}&$limit={limit}&$offset={offset}&status={status}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a

This is a user authorization call that includes the access token in the HTTP header and the user ID from Intel Identity Services and the date range, paging parameters, and status in the URI:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userid}/carts?start_date={YYYYMMDD}&end_date={YYYYMMDD}&$limit={limit}&$offset={offset}&status={status}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
start_dateYesURIStart date for cart information request in UTC format. Minimum start date is 20120101 (2012, January 1).
end_dateYesURIEnd date for cart information request in UTC format. End date must be greater than or equal to the start date.
$limitNoURISpecifies the maximum number of carts to be returned in a page of results. Integer between 0 and 1,000; default if not specified is 500.
$offsetNoURISpecifies the page number to include in the results from the total available pages. Integer greater than 0; default if not specified is 0.
statusNoURICart status. See Cart Status table for valid values. Only valid when userid is also used.
acceptYesRequest headerValue must be "application/json".
useridNoURIUser's identity from Intel Identity Services. The user must authorize the application to use their information for the user's identity to be available.
Example Usage

Application authorization call with start and end dates:

MethodGET
URLhttps://api.intel.com/test-commerce/v1/carts?start_date=20120801&end_date=20120831
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a

User authorization call with user ID from Intel Identity Services, start and end dates, and carts with completed orders:

MethodGET
URLhttps://api.intel.com/test-commerce/v1/users/02cb74de-4401-4f54-beee-577cd09134a1/carts?start_date=20120901&end_date=20120930&status=order_completed
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a

Application authorization call with start and end dates, and $limit of 50 carts per result with $offset of page 0 (first page):

MethodGET
URLhttps://api.intel.com/test-commerce/v1/carts?start_date=20130701&end_date=20130731&$limit=50&$offset=0
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.JSON format is returned: cartid, date, status, total price, currency type, URI for each cart in the format https://api.intel.com/test-commerce/v1/carts/{cartid}
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10007Invalid Request: Date format is invalid.The date format is not valid or the start date is before the minimum start date of 20120101. (Format is YYYYMMDD.)
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10018Invalid Request: The value of the $limit or $offset is incorrect.Note that $limit must be an integer between 0 and 1,000. $offset must be an inter greater than 0.
400CMR-30310Invalid Request: Status is not recognized.The status of the cart is not a valid value.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
JSON Response
{"data": {"currentItemCount": 2,"totalItems": 2,"itemsPerPage": 500,"startIndex": 0,"nextLink": "https://api.intel.com/test-commerce/v1/users/6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025/carts?start_date=20130730&end_date=20130807","previousLink": "https://api.intel.com/test-commerce/v1/users/6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025/carts?start_date=20130730&end_date=20130807&$offset=0&$limit=500","pagingLinkTemplate": "https://api.intel.com/test-commerce/v1/users/6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025/carts?start_date={start_date}&end_date={end_date}&$offset={offset}&$limit={limit}","kind": "carts","items": [
    {"cartId": "507009e3-4336-43a5-9dbb-4547f24f2ff6","userId": "6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025","currencyType": "USD","date": "2013-07-30T01:24:02Z","status": "pending","cartUrl": "https://api.intel.com/test-commerce/v1/carts/507009e3-4336-43a5-9dbb-4547f24f2ff6","totalPrice": 5.97
    },
    {"cartId": "0cc3839d-1291-4f6d-bcf7-aaad862b8354","userId": "6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025","currencyType": "USD","date": "2013-07-30T01:01:47Z","status": "pending","cartUrl": "https://api.intel.com/test-commerce/v1/carts/0cc3839d-1291-4f6d-bcf7-aaad862b8354","totalPrice": 5.97
    }
]
}
}          

Get Cart Status

Get status for the specified cart. The application must include the access token in the HTTP header and the cart ID for the shopping cart in the URI:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/carts/{cartid}/status
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
cartidYesURIUnique identifier for the shopping cart you are requesting status for.
acceptYesRequest headerValue must be "application/json".
Example Usage
MethodGET
URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf/status
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.The status for the specified cart was returned. See below for example.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
404CMR-10016Conflict: Status of cart/order prevents the requested action.Occurs if: (1) Cart does not exist, (2) Cart is ordered then a delete request is submitted while order is in progress. (3) Cart is ordered then an update request is submitted while order is in progress.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
JSON Response
js
{"cartStatus": "awaiting_web_confirmation"
}

Note: See supported Cart Status Codes.

Get Cart Tax

Calculate tax for the specified cart. This call calculates VAT tax for EEC countries or US tax for the United States. The application must include the access token in the HTTP header and the cart ID for the shopping cart in the URI. Payment type can optionally be included in the URI through paymenttype or paymenttypeid.

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/carts/{cartid}/tax?paymenttype={paymenttype}&paymenttypeid={paymenttypeid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a

Note: See the notes below for processing rules.

Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
cartidYesURIUnique identifier for the shopping cart you are requesting tax information for.
acceptYesRequest headerValue must be "application/json".
paymenttypeNoURIPayment type to use for the tax calculation, such as "VISA". See Payment Types, Payment Codes, and Maximum Amounts for valid values.
paymenttypeidNoURIPayment Type id to use for the tax calculation. Payment Type Id represents a combination of data including the Billing Country, Currency, and Payment Type and is a number generated by Commerce Services in response to Update Cart and Get Cart Tax. This is a more precise way to specify the method of payment than paymentType in cases where more than one card of the same paymentType exists (for example, two VISA cards).
Example Usage
MethodGET
URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf/tax?paymenttype=VISA
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.Cart returned with tax information included.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-30610Invalid Request: The payment type is not supported.The format of the payment type is invalid or the payment type is not supported.
402CMR-10010Payment Information Required: Billing profile information is required to process the order.The billing information is invalid or insufficient to process the order.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order.
409CMR-10023Conflict: Status of cart/order prevents the requested action.Occurs if: (1) Cart is ordered then a delete request is submitted. (2) Cart is ordered then an update request is submitted.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
JSON Response
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0.12,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 1.99
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "P13","quantity": 2,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0.24,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 3.98
    }
],"cartId": "cf2bb891-1da0-473f-a01c-10cca01073ad","userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","isTaxCalculated": 1,"billingCountry": "US","paymentType": "VISA","paymentTypeId": 2,"date": "2013-08-07T23:50:58Z","status": "pending","subtotal": 5.97,"orderTotal": 6.33,"taxTotal": 0.36,"refundSubtotal": 0,"refundTaxTotal": 0,"refundTotal": 0,"taxType": "sales"
}
}  
Notes
  • Using paymenttypeid is the recommended method of specifying the payment method.
  • If paymenttypeid and paymenttype are both included in the query string, paymenttypeid takes precedence and paymenttype is ignored.
  • If paymenttype is included in the query string, the billing information associated with paymenttype is used for calculating the tax.
  • If paymenttype is not included in the query string, the consumer's preferred payment method is used, assuming it is supported by your Commerce Services store.
  • If the user information or the payment information associated with the user is missing from the system, the call returns an error.
  • The userId value will be 0 until a cart is assigned to a user.

Put Cart Purchase

Put Cart Purchase submits an existing cart (already assigned to a user) to the payment processor. Carts that are successfully purchased become orders.

Note: Put Cart Purchase requires a cart that's already assigned to a user (user authorization access token) and valid payment information.

A basic version of this call uses the billing profile in cartStructure. An alternate version of the call uses the paymenttype or paymenttypeid in the query string.

billingCountry is used to specify a billing profile if billingCountry is present in the cartStructure.

Here is the basic version, with the access token in the HTTP header and the cart ID in the URI (using billing profile in cartStructure):

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/carts/{cartid}/purchase
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Bodyn/a

Here is the alternate version, with the access token in the HTTP header and the cart ID and payment type or payment type ID associated with the user's Billing Profile in the URI:

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/carts/{cartid}/purchase?paymenttype={paymenttype}&paymenttypeid={paymenttypeid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session. For this call, the access token must be a user authorization access token.
cartidYesURIUnique identifier for the shopping cart you are submitting for purchase.
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
paymenttypeNoURIPayment type to use for the tax calculation, such as "VISA". See Payment Types, Payment Codes, and Maximum Amounts for valid values.
paymenttypeidNoURIPayment Type Id represents a combination of data including the Billing Country, Currency, and Payment Type and is a number generated by Commerce Services in response to Update Cart and Get Cart Tax. This is a more precise way to specify the method of payment than paymentType in cases where more than one card of the same paymentType exists (for example, two VISA cards).
Example Usages

Basic version of the call (using billing profile in cartStructure):

MethodPUT
URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf/purchase
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Bodyn/a

Alternate version of the call using payment type ID associated with the user's Intel Identity Services profile:

MethodPUT
URLhttps://api.intel.com/test-commerce/v1/carts/6d1d2aa9-0059-4f64-93d8-894ea74800cf/purchase?paymenttypeid=7
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Bodyn/a
JSON Request for Put Cart Purchase

(not applicable for this call)

Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.Order was already purchased. cartStructure is returned with current status, taxes, etc.
201N/AOperation successful.Order was created. Updated cartStructure is returned with current status, taxes, etc.
202N/AOperation successful.Confirmation is necessary. Provide URL, SMS instructions and code number, or SMS message stating the confirmation is being sent to phone. cartStructure is not returned at this time. (Updated cartStructure is returned after purchase successfully completes.)
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10004Invalid Request: Invalid billing country or unsupported billing country.Occurs when the billing country syntax is invalid, such as 11, or the billing country is unsupported.
400CMR-30610Invalid Request: The payment type is not supported.The format of the payment type is invalid or the payment type is not supported by the Commerce Services or by this store.
400CMR-30615Invalid Request: The token is either missing or invalid.Application authorization is required. The access token must include 'profile:basic' access rights.
402CMR-10010Payment Information Required: Billing profile information is required to process the order.The billing information is invalid or insufficient to process the order.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10021Conflict: Maximum order total is reached.The order total exceeds 50,000 USD (that is, the total is equal to or greater than 50,000.01 USD or 41,000.01 EUR or 32,000.01 GBP).
409CMR-10023Conflict: Status of cart/order prevents the requested action.Occurs if: (1) Cart is ordered then a delete request is submitted. (2) Cart is ordered then an update request is submitted.
409CMR-10024Conflict: The maximum length of the line item is exceeded.The line item name exceeds the 100 character limit.
409CMR-30650Conflict: Minimum purchase price is not reached.The purchase price is below the supported minimum price.
409CMR-30652Conflict: The order total will be denied on the test systems.The total of your order matches the card processor value for denials on the test systems.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.
Sample JSON Response for Return Codes 200, 201
  {"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0.12,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 1.99
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "P13","quantity": 2,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0.24,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 3.98
    }
    ],"cartId": "cf2bb891-1da0-473f-a01c-10cca01073ad","orderId": "cf2bb891-1da0-473f-a01c-10cca01073ad","userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","isTaxCalculated": 1,"billingCountry": "US","paymentType": "VISA","paymentTypeId": 2,"date": "2013-08-08T00:19:59Z","status": "order_completed","subtotal": 5.97,"orderTotal": 6.33,"taxTotal": 0.36,"refundSubtotal": 0,"refundTaxTotal": 0,"refundTotal": 0,"taxType": "sales"
    }
}       
Notes
  • Using paymenttypeid is the recommended method of specifying the payment method.
  • If this payment type is different than the payment type used for the prior Get Cart Tax call, the tax is recalculated using the current payment type before processing.

Post Cart Purchase

Post Cart Purchase creates a cart from cartStructure, assigns it to a user, and submits it to the payment processor. Carts that are successfully purchased become orders.

Post Cart Purchase uses the current cartStructure and specified user ID and submits the cart for purchase. (It creates the cart, assigns it to a user, and submits it for purchase in a single call.) An alternate version of the call uses the paymenttype or paymenttypeid in the query string.

billingCountry is used to specify a billing profile if billingCountry is present in the cartStructure.

Basic version, with the access token in the HTTP header and using billing profile in cartStructure:

MethodPOST
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userid}/purchase
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Body(see JSON Request below)

Alternate version, with the access token in the HTTP header and payment type or payment type ID associated with the user's Billing Profile in the URI:

MethodPOST
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userid}/purchase?paymenttype={paymenttype}&paymenttypeid={paymenttypeid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Body(see JSON Request below)
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session. For this call, the access token must be a user authorization access token.
useridYesURIUser's identity from Intel Identity Services. The user must give the application access to their information for the user's identity to be available.
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
paymenttypeNoURIPayment type to use for the tax calculation, such as "VISA". See Payment Types, Payment Codes, and Maximum Amounts for valid values.
paymenttypeidNoURIPayment Type Id represents a combination of data including the Billing Country, Currency, and Payment Type and is a number generated by Commerce Services in response to Update Cart and Get Cart Tax. This is a more precise way to specify the method of payment than paymentType in cases where more than one card of the same paymentType exists (for example, two VISA cards).
cartStructureYesRequest bodyPost Cart Purchase requires a valid cartStructure in the body.
Example Usages

Single call purchase:

MethodPOST
URLhttps://api.intel.com/test-commerce/v1/carts/users/{userid}/purchase?paymenttypeid=7
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Body(see JSON Request below)
JSON Request for Post Cart Purchase
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99

    },
    {
        "id": 2,"name": "Some Name 2","externalProductCode": "P13","quantity": 2,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99
    }
],"currencyType": "USD","locale": "en","billingCountry": "US"
}
}
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.Order was already purchased. cartStructure is returned with current status, taxes, etc.
201N/AOperation successful.Order was created. Updated cartStructure is returned with current status, taxes, etc.
202N/AOperation successful.Confirmation is necessary. Provide URL, SMS instructions and code number, or SMS message stating the confirmation is being sent to phone. cartStructure is not returned at this time. (Updated cartStructure is returned after purchase successfully completes.)
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10004Invalid Request: Invalid billing country or unsupported billing country.Occurs when the billing country syntax is invalid, such as 11, or the billing country is unsupported.
400CMR-30610Invalid Request: The payment type is not supported.The format of the payment type is invalid or the payment type is not supported by the Commerce Services or by this store.
400CMR-30615Invalid Request: The token is either missing or invalid.Application authorization is required. The access token must include 'profile:basic' access rights.
402CMR-10010Payment Information Required: Billing profile information is required to process the order.The billing information is invalid or insufficient to process the order.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10021Conflict: Maximum order total is reached.The order total exceeds 50,000 USD (that is, the total is equal to or greater than 50,000.01 USD or 41,000.01 EUR or 32,000.01 GBP).
409CMR-10023Conflict: Status of cart/order prevents the requested action.Occurs if: (1) Cart is ordered then a delete request is submitted. (2) Cart is ordered then an update request is submitted.
409CMR-10024Conflict: The maximum length of the line item is exceeded.The line item name exceeds the 100 character limit.
409CMR-30650Conflict: Minimum purchase price is not reached.The purchase price is below the supported minimum price.
409CMR-30652Conflict: The order total will be denied on the test systems.The total of your order matches the card processor value for denials on the test systems.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.
Sample JSON Response for Return Codes 200, 201
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0.12,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 1.99
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "P13","quantity": 2,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0.24,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 3.98
    }
],"cartId": "cf2bb891-1da0-473f-a01c-10cca01073ad","orderId": "cf2bb891-1da0-473f-a01c-10cca01073ad","userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","isTaxCalculated": 1,"billingCountry": "US","paymentType": "VISA","paymentTypeId": 2,"date": "2013-08-08T00:19:59Z","status": "order_completed","subtotal": 5.97,"orderTotal": 6.33,"taxTotal": 0.36,"refundSubtotal": 0,"refundTaxTotal": 0,"refundTotal": 0,"taxType": "sales"
}
}       
Notes
  • Using paymenttypeid is the recommended method of specifying the payment method.
  • If this payment type is different than the payment type used for the prior Get Cart Tax call, the tax is recalculated using the current payment type before processing.

Get Order

Get order information after purchase to obtain order history. Returns an instance of {cartStructure} for the specified {orderid}. Can be used to present details of order to the consumer.

The application must include the access token in the HTTP header and the order ID for the desired order in the URI:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/orders/{orderid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
orderidYesURIUnique identifier for the order you are requesting information on. (This is the same identifier as cart iD used to make the purchase.)
acceptYesRequest headerValue must be "application/json".
Example Usage
MethodGET
URLhttps://api.intel.com/test-commerce/v1/orders/6d1d2aa9-0059-4f64-93d8-894ea74800cf
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Body(see JSON Request below)
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.Order details are returned in cartStructure.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Not found. The order ID does not exist or is invalid. This can occur when: (1) An order does not exist, or (2) The application does not have access to an order.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
JSON Response
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "P14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0.12,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 1.99
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "P13","quantity": 2,"actualPrice": 1.99,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0.24,"refundQuantity": 0,"refundLineItemTax": 0,"refundExtendedPrice": 0,"extendedPrice": 3.98
    }
],"cartId": "cf2bb891-1da0-473f-a01c-10cca01073ad","orderId": "cf2bb891-1da0-473f-a01c-10cca01073ad","userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","isTaxCalculated": 1,"billingCountry": "US","paymentType": "VISA","paymentTypeId": 2,"date": "2013-08-08T00:19:59Z","status": "order_completed","subtotal": 5.97,"orderTotal": 6.33,"taxTotal": 0.36,"refundSubtotal": 0,"refundTaxTotal": 0,"refundTotal": 0,"taxType": "sales"
}
}       

Get Multiple Orders

Get a list of orders, where each entry in the list represents an order and includes ordernumber, date, status, total price, currency type, and the URL for each order. This call is used after a purchase to obtain order history. This call gets all the orders or orders for the specified user. This call enables filtering by dates allows results to be paged.

For application authorization, the call returns order information for all orders in the date range. For user authorization, the call includes a user ID from Intel Identity Services, which allows order history to be returned for a specific user.

This is an application authorization call, with the access token in the HTTP header and paging parameters in the URI:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/orders?start_date={YYYYMMDD}&end_date={YYYYMMDD}&$limit={limit}&$offset={offset}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a

This is a user authorization call, with the access token in the HTTP header, the user ID from Intel Identity Services, and the date range and paging parameters in the URI:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userid}/orders?start_date={YYYYMMDD}&end_date={YYYYMMDD}&$limit={limit}&$offset={offset}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
start_dateYesURIStart date for order information request in UTC format. Minimum start date is 20120101 (2012, January 1).
end_dateYesURIEnd date for order information request in UTC format. End date must be greater than or equal to the start date.
$limitNoURISpecifies the maximum number of orders to be returned in a page of results. Integer between 0 and 1,000; default if not specified is 500.
$offsetNoURISpecifies the page number to include in the results from the total available pages. Integer greater than 0; default if not specified is 0.
acceptYesRequest headerValue must be "application/json".
useridNoURIUser's identity from Intel Identity Services. The user must give the application access to their information for the user's identity to be available.
Example Usage

This is an application authorization call with start and end dates:

MethodGET
URLhttps://api.intel.com/test-commerce/v1/orders?start_date=20120801&end_date=20120831
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a

This is a user authorization call with user ID from Intel Identity Services and start and end dates:

MethodGET
URLhttps://api.intel.com/test-commerce/v1/users/{userid}/orders?start_date=20120901&end_date=20120830
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a

This is an application authorization call with start and end dates, and a $limit of 50 orders per result with an $offset of page zero (first page):

MethodGET
URLhttps://api.intel.com/test-commerce/v1/orders?start_date=20120801&end_date=20120831&$limit=50&$offset=0
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.JSON format is returned: order ID, date, status, total price, currency type, URI for each cart in the format https://api.intel.com/test-commerce/v1/orders/{orderid}
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10007Invalid Request: Date format is invalid.The date format is not valid or the start date is before the minimum start date of 20120101. (Format is YYYYMMDD.)
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10018Invalid Request: The value of the $limit or $offset is incorrect.Note that $limit must be an integer between 0 and 1,000. $offset must be an inter greater than 0.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
JSON Response
{"data": {"currentItemCount": 3,"totalItems": 3,"itemsPerPage": 500,"startIndex": 0,"nextLink": "https://api.intel.com/test-commerce/v1/users/23147cd5-6e47-46e4-8e93-59780b5bc15c/orders?start_date=20120701&end_date=20130807","previousLink": "https://api.intel.com/test-commerce/v1/users/23147cd5-6e47-46e4-8e93-59780b5bc15c/orders?start_date=20120701&end_date=20130807&$offset=0&$limit=500","pagingLinkTemplate": "https://api.intel.com/test-commerce/v1/users/23147cd5-6e47-46e4-8e93-59780b5bc15c/orders?start_date={start_date}&end_date={end_date}&$offset={offset}&$limit={limit}","kind": "orders","items": [
    {"cartId": "cf2bb891-1da0-473f-a01c-10cca01073ad","orderId": "cf2bb891-1da0-473f-a01c-10cca01073ad","userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","date": "2013-08-08T00:19:59Z","status": "order_completed","orderUrl": "https://api.intel.com/test-commerce/v1/orders/cf2bb891-1da0-473f-a01c-10cca01073ad","totalPrice": 6.33
    },
    {"cartId": "6fc0c94a-5f77-4d39-aa8b-27df7e2418f5","orderId": "6fc0c94a-5f77-4d39-aa8b-27df7e2418f5","userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","date": "2013-08-07T18:02:59Z","status": "order_completed","orderUrl": "https://api.intel.com/test-commerce/v1/orders/6fc0c94a-5f77-4d39-aa8b-27df7e2418f5","totalPrice": 5.29
    },
    {"cartId": "11b14285-8d90-498c-b9f0-706250bc6aca","orderId": "11b14285-8d90-498c-b9f0-706250bc6aca","userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","date": "2013-08-07T17:50:36Z","status": "order_completed","orderUrl": "https://api.intel.com/test-commerce/v1/orders/11b14285-8d90-498c-b9f0-706250bc6aca","totalPrice": 19.37
    }
]
}
}

Put Refund

Requests a full or partial refund on an order. This call is useful for developer Management CSubscription Callsonsole applications. The call to refund a full order must include the access token in the HTTP header, the order ID for the order to be refunded, and the path to /refundfullorder in the URI. No additional information is needed.

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/orders/{orderid}/refundfullorder
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Bodyn/a

The call to refund a partial order must include the access token in the HTTP header, the order ID for the order to be refunded, and the path to /refundpartialorder in the URI. The JSON request must include the refundLines object:

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/orders/{orderid}/refundpartialorder
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Body(see JSON Request below)
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
orderidYesURIUnique identifier for the order you are requesting a refund on. (This is the same value as the original cart ID.)
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
refundlineNoRequest bodyThis parameter is required for partial refunds. For partial refunds, refundline must contain a list of id and refundquantity. This parameter should not be included for full refunds.
Example Usage

The following call refunds a full order:

MethodPUT
URLhttps://api.intel.com/test-commerce/v1/orders/6d1d2aa9-0059-4f64-93d8-894ea74800cf/refundfullorder
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Bodyn/a

The following call refunds a partial order:

MethodPUT
URLhttps://api.intel.com/test-commerce/v1/orders/6d1d2aa9-0059-4f64-93d8-894ea74800cf/refundpartialorder
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Body(see JSON Request below)
JSON Request Containing refundLines Object for Partial Refund
js
{"data": {"kind": "refundLines","items": [
    {"id": 1,"refundQuantity": 0.5
    },
    {"id": 2,"refundQuantity": 2
    }
]
}
}

See cartStructure for definition and values for refundQuantity.

Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.Order was already refunded. This return value is not supported for partial refunds.
201N/AOperation successful.Refund was processed.
202N/AOperation successful.Confirmation is necessary. Provide URL. Cart structure is not returned in this case.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10002Invalid Request: Cart structure or refund structure is wrong.The cart or refund structure is incorrect, but there is no additional information to specify the cause of the error.
400CMR-60011Invalid Request: Order line item is not valid.Order line item is not found.
400CMR-60012Invalid Request: Invalid refund request.Order line refund amount is more than the amount that can be refunded.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
402CMR-10010Payment Information Required: Billing profile information is required to process the order.The billing information is invalid or insufficient to process the order.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Not found. The orderid does not exist or is invalid. This can occur when: (1) an order does not exist, or (2) the application does not have access to an order.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10023Conflict: Status of cart/order prevents the requested action.Occurs if (1) Cart is ordered then a delete request is submitted. (2) Cart is ordered then an update request is submitted.
409CMR-60061Conflict: Request of a refund past the date allowed for refunding.Orders have a limited number of days where a refund can be requested. The request for a refund is past the limit.
409CMR-60062Conflict: Request of a refund before the order has finished processing.Purchases must completely process before a refund can be requested. Typical processing time is between 1 hour and 24 hours.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.
JSON Response
js
{"data": {"kind": "cartLine","items": [
    {"id": 1,"name": "Some Name 1","externalProductCode": "PP14","quantity": 1,"actualPrice": 1.99,"commodityCode": "4323.120","listPrice": 1.99,"lineItemTax": 0.09,"extendedPrice": 1.99,"refundQuantity": 0.5,"refundLineItemTax": 0.05,"refundExtendedPrice": 1.00
    },
    {"id": 2,"name": "Some Name 2","externalProductCode": "PP13","quantity": 2,"actualPrice": 2.49,"commodityCode": "551115.400","listPrice": 2.99,"lineItemTax": 0.22,"extendedPrice": 4.98,"refundQuantity": 2,"refundLineItemTax": 0.22,"refundExtendedPrice": 4.98
    }
],"cartId": "6d1d2aa9-0059-4f64-93d8-894ea74800cf","orderId": "6d1d2aa9-0059-4f64-93d8-894ea74800cf","userId": "6a8eb2ad-e8d4-4ac7-aa27-9246bca9a025","currencyType": "USD","locale": "en","subtotal": 6.97,"isTaxCalculated": 1,"orderTotal": 7.28,"taxTotal": 0.31,"refundSubtotal": 5.98,"refundTaxTotal": 0.27,"refundTotal": 6.25,"billingCountry": "US","paymentType": "VISA","paymentTypeId": 4,"date": "2012-06-26T05:49:36Z","taxType": "sales","status": "partially_refunded"
}
}

Get Billing Profile

Get the billing profile associated with the specified user from Commerce Services.This call only returns those payment methods enabled in your store.

The application must include the access token in the HTTP header and the user ID from Intel Identity Services in the URI.

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session.
useridYesURIUser's identity from Intel Identity Services. The user must give the application access to their information for the user's identity to be available.
acceptYesRequest headerValue must be "application/json".
Example Usage
MethodGET
URLhttps://api.intel.com/test-commerce/v1/users/02cb74de-4401-4f54-beee-577cd09134a1
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.User's billing profile is returned with BillingCountry, BillingCurrency, PaymentType, and ConfirmationType.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
JSON Response
{"data": {"kind": "billingProfiles","items": [
    {"billingCountry": "US","billingCurrency": "USD","paymentType": "VISA","paymentTypeId": 5,"confirmationType": "cfm_typ_none","preferredPayment": 1
    },
    {"billingCountry": "DE","billingCurrency": "EUR","paymentType": "MSCD","paymentTypeId": 11,"confirmationType": "cfm_typ_none","preferredPayment": 0
    }
]
}
}
Billing Profile Response

The Billing Profile Response is returned by the Get Billing Profile call. The following table lists the elements of this response.

PARAMETERSDescription
billingCountryBilling country code. Follows ISO 3166-1 alpha-2 format.
billingCurrencyCurrency to use for billing in ISO 4217 format. See Currency, Currency Codes, and Location Support table above.
paymentTypePayment type to use for calculating the tax or making the purchase. Examples: a string such as "VISA" or "AMEX". May be an empty string.
paymentTypeIdThis number uniquely identifies a payment method. This is a more precise way to specify the method of payment than paymentType in cases where more than one card of the same paymentType exists (for example, two VISA cards).
confirmationTypeIdReserved for future use.
preferredPaymentBoolean: 1=this payment type is the preferred type; 0=this payment type is not the preferred payment type. (For Billing Profiles with more than one payment type included, only one can be the preferred payment type.)

Subscription Calls

Subscription Status Codes

Subscription Tables

Subscription Structure

subscriptionStructure is a structure used in JSON Requests and Responses for subscription calls. The following table lists the elements of subscriptionStructure. Not every field appears in every JSON Request or Response. (Many of the fields have identical counterparts as cartStructure).

PARAMETERSREQUIRED?INPUT/OUTPUTDESCRIPTION
subscriptionIdNoOutput
Input
First returned when a subscription is created. Then used as input for many other subscription calls.
billingPeriodYesInput/OutputThis code specifies the billing period. Valid values are: "monthly" or "annual".
billingTypeYesInput/OutputThis code specifies the billing type. Valid values are: "prepay".
startDateYesInput/OutputThis code specifies the starting date for the subscription. Valid values are dates after equal to or later than the current date when the call is made. Valid format is UTC (YYYYMMDD) and "Immediate". Dates follow RFC 3339 (ISO 8601) format. If "Immediate", then the subscription starts now and the user must pay immediately.
maxNumberPeriodsYesInput/OutputAn integer greater than or equal to 1 that specifies the number of billingPeriods that the subscription is active. If -1 is specified as an input, the subscription will be active continuously until canceled. For continuous subscriptions, this field will be blank in JSON output. Must be less than 2,147,483,647.
lastBilledDateNoOutputThe date on which the subscription was last billed. Valid format is UTC (YYYYMMDD).
lastBilledPeriodNoOutputThe billing period on which the subscription was last billed; same as the total number of billing periods to date.
nextBillingDateNoOutputThe next date that the subscription is billed.
storeIdNoOutputThe ID of the store associated with the subscription.
attemptFailuresNoOutputThe number of failed billing attempts for the subscription.
statusNoOutputThe current status of the subscription. See Subscription Status Codes for valid values and their meaning.
productNameYesInput/OutputLine item name to appear in invoices for a subscription. Maximum number of characters is 100.
productCodeYesInput/OutputProvided for developers to use for their own product codes for a subscription. Maximum number of characters is 100.
commodityCodeYesInputCommodity code used to identify tax rate. These are predefined UNSPSC (United Nations Standard Products and Service Code) values that apps must use for proper taxation on transactions. See the Commodity Codes table for supported codes and their meaning.
listPriceYesInput/OutputList price of the subscription. Must be equal to or greater than actualPrice. See notes below for valid values.
actualPriceYesInput/OutputActual price of subscription. Must be equal to or less than listPrice. VAT inclusive but US tax exclusive. See notes below for valid values.
subtotalNoOutputSum of actualPrice of all subscriptionId items. See notes below for valid values.
taxTotalNoOutputTotal of all taxes for all subscriptionId items. See notes below for valid values.
orderTotalNoOutputSum of subtotal and taxTotal. See notes below for valid values. See Payment Types, Payment Codes, and Maximum Amounts table below for payment types, codes, and maximum purchase limits.
refundQuantityNoOutputQuantity of subscriptions being refunded.
refundSubtotalNoOutputSubtotal of the refund for the subscription.
refundTaxNoOutputTax for refundSubtotal.
refundTotalNoOutputSum of refundSubtotal and refundTax. See notes below for valid values.
userIdNoOutputThe userId of the user associated with the subscription.
currencyTypeYesInput/OutputCurrency of item prices in cart in ISO 4217 format. See Currency, Currency Codes, and Location Support table for valid codes and their meaning.
localeYesInput/OutputLocale of subscriptions / descriptions / email templates related to a given subscription in RFC 5646 format. See Locale Codes and Locales table below.

Notes

  • Prices are decimal numbers with two or fewer decimal places.
  • When using decimals, use a period as the decimal separator not a comma.

Subscription Status Codes

Post Subscription

STATUSDESCRIPTION
pendingSubscription has been created, but is not active yet.
activeSubscription is active.
billerrorAn error occurred during when processing billing.
errordoneAn error was detected on 3 sequential billing attempts. No more billing attempts will be made. (The Intel Commerce Services store administrator is notified when this occurs so they can pursue a resolution.)
doneOrder was completed for the subscription.
deletedSubscription was cancelled.

Example JSON subscriptionStructure

{"subscriptionId": "12345678-1234-1234-1234-123456789ABD","billingPeriod": "monthly","billingType": "prepay","startDate": "20130601","maxNumberPeriods": 12,"lastBilledDate": "20130801","nextBillingDate": "20131001","attemptFailures": 0,"status": "billerror","storeId": "eb02432d-6a90-68df-bceb-69590bbb171a","productName": "Dan Barry's Recipes","productCode": "MAG-DB0235","commodityCode": "4323.120","listPrice": 2.99,"actualPrice": 1.99,"userId": "6a9068df-eb02-432d-bceb-b171a69590bc","currencyType": "USD","locale": "en","refundQuantity": 0,"refundSubtotal": 0,"refundTax": 0,"refundTotal": 0
}

Post Subscription

Creates a new subscription in Commerce Services for the specified user. New subscriptions are created with a pending status and must be activated within 24 hours via a subsequent Put Subscription call.

The JSON request supports attributes to specify the start date and to define the subscription period or create a continuous subscription.

MethodPOST
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userid}/subscriptions
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Body(see JSON Request below)
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session. For this call, the access token must be a user authorization access token.
useridYes The userId of the user associated with the subscription; from Intel Identity Services. The user must give the application access to their information for the user's identity to be available.
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
subscriptionStructureYesRequest bodyThis call requires a valid subscriptionStructure in the body.
Example Usage
MethodPOST
URLhttps://api.intel.com/test-commerce/v1/users/{userid}/subscriptions
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Body(see JSON Request below)
JSON Request

One-year monthly subscription with future start date (assume call is made before December 1, 2013).

js
{"productName": "Dan Barry's Recipes","productCode": "MAG-DB0235","commodityCode": "4323.120","listPrice": 2.99,"actualPrice": 1.99,"billingPeriod": "monthly","startDate": "20131201","maxNumberPeriods": 12,"billingType": "prepay","currencyType": "USD","locale": "en"
}

One-year monthly subscription with immediate start date; billing date occurs monthly on same day as start day.

js
{"productName": "Dan Barry's Recipes","productCode": "MAG-DB0235","commodityCode": "4323.120","listPrice": 2.99,"actualPrice": 1.99,"billingPeriod": "monthly","startDate": "Immediate","maxNumberPeriods": 12,"billingType": "prepay","currencyType": "USD","locale": "en"
}
Response Codes
HTTP CodeService Error CodeMessageDescription
201N/AOperation successful.Subscription was created. Updated subscriptionStructure is returned the JSON response.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10001Invalid Request: Prices must be positive values, contain only 2 or fewer decimal places. When using decimals, use a period as the decimal separator not a comma.The Price is not formatted correctly. For example, the actualPrice is 0.999.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10004Invalid Request: Invalid billing country or unsupported billing country.Occurs when the billing country syntax is invalid, such as 11, or the billing country is unsupported.
400CMR-10005Invalid Request: Currency type is invalid or unsupported.The format of the currency type is invalid, such as USX, or the currency type is unsupported, such as CAD.
400CMR-10006Invalid Request: Locale is invalid or unsupported.The format of the locale is invalid, such as "ex", or is unsupported, such as "he" (Hebrew).
400CMR-10007Invalid Request: Date format is invalid.The date format is not valid or the start date is before the minimum start date of 20120101. (Format is YYYYMMDD.)
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10031Invalid Request: Subscription structure or subscription refund structure is invalid.The subscription / subscription refund structure is incorrect and a more detailed error cannot be provided.
400CMR-10032Invalid Request: Product name is missing or exceeds the maximum length.The product name is mandatory and the limit is 100 characters.
400CMR-10033Invalid Request: Product code is missing or exceeds maximum length.The product code is mandatory and the limit is 100 characters.
400CMR-10034Invalid Request: Billing period is invalid.Billing period is invalid. Valid values are "monthly" or "yearly".
400CMR-10035Invalid Request: Start date format is invalid.Valid dates must be later than today and in YYYYMMDD format or "immediate".
400CMR-10036Invalid Request: Maximum billing period is invalid.The valid maximum number period is -1 or a positive integer number.
400CMR-10037Invalid Request: Billing type is invalid.Billing type is invalid. The only valid type is "prepay".
404CMR-10015Not Found: The commodity code is invalid.The commodity code is not one of the approved commodity codes.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10024Conflict: The maximum length of the line item is exceeded.The line item name exceeds the 100 character limit.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.
Sample JSON Response
{"subscriptionId": "172e89c1-b0c0-4188-81e6-d3cea0dfb722","billingPeriod": "monthly","billingType": "prepay","startDate": "20131201","maxNumberPeriods": 12,"lastBilledDate": "","lastBilledPeriod": 0,"nextBillingDate": "20131201","attemptFailures": 0,"status": "pending","storeId": "H0jaWh3JiN6x9OpVD7Ydb52pvENHyjG6","productName": "Dan Barry's Recipes","productCode": "MAG-DB0235","commodityCode": "4323.120","listPrice": 2.99,"actualPrice": 1.99,"currencyType": "USD","locale": "en","subtotal": 1.99,"taxTotal": 0.12,"orderTotal": 2.11
}       

Note: Subscriptions that are not activated within 24 hours of being created are deleted from the Commerce Services system.

Put Subscription

Activates a subscription previously created using the Post Subscription call. This call must be executed within 24 hours to activate the subscription created by a previous Post call. Once activated, billing (that is, payment processing) occurs regularly based on the billing date for the subscription.

The start date and subscription period were previously defined by the JSON Request for the Post Subscription call.

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/subscriptions/{subscriptionid}/purchase
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session. For this call, the access token must be a user authorization access token.
subscriptionidYesURIUnique identifier for the subscription to be activated. The subscription ID is created via the Post Subscription call.
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
Example Usage
MethodPUT
URLhttps://api.intel.com/test-commerce/v1/subscriptions/{subscriptionid}/purchase
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Scopes Already Grantedprofile:basic, billing:confirm, user:scope, user:details
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.Subscription was already activated.
201N/AOperation successful.Subscription was successfully activated. Updated subscriptionStructure is returned the JSON response.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-30615Payment Information Required: Billing profile information is required to process the order.User authorization is required. The access token must include the following access rights: 'profile:basic', 'billing:confirm', 'user:details', and 'user:scope'.
402CMR-10010Payment Information Required: Billing profile information is required to process the order.The billing information is invalid or insufficient to process the order.
404CMR-10038Not Found: The subscription ID is invalid or the subscription was not found.Either the subscription does not exist or the app does not have access to the subscription.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10021Conflict: Maximum ordertotal is reached.The order total exceeds 50,000 USD (that is, the total is equal to or greater than 50,000.01 USD or 41,000.01 EUR or 32,000.01 GBP).
409CMR-10040Conflict: Status of subscription prevents the requested action.Occurs if the subscription is completed, deleted, or has an error status like: billerror or errordone.
409CMR-10041Conflict: Activation must occur with 24 hours of creation.The requested activation is past the 24-hour time window since the original POST Subscription call.
409CMR-30650Conflict: Minimum purchase price is not reached.The purchase price is below the supported minimum price.
409CMR-30652Conflict: The order total will be denied on the Test systems.The order total matches the card processor's amount for denials on Test systems. (Some card processors define specific amounts for testing error logic; these amounts will generate errors during testing.)
Sample JSON Response
js
{"subscriptionId": "172e89c1-b0c0-4188-81e6-d3cea0dfb722","billingPeriod": "monthly","billingType": "prepay","startDate": "20131201","maxNumberPeriods": 12,"lastBilledDate": "","lastBilledPeriod": 0,"nextBillingDate": "20131201","attemptFailures": 0,"status": "active","storeId": "H0jaWh3JiN6x9OpVD7Ydb52pvENHyjG6","productName": "Dan Barry's Recipes","productCode": "MAG-DB0235","commodityCode": "4323.120","listPrice": 2.99,"actualPrice": 1.99,"currencyType": "USD","locale": "en","subtotal": 1.99,"taxTotal": 0.12,"orderTotal": 2.11,"refundQuantity": 0,"refundSubtotal": 0,"refundTax": 0,"refundTotal": 0
}
Notes
  • Initial billing occurs based on the future date of startDate. If startDate is set to immediate, the billing occurs immediately upon activation.
  • Billing for activated subscriptions occurs periodically based on the billingdate for the subscription.
  • The payment for subscriptions uses the same payment processor used for the Put/Post Cart Purchase calls.
  • Subscriptions that are not activated within 24 hours of being created are deleted from the Commerce Services system.

Get Subscriptions

Gets information on the subscriptions specified in the call. Subscriptions can be queried based on billing date, the start and end date, a specific user, a specific status, or for a combination of attributes. This call enables results to be paged.

Two versions of the call are supported. The first version specifies a specific billing date:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/subscriptions/billingdate/{YYYYMMDD}?$limit={limit}&$offset={offset}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a

The second version of the call specifies start_date and end_date with an optional userId:

MethodGET
URL Structurehttps://api.intel.com/test-commerce/v1/users/{userId}/subscriptions?start_date={YYYYMMDD}&end_date={YYYYMMDD}&status={status}$limit={limit}&$offset={offset}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session. For this call, the access token can be an authorization or user authorization access token.
*Must contain either billingdate or start_date/end_date but not both.
billingdate*YesURISpecifies the billing date to query on. Date must be in UTC format. The response includes a list of all subscriptions billed or to be billed on that date.
useridNoURIThe userId of the user associated with the subscription(s); from Intel Identity Services. The user must give the application access to their information for the user's identity to be available.
start_date*YesURISpecifies the starting date for a date range. Date must be in UTC format. Earliest allowed date is January 1, 2012. Subscriptions created, to be billed, or were actually billed within the date range will be included in the response.
end_date*YesURISpecifies the ending date for a date range. Date must be in UTC format. Subscriptions created, billed, or to be billed within the date range are included in the response.
statusNoURISpecifies the status of the subscriptions to be included in the query. Can be used to further limit the subscriptions returned in the response.
$limitNoURISpecifies the maximum number of subscriptions to be returned in a page of results. Integer between 0 and 1,000; if not specified, the default is 500.
$offsetNoURISpecifies the page number to include in the results from the total available pages. Integer greater than 0; if not specified, the default is 0.
acceptYesRequest headerValue must be "application/json".
Example Usage

Specifies a billing date:

MethodGET
URLhttps://api.intel.com/test-commerce/v1/subscriptions/billingdate/20130716
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a

Specifies the start date, end date, status, page size, and page offset:

MethodGET
URLhttps://api.intel.com/test-commerce/v1/subscriptions?start_date=20130601&end_date=20130831&status=active$limit=30&$offset=3
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
200N/AOperation successful.The structure for the specified subscription was returned. See below for example.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10007Invalid Request: Date format is invalid.The date format is not valid or the start date is before the minimum start date of 20120101. (Format is YYYYMMDD.)
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10018Invalid Request: The value of the $limit or $offset is incorrect.Check the values of $limit and $offset and correct them.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
Sample JSON Response
{"data": {"currentItemCount": 3,"totalItems": 3,"itemsPerPage": 500,"startIndex": 0,"nextLink": "https://api.intel.com/test-commerce/v1/users/23147cd5-6e47-46e4-8e93-59780b5bc15c/subscriptions?start_date=20130601&end_date=20130808&_=1375973748929","previousLink": "https://api.intel.com/test-commerce/v1/users/23147cd5-6e47-46e4-8e93-59780b5bc15c/subscriptions?start_date=20130601&end_date=20130808&status=&$limit=500&$offset=0","pagingLinkTemplate": "https://api.intel.com/test-commerce/v1/users/23147cd5-6e47-46e4-8e93-59780b5bc15c/subscriptions?start_date={start_date}&end_date={end_date}&status={status}&$limit={limit}&$offset={offset}","kind": "subscriptions","items": [
    {"subscriptionId": "172e89c1-b0c0-4188-81e6-d3cea0dfb722","billingPeriod": "monthly","billingType": "prepay","startDate": "20131201","maxNumberPeriods": 12,"lastBilledDate": "","lastBilledPeriod": 0,"nextBillingDate": "","attemptFailures": 0,"status": "deleted","storeId": "H0jaWh3JiN6x9OpVD7Ydb52pvENHyjG6","productName": "Dan Barry's Recipes","productCode": "MAG-DB0235","commodityCode": "4323.120","listPrice": 2.99,"actualPrice": 1.99,"userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","refundQuantity": 0,"refundSubtotal": 0,"refundTax": 0,"refundTotal": 0
    },
    {"subscriptionId": "afe95886-9fd8-461c-b79b-ee9c3ff82488","billingPeriod": "monthly","billingType": "prepay","startDate": "20131101","maxNumberPeriods": 12,"lastBilledDate": "","lastBilledPeriod": 0,"nextBillingDate": "20131101","attemptFailures": 0,"status": "active","storeId": "H0jaWh3JiN6x9OpVD7Ydb52pvENHyjG6","productName": "Saurabh's World Music Monthly","productCode": "MAG-SB0141","commodityCode": "4323.120","listPrice": 3.99,"actualPrice": 2.99,"userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","refundQuantity": 0,"refundSubtotal": 0,"refundTax": 0,"refundTotal": 0
    },
    {"subscriptionId": "dcba8081-da9e-4080-afd3-76c5783ed68c","billingPeriod": "monthly","billingType": "prepay","startDate": "20131201","maxNumberPeriods": 12,"lastBilledDate": "","lastBilledPeriod": 0,"nextBillingDate": "20131201","attemptFailures": 0,"status": "active","storeId": "H0jaWh3JiN6x9OpVD7Ydb52pvENHyjG6","productName": "Dan Barry's Recipes","productCode": "MAG-DB0235","commodityCode": "4323.120","listPrice": 2.99,"actualPrice": 1.99,"userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","refundQuantity": 0,"refundSubtotal": 0,"refundTax": 0,"refundTotal": 0
    }
]
}
}       

Put Subscription Refund

Refunds the specified subscription or part of the subscription.

MethodPUT
URL Structurehttps://api.intel.com/test-commerce/v1/subscriptions/{subscriptionid}/refund
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Content-Type:{contenttype}
Body(see JSON Request below for refund quantity)
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session. For this call, the access token can be an application or user authorization access token.
subscriptionidYesURIUnique identifier for the subscription to process a refund against.
acceptYesRequest headerValue must be "application/json".
contenttypeYesRequest headerValue must be "application/json".
Example Usage
MethodPUT
URLhttps://api.intel.com/test-commerce/v1/subscriptions/{subscriptionid}/refund
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Content-Type:application/json
Body(see JSON Request below for refund quantity)
JSON Request
{"refundQuantity": 0.5
}
Response Codes
HTTP CodeService Error CodeMessageDescription
201N/AOperation successful.Refund was successfully applied. subscriptionStructure is returned with response.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10002Invalid Request: Cart structure or refund structure is wrong.The cart or refund structure is incorrect, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-60012Invalid Request: Invalid refund request.Order line refund amount is more than amount remaining which can be refunded.
402CMR-10010Payment Information Required: Billing profile information is required to process the order.The billing information is invalid or insufficient to process the order.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order.
409CMR-10023Conflict: Status of cart/order prevents the requested action.Occurs if: (1) Cart is ordered then a delete request is submitted. (2) Cart is ordered then an update request is submitted.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-60061Conflict: Request of a refund past the date allowed for refunding.Orders have a limited number of days where a refund can be requested. The request for a refund is past this date.
409CMR-60062Conflict: Request of a refund before the order has finished processing.Purchases must completely process before a refund can be requested. Typical wait time before a refund can be requested is between 1 hour and 24 hours.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.
Sample JSON Response
{"subscriptionId": "7b9021b7-73d7-42c1-aa90-0e79abaddf31","billingPeriod": "monthly","billingType": "prepay","startDate": "20130808","maxNumberPeriods": 12,"lastBilledDate": "20130808","lastBilledPeriod": 1,"nextBillingDate": "20130908","attemptFailures": 0,"status": "active","storeId": "H0jaWh3JiN6x9OpVD7Ydb52pvENHyjG6","productName": "Environment Vista Monthly","productCode": "MAG-114","commodityCode": "4323.120","listPrice": 1.99,"actualPrice": 0.99,"userId": "23147cd5-6e47-46e4-8e93-59780b5bc15c","currencyType": "USD","locale": "en","refundQuantity": 0.5,"refundSubtotal": 0.5,"refundTax": 0.03,"refundTotal": 0.53
}       

Cancel Subscription by ID

Cancels the subscription specified by the subscription ID:

MethodDELETE
URL Structurehttps://api.intel.com/test-commerce/v1/subscriptions/{subscriptionid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:{accept}
Bodyn/a
Input Parameters
PARAMETERSRequired?Input TypeDescription
access_tokenYesRequest headerUnique access token for the current session. For this call, the access token can be an application or user authorization access token.
subscriptionidYesURIUnique identifier for the subscription to be cancelled.
acceptYesRequest headerValue must be "application/json".
Example Usage
MethodDELETE
URLhttps://api.intel.com/test-commerce/v1/subscriptions/{subscriptionid}
Headers
KeyValue
Authorization: Bearer{access_token}
Accept:application/json
Bodyn/a
Response Codes
HTTP CodeService Error CodeMessageDescription
204N/AOperation successful.Subscription was successfully deleted.
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
404CMR-10038Not Found: The product code is invalid or the subscription with the given product code was not found.Either the product code does not exist or developer does not have access to this subscription with the given product code.
404CMR-10039Not Found: The subscription id is invalid or the subscription was not found.Either the subscription does not exist or the app does not have access to the subscription.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.

Billing Profile Page

Users must set up a billing profile in Commerce Services before making purchases. Commerce Services accesses this profile as needed to calculate taxes, complete a purchase, or process a refund.

When an app detects that no billing profile exists, the app can forward the user to a Commerce Services page to create their billing profile. The Billing Profile page screens allow users to add payment methods. The base URIs for Billing Profile pages for testing vs. production use are as follows:

Testing URI:

https://test-commerce.intel.com/profile/billingprofile.aspx?apikey={client_id}&cartid={cartid}

 

Production URI:

https://commerce.intel.com/profile/billingprofile.aspx?apikey={client_id}&cartid={cartid}

 

You must include your client_id in the URL as the value for apikey. Some basic information is already filled in from the user's Intel Identity Services account, after they approve sharing of their information with the Billing Profile page. The user must complete the remaining Billing Profile's required fields and include at least one payment method.

Note: Developers must ensure through their own testing that the Success, Fail, and Callback URLs associated with the Billing Profile page are working URLs. Commerce Services does not validate these links. All callback URLs in the call must be fully qualified and start with http:// or https://.

Example using parameters:

https://test-commerce.intel.com/profile/billingprofile.aspx?apikey=8e9df53c-d28f-11e1-bd04-0050568c00f9&cartid={cartid}&success_url=https://testapp.greatapps.com/intelbilling/success.aspx&locale=en&error_url=https://testapp.greatapps.com/intelbilling/error.aspx&locale=en&code&error&callback_function=https://testapp.greatapps.com/intelbilling/callfunction.aspx&locale=en

 

Example success:

https://test-commerce.intel.com/profile/error.aspx?code=200&message=

 

Example fail:

https://test-commerce.intel.com/profile/error.aspx?code=CMR-80014&message=Locale+is+unsupported+or+invalid

 

Example using a non-English locale:

https://test-commerce.intel.com/profile/billingprofile.aspx?apikey=8e9df53c-d28f-11e1-bd04-0050568c00f9&cartid={cartid}&success_url=https://testapp.greatapps.com/intelbilling/success.aspx&locale:de&error_url=https://testapp.greatapps.com/intelbilling/error.aspx&locale:de&code&error&callback_function=https://testapp.greatapps.com/intelbilling/callfunction.aspx&locale=de
Input Parameters
PARAMETERSRequired?Input TypeDescription
apikeyYesURIThe unique client_id for the app. (Your Commerce Services store is associated with this client_id.)
successurlNoURIRedirect URL if payment was successfully authorized.
errorurlNoURIRedirect URL if the payment was not successfully authorized.
localeNoURIBrowser locale is the default if this parameter is not passed. "en" is the default if the browser does not pass a locale. See the Locales and Locale Codes table for supported locales.
callbackurlNoURICallback URL to redirect the user prior to using the Success or Error URLs above.
cartidNoURIWhen Cart ID is included, the Billing Profile Page lists the names and prices of the items in the cart in addition to the user's billing profile information.
Output Parameters
PARAMETERSDescription
errorcodeCMR-{unique_error_code}, where {unique_error_code} is a unique error code. See Error Codes below.
errormessageA very brief description of the code meaning. See the Response Codes table below.
Response Codes
Error CodeMessageDescription
CMR-80000GENERIC_ERRORUnexpected error during Billing Profile access.
CMR-80001INVALID_USERInvalid user ID.
CMR-80003INVALID_PROFILE_IDInvalid profile ID.
CMR-80004INVALID_PAYMENT_TYPEInvalid payment type.
CMR-80005INVALID_EXPIRATION_DATEInvalid expiration date.
CMR-80006INVALID_USER_PAYMENT_METHODInvalid user payment method.
CMR-80007INVALID_COUNTRY_CODEInvalid country code or not valid strings (non-existent Country Code).
CMR-80008INVALID_MERCHANT_IDInvalid merchant ID.
CMR-80009INVALID_ARGUMENTSInvalid arguments.
CMR-80010INVALID_DATE_TIMEInvalid transaction date time.
CMR-80011BILLING_PROFILE_NOT_FOUNDThe Billing Profile not found.
CMR-80012INVALID_API_KEYYour APIKey (client ID) is not provided or is invalid.
CMR-80013STORE_NOT_FOUNDThere is no store associated with the APIKey.
CMR-80014INVALID_LOCALEThe locale is unsupported or invalid.
CMR-80015PAYMENT_PROCESSING_ERRORThere was an error with the billing information at the payment processor.
CMR-80016PAYMENT_PROCESSING_ERRORThere was a problem at the payment processor.
CMR-80017INVALID_DATALegal restrictions prevent us from fulfilling the request.
CMR-80018GENERIC_ERRORGeneral Commerce Services error.
CMR-80019PAYMENT_PROCESSING_ERRORThere was a problem at the payment processor as this transaction was determined to be a high fraud risk.

Note: The Billing Profile page with no cart item contents is displayed by default when the Cart ID is not present or is incorrect, or when the cart is associated with a different user than the current user.

Error Handling

When errors are detected during an API call, an HTTP error is returned with detailed error information in the body of the JSON response. The following example shows one possible error message for HTTP Error 400:

{"error" : {"code": "CMR-10023","message": "Conflict: Status of cart/order prevents the requested action.","requestId": "c962fe29-d4e8-11e1-bd04-0050568c00f9"
}
}

Commerce Services error messages start with a CMR- prefix. If you see a different prefix, or no prefix, the error was returned by other services, such as Intel Identity Services.

Commerce Services REST Error Messages
HTTP Error/CodeService Error CodeMessageDescription
400CMR-10000Invalid Request: Generic ErrorAn error occurred, but there is no additional information to specify the cause of the error.
400CMR-10001Invalid Request: Prices must be positive values, contain only 2 or fewer decimal places. When using decimals, use a period as the decimal separator not a comma.The Price is not formatted correctly, such as actualPrice: 0.999.
400CMR-10002Invalid Request: Cart structure or refund structure is wrong.The cart or refund structure is incorrect, but there is no additional information to specify the cause of the error.
400CMR-10003Invalid Request: User ID is invalid.The format of the user ID is invalid.
400CMR-10004Invalid Request: Invalid billing country or unsupported billing country.Occurs when the billing country syntax is invalid, (for example, 11) or the billing country is unsupported.
400CMR-10005Invalid Request: Currency type is invalid or unsupported.The format of the currency type is invalid, such as USX (instead of USD), or when the currency is not supported. See Currency, Currency Codes, and Location Support table for valid values and their meaning.
400CMR-10006Invalid Request: Locale is invalid or unsupported.The format of the locale is invalid, such as ex, or is unsupported, such as he (Hebrew).
400CMR-10007Invalid Request: Date format is invalid.The date format is not valid or the start date is before the minimum start date of 20120101. (Format is YYYYMMDD.)
400CMR-10008Invalid Request: The store is not configured.Your store must be present in the system to execute this operation and be configured for currencies, countries, and payment methods.
400CMR-10009Invalid Request: Either the store is not configured or there exists an invalid value for billing country or currency or locale type.May be generated by invalid data or by the store not being present in the system. The store must also be configured for currencies, countries, and payment methods.
400CMR-10018Invalid Request: The value of the $limit or $offset is incorrect.Check the values of $limit and $offset and correct them.
400CMR-10031Invalid Request: Subscription structure or subscription refund structure is invalid.The subscription / subscription refund structure is incorrect and a more detailed error cannot be provided.
400CMR-10032Invalid Request: Product name is missing, invalid, or exceeds the maximum length.The product name is mandatory and the limit is 100 characters. The product name cannot contain the symbols < or >.
400CMR-10033Invalid Request: Product code is missing, invalid, or exceeds maximum length.The product code is mandatory and the limit is 100 characters.The product name cannot contain the symbols < or >.
400CMR-10034Invalid Request: Billing period is invalid.Billing period is invalid. It must be monthly or yearly.
400CMR-10035Invalid Request: Start date format is invalid.Valid dates must be later than today and in YYYYMMDD format or immediate.
400CMR-10036Invalid Request: Maximum billing period is invalid.The valid maximum number period is -1 or a positive integer number.
400CMR-10037Invalid Request: Billing type is invalid.Billing type is invalid and currently accepts only prepay.
400CMR-30310Invalid Request: Status is not recognized.The status of the cart is not a valid value.
400CMR-30610Invalid Request: The payment type is not supported.The format of the payment type is invalid or the payment type is not supported.
400CMR-30615Invalid Request: The token is either missing or invalid.Application authorization is required. The access token must include profile:basic access rights.
400CMR-60011Invalid Request: Order line item is not valid.Order line item is not found.
400CMR-60012Invalid Request: Invalid refund request.Order line refund amount is more than amount remaining that can be refunded.
402CMR-10010Payment Information Required: Billing profile information is required to process the order.The billing information is invalid or insufficient to process the order.
404CMR-10015Not Found: The commodity code is invalid.The commodity code is not one of the approved commodity codes.
404CMR-10016Not Found: The cart/order ID or the cart/order was not found.Either the cart/order does not exist or the app does not have access to the cart/order. Can also appear with regard to subscriptions.
404CMR-10017Not Found: The user ID is not valid.The user does not exist in the system. (Not a format issue.)
404CMR-10038Not Found: The subscription id is invalid or the subscription was not found.Either the subscription does not exist or the app does not have access to the subscription.
404CMR-10039Not Found: The product code is invalid or the subscription with the given product code was not found.Either the product code does not exist or developer does not have access to this subscription with the given product code.
406CMR-10020Not acceptable.The message format requested for the client response is not supported.
409CMR-10021Conflict: Maximum ordertotal is reached.The order total exceeds 50,000 USD (that is, the total is equal to or greater than 50,000.01 USD or 41,000.01 EUR or 32,000.01 GBP).
409CMR-10022Conflict: The maximum line item number is reached.The number of line items exceeds the 100 line item limit.
409CMR-10023Conflict: Status of cart/order prevents the requested action.Occurs if: (1) Cart is ordered then a delete request is submitted. (2) Cart is ordered then an update request is submitted. Can also appear with regard to subscriptions.
409CMR-10024Conflict: The maximum length of the line item is exceeded.The line item name exceeds the 100 character limit.
409CMR-10040Conflict: Status of subscription prevents the requested action.Occurs if the subscription is completed, deleted, or has an error status like: billerror or errordone.
409CMR-10041Conflict: Activation must occur with 24 hours of creation.The requested activation is past the 24-hour time window since the original POST Subscription call.
409CMR-30650Conflict: Minimum purchase price is not reached.The purchase price is below the supported minimum price.
409CMR-60061Conflict: Request of a refund past the date allowed for refunding.Orders have a limited number of days where a refund can be requested. The request for a refund is past this date.
409CMR-60062Conflict: Request of a refund before the order has finished processing.Purchases must completely process before a refund can be requested. Typical processing time is between 1 hour and 24 hours.
415CMR-10030Unsupported Media Type.The message format from the client is currently not supported.

Legal Information

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS.

Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.

The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.

Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.

Intel, the Intel logo, and Intel Identity Services are trademarks of Intel Corporation in the U.S. and/or other countries.

* Other names and brands may be claimed as the property of others.

Copyright © 2013-2014, Intel Corporation. All rights reserved.


Viewing all articles
Browse latest Browse all 3384

Trending Articles