as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Docs
Resources
Ecommerce Plug-ins
Publish
Connect

Checkout service testing

Disclaimer: This document contains sample content for illustrative purposes only. Organizations should follow their own established best practices, security requirements, and compliance standards to ensure solutions are production-ready.

Summary

While the test cases below outline key testing scenarios, it should be supplemented with your organization's established testing best practices to ensure comprehensive coverage of any use cases not explicitly included in this test plan.

1. Test Case: Successful Checkout (201 Response)

Objective: Trigger successful cart checkout

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        },
        "promotions": [
          {
            "promotionAmount": {
              "amount": "0.01",
              "currencyCode": "USD"
            },
            "promotionDescription": "Discount"
          }
        ]
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.01",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "orderId": "generated-order-id"
}

2. Test Case: Unknown Shopping Trip (400 Error)

Objective: Trigger "UnknownShoppingTripException"

{
  "idempotentShoppingTripId": "invalid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "UnknownShoppingTripException"
}

3. Test Case: Invalid Request - Missing Required Fields (400 Error)

Objective: Trigger "InvalidRequestException" for missing storeId

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

Expected Response:

{
  "errorMsg": "InvalidRequestException"
}

4. Test Case: Cart Content Validation Failed - Empty Cart (400 Error)

Objective: Trigger "CartContentValidationFailedException" for empty lineItems

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "CartContentValidationFailedException"
}

5. Test Case: Cart Order Total Invalid - Missing Price (400 Error)

Objective: Trigger "CartOrderTotalInvalidException" for missing price

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "CartOrderTotalInvalidException"
}

6. Test Case: Shopping Trip Expired (400 Error)

Objective: Trigger "ShoppingTripExpiredException"

{
  "idempotentShoppingTripId": "expired-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "ShoppingTripExpiredException"
}

7. Test Case: Authentication Exception (403 Error)

Objective: Trigger "AuthenticationException"

Test Method: Send request with invalid/expired IAM credentials

Expected Response:

{
  "errorMsg": "AuthenticationException"
}

8. Test Case: Internal Server Exception (500 Error)

Objective: Trigger "InternalServerException"

Test Method: This typically occurs during server issues or unhandled exceptions

Expected Response:

{
  "errorMsg": "InternalServerException"
}

Field Validation Test Cases

9. Test Case: Invalid Product ID Length (400 Error)

Objective: Test productId length validation (> 255 characters)

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "A".repeat(256),
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

10. Test Case: Invalid Currency Code (400 Error)

Objective: Test invalid currency code

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "INVALID"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

11. Test Case: Invalid Amount Format (400 Error)

Objective: Test invalid decimal precision (> 2 places)

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.999",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.000",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.000",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

12. Test Case: Invalid Quantity Value Length (400 Error)

Objective: Test quantity value length validation (> 10 characters)

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "12345678901",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

13. Test Case: Invalid Description Pattern (400 Error)

Objective: Test depositAndFeeDescription pattern validation ^[0-9a-zA-Z_-]$.,'/@

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "1.09",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "depositsAndFees": [
          {
            "depositAndFeeAmount": {
              "amount": "0.10",
              "currencyCode": "USD"
            },
            "depositAndFeeDescription": "Invalid#Description!",
            "salesTax": {
              "amount": "0.00",
              "currencyCode": "USD"
            }
          }
        ],
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

Missing Standard Error Codes

14. Test Case: Rate Limiting (429 Error)

Objective: Trigger "Too Many Requests"

Test Method: Send more than 10 requests per second to exceed rate limits

Expected Response:

{
  "errorMsg": "TooManyRequestsException"
}

15. Test Case: Service Unavailable (503 Error)

Objective: Trigger "ServiceUnavailableException"

Test Method: This typically occurs during service maintenance or downtime

Expected Response:

{
  "errorMsg": "ServiceUnavailableException"
}

16. Test Case: StoreId Format Validation (400 Error)

Objective: Test StoreId pattern validation ^[0-9a-zA-Z_-]*$

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "INVALID@STORE#ID!",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

Multi-Quantity and Empty Cart Test Cases

17. Test Case: Multi-Quantity Formatting (201 Response)

Objective: Test proper handling of multiple quantities for the same product

Note: For baskets with multiple quantities, Amazon expects customers to split the basket and send separate line items when calling ExtCheckoutService. This specific use case needs careful handling during implementation to avoid issues post-launch.

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "2.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "1.98",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    },
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "2.97",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "3.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "orderId": "generated-order-id"
}

18. Test Case: Empty Cart Handling (Accepted Behavior)

Objective: Test empty cart acceptance by ExtCheckoutService

Note: Based on current implementation, empty carts are passed to and accepted by ExtCheckoutService. This differs from Test Case #4 which tests validation errors.

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "orderId": "generated-order-id-for-empty-cart"
}