When creating your app, you will want to test the app's response to error conditions. However, some error conditions are difficult to simulate. The following has be created to assist you in testing the Order API error conditions.
This document contains the information you need to run code stubs that let you simulate the error conditions in the sandbox. Submit the methods below as you usually would making the following changes in the request.
-
For methods requiring checkoutSessionId, use
testError|{ERROR_STRING}
.See the initiateCheckoutSession MAX_NUMBER_OF_ITEMS_EXCEEDED error example.
-
For methods requiring recipient, such as the initiateCheckoutSession methods, use
testError
for the value of the recipient field.See the initiateCheckoutSession MAX_NUMBER_OF_ITEMS_EXCEEDED error example.
-
For methods requiring itemId, use
testError|{ERROR_STRING
} for the value of the itemId field.See theinitiateCheckoutSession MAX_NUMBER_OF_ITEMS_EXCEEDED error example.
-
For methods requiring lineItemId, use with any random number for the value of the lineItemId field.
See the placeOrder PAYMENT_INSTRUMENT_DECLINED error example.
Error Name (not returned) | Error ID | Methods Supported | ERROR_STRING |
---|---|---|---|
MAX_NUMBER_OF_ITEMS_EXCEEDED | 15011 | initiateCheckoutSession | MaxNumberOfItemsExceeded |
CHECKOUT_ITEM_QUANTITY_UNAVAILABLE | 15012 |
initiateCheckoutSession updateQuantity |
QuantityExceedsAvailability |
CHECKOUT_MAX_LIMIT_EXCEEDED | 15013 |
initiateCheckoutSession updateQuantity |
MustBuyLess |
BUYING_SERVICE_MUST_BUY_ALL | 15014 | updateQuantity | MustBuySpecificQuantity |
CHECKOUT_MAX_LIMIT_EXCEEDED | 15015 | updatePaymentInfo | CreditCardExpired |
CHECKOUT_BUYER_IS_SELLER | 15016 | initiateCheckoutSession | BuyerIsSeller |
CHECKOUT_ITEM_CANNOT_BE_PRCHASED_RIGHT_NOW | 15017 | initiateCheckoutSession | ItemNotAvailable |
CHECKOUT_ITEM_NOT_AVAILABLE_FOR_PURCHASE | 15018 | initiateCheckoutSession | ItemNotPurchasable |
CHECKOUT_EMPTY | 15019 |
updateQuantity updatePaymentInfo updateShippingAddress updateShippingOption placeOrder |
SessionWithoutLineItems |
CHECKOUT_ITEM_VERSION_INVALID | 15020 | placeOrder | ItemRevised |
CHECKOUT_NOT_OPEN_FOR_MODIFICATIONS | 15021 |
>updateQuantity updatePaymentInfo updateShippingAddress updateShippingOption |
SessionLocked |
CHECKOUT_INVALID_PAYMENT_METHOD | 15022 | placeOrder | PaymentMethodInvalid |
PAYMENT_INSTRUMENT_DECLINED | 15023 | placeOrder | CreditCardDeclined |
PAYMENT_PAYER_ACTION_LOGIN | 15024 | placeOrder | PaypalAuthenticationIssue |
Method Examples
The following are examples of initiateCheckoutSession and placeOrder methods using stubs.
Note: Personal data, such as seller's name, buyer's name and address, etc. have been anonymized in the requests and the responses, per eBay policy.
placeOrder PAYMENT_INSTRUMENT_DECLINED error example
POST https://api.sandbox.ebay.com/buy/order/v1/guest/checkout_session/testError|CreditCardDeclined/place_order
updateQuantity CHECKOUT_ITEM_QUANTITY_UNAVAILABLE error example
POST https://api.sandbox.ebay.com/buy/order/v1/guest/checkout_session/testError|QuantityExceedsAvailability/update_quantity { "lineItemId":"55555555", "quantity":2 }
initiateCheckoutSession MAX_NUMBER_OF_ITEMS_EXCEEDED error example
POST https://api.sandbox.ebay.com/buy/order/v1/guest/checkout_session/initiate { "contactEmail" : "testEmail@someSite.com", "contactFirstName":"Test", "contactLastName":"Buyer", "shippingAddress" : { "recipient" : "testError", "phoneNumber" : "999 999 9999", "addressLine1" : "123 Some Street", "city" : "San Jose", "stateOrProvince" : "CA", "postalCode" : "95134", "country" : "US" }, "lineItemInputs" : [ { "quantity" : 1, "itemId" : "testError|MaxNumberOfItemsExceeded" } ] }