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 

1{
2  "errorType": "CREATE_ACCOUNT_FAILURE",
3  "errorMessage": "USer Registraion failed"
4}
5
6{
7  "errorType": "INVALID_LOGIN",
8  "errorMessage": "Invalid Credentials"
9}
10
11{
12  "errorType": "SESSION_EXPIRED",
13  "errorMessage": "User session expired"
14}
15
16{
17  "errorType": "UPDATE_ACCOUNT_FAILURE",
18  "errorMessage": "Updating user account failed"
19}

Cart 

1{
2  "errorType": "PRODUCT_UNAVAILABLE",
3  "errorMessage": "{ProductID} : Product 1234567890 is unavailable"
4}
5
6{
7  "errorType": "CART_CREATE_FAILURE,
8  "errorMessage": "Cart creation failed due to {}"
9}
10
11{
12  "errorType": "CART_READ_FAILURE",
13  "errorMessage": "Cart {} could not be retrieved"
14}

Checkout 

1{
2  "errorType": "INVALID_COUPON_CODE",
3  "errorMessage": "Invalid coupon code"
4}
5
6{
7  "errorType": "SHIPPING_TO_COUNTRY_NOT_ALLOWED",
8  "errorMessage": "Cannot ship to country {CountryName}"
9}
10
11{
12  "errorType": "CHECKOUT_FAILURE",
13  "errorMessage": "Checkout failure due to {}"
14}
15
16{
17  "errorType": "BILLING_TO_COUNTRY_NOT_ALLOWED",
18  "errorMessage": "Cannot bill country {}"
19}
20
21{
22  "errorType": "CARD_VALIDATION_FAILURE",
23  "errorMessage": "Credit card validation failed"
24}
25
26{
27  "errorType": "PAYMENT_NOT_AUTHORIZED",
28  "errorMessage": "Credit card authorization failed"
29}
30
31{
32  "errorType": "INVALID_SHIPPING_ADDRESS",
33  "errorMessage": "Invalid shipping address. Please correct {}"
34}
35
36{
37  "errorType": "INVALID_BILLING_ADDRESS",
38  "errorMessage": "Invalid billing address. Please correct {}"
39}
40
41{
42  "errorType": "MULTIPLE_PROMO_CODE",
43  "errorMessage": "Multiple promotion codes not allowed. Please correct {}"
44}

Clienteling 

1{
2  "error": true,
3  "errorCode": 400,
4  "errorMessage": "Segment is not valid"
5}

General Catch All 

1{
2  "errorType": "SERVER_EXCEPTION",
3  "errorMessage": "Server unavailable. Please try again later"
4}