---
schema_version: "1"
id: 941a91fa00f35cfa05e42be4f477152c783a504b783d41205a27ec39c0ec37c0
title: Point of Sale SPI Error Handling
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/retail-cloud/guides/retail-cloud-spi-error-handling.md
canonical_url: https://developer.salesforce.com/docs/commerce/retail-cloud/guide/retail-cloud-spi-error-handling.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 45c829cb036bad065aa64af13c5507058e7a886cd5d55f6d610e58f7d365ff62
products:
  - Point of Sale for Developers
  - Salesforce APIs
---
# Point of Sale SPI Error Handling

In case of an error, the APIs should return an error response in JSON format consisting of error code and error message. Supported error types for each of the SPI APIs are outlined in the following sections. Also, the HTTP response status code for all error responses should be set accordingly.

Valid Error Responses - Error messages should be i18n version of the string based on region and local of the app request.

HTTP/1.1 400 Exception Condition

## Account

```json
{
  "errorType": "CREATE_ACCOUNT_FAILURE",
  "errorMessage": "USer Registraion failed"
}

{
  "errorType": "INVALID_LOGIN",
  "errorMessage": "Invalid Credentials"
}

{
  "errorType": "SESSION_EXPIRED",
  "errorMessage": "User session expired"
}

{
  "errorType": "UPDATE_ACCOUNT_FAILURE",
  "errorMessage": "Updating user account failed"
}
```

## Cart

```json
{
  "errorType": "PRODUCT_UNAVAILABLE",
  "errorMessage": "{ProductID} : Product 1234567890 is unavailable"
}

{
  "errorType": "CART_CREATE_FAILURE,
  "errorMessage": "Cart creation failed due to {}"
}

{
  "errorType": "CART_READ_FAILURE",
  "errorMessage": "Cart {} could not be retrieved"
}
```

## Checkout

```json
{
  "errorType": "INVALID_COUPON_CODE",
  "errorMessage": "Invalid coupon code"
}

{
  "errorType": "SHIPPING_TO_COUNTRY_NOT_ALLOWED",
  "errorMessage": "Cannot ship to country {CountryName}"
}

{
  "errorType": "CHECKOUT_FAILURE",
  "errorMessage": "Checkout failure due to {}"
}

{
  "errorType": "BILLING_TO_COUNTRY_NOT_ALLOWED",
  "errorMessage": "Cannot bill country {}"
}

{
  "errorType": "CARD_VALIDATION_FAILURE",
  "errorMessage": "Credit card validation failed"
}

{
  "errorType": "PAYMENT_NOT_AUTHORIZED",
  "errorMessage": "Credit card authorization failed"
}

{
  "errorType": "INVALID_SHIPPING_ADDRESS",
  "errorMessage": "Invalid shipping address. Please correct {}"
}

{
  "errorType": "INVALID_BILLING_ADDRESS",
  "errorMessage": "Invalid billing address. Please correct {}"
}

{
  "errorType": "MULTIPLE_PROMO_CODE",
  "errorMessage": "Multiple promotion codes not allowed. Please correct {}"
}
```

## Clienteling

```json
{
  "error": true,
  "errorCode": 400,
  "errorMessage": "Segment is not valid"
}
```

## General Catch All

```json
{
  "errorType": "SERVER_EXCEPTION",
  "errorMessage": "Server unavailable. Please try again later"
}
```
