Skip to main content

Test item updates by a shopper

You can simulate a shopper finding items, replacing items, and refunding items. You can also change the item quantity.

Shopper finds an item

Simulate a shopper finding an item.

The following request specifies a shopper ID of 21850710 and an order ID of a1b2c3. In the body, the status is set to found. Optionally, you can set the delivered_count to a different quantity.

curl --request POST \
--url 'https://<Instacart_development_domain>/v2/fulfillment_sandbox/shoppers/21850710/orders/a1b2c3/items/1' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"delivered_count": 8,
"scans": [
{
"scanned_string": "1234567890123",
"scanned_string_type": "upca"
}
],
"status": "found"
}'

The response confirms that the item is updated.

{
"success": true
}

To verify the updated item, see Verify the changes.

Shopper replaces an item

Simulate a shopper replacing an ordered item with a suitable replacement item.

The following request specifies the shopper ID 21850710, the order ID a1b2c3, and the item ID 123456789012. In the body, the replacement item's retailer code (rrc) is set to product1011. In this example, the scanned bar code is a Universal Product Code (UPC) that is set to 2222222222222. It is possible that a scanned barcode string might represent some other type of code, such as an International Article Number (also known as a European Article Number or EAN). The status is replaced. Optionally, you can set the delivered_count to a different quantity.

curl --request POST \
--url 'https://<Instacart_development_domain>/v2/fulfillment_sandbox/shoppers/21850710/orders/a1b2c3/items/123456789012' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"delivered_count": 10,
"replacement_item": {
"rrc": "product1011"
},
"scans": [
{
"scanned_string": "22222222222222",
"scanned_string_type": "upca"
}
],
"status": "replaced"
}'

The response confirms that the item is updated.

{
"success": true
}

To verify the updated item, see Verify the changes.

Shopper refunds an item

Simulate a shopper marking an item for refund when an item is out of stock and a suitable replacement is not available. A refund request refunds the item's entire requested quantity.

The following request specifies a shopper ID of 21850710 and an order ID of a1b2c3. In the body, the delivered_count is set to 0 and the status is set to to_refund.

curl --request POST \
--url 'https://<Instacart_development_domain>/v2/fulfillment_sandbox/shoppers/21850710/orders/a1b2c3/items/123456789012' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"delivered_count": 0,
"status": "to_refund"
}'

The response confirms that the item is updated.

{
"success": true
}

To verify the updated item, see Verify the changes.

Verify the changes

To verify the item changes are correct, get the order by using the Fulfillment API, and then find the updated items in the response.

The following request specifies the user ID kamalsingh and the order ID a1b2c3.

curl --request GET \
--url 'https://<Instacart_development_domain>/v2/fulfillment/users/kamalsingh/orders/a1b2c3' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \

The response shows the items in the orders. Scroll through to find the updated items.