# Is this possible? Updating Store/Curb-Pickup Fulfillment via Orders API as we pick each item

**URL:** <https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663>\
**Category:** Questions\
**Tags:** orders-api\
**Created:** [May 11, 2024, 4:20am UTC](https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663 "2024-05-11T04:20:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevelopingForFun](https://avatars.discourse-cdn.com/v4/letter/d/4bbf92/32.png) [@DevelopingForFun](https://developer.squareup.com/forums/u/DevelopingForFun)\
**Post date:** [May 11, 2024, 4:20am UTC](https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663/1 "2024-05-11T04:20:40Z")

</div>

We have a problem described in [Recommended workaround to sell variable price item... - The Seller Community](https://www.sellercommunity.com/t5/Square-for-Retail/Recommended-workaround-to-sell-variable-price-items-online/td-p/727293). Basically we have items we sell in store that are price embedded barcodes (so variable price, but scan at checkout and tracks inventory - lbs of meat).

We use delilabel.app to print these price embedded barcodes. But we can’t sell exactly 0.67lbs of T-Bone stake online, we’d just list 0.75 lb and 1.0 lb. But we need to refund customers if we pick an order under the price they are asking for. And we can’t make refunds a manual process by the store employees, only managers can refund. (Also orders on the online store come in fully paid for, so we can’t edit it before capturing the payment card).

The Idea:

- We build an app on an iPad that watches for online orders ([POST /v2/orders/search - Square API Explorer](https://developer.squareup.com/explorer/square/orders-api/search-orders) for recent ones, or [order.updated Webhook - Square API Reference](https://developer.squareup.com/reference/square/orders-api/webhooks/order.updated))
- Then also check each of the line items that they can be fulfilled, in the in-app experience you can do this, we’d do the same
- WHEN THEY ORDER MEAT, we’d prompt for scanning the exact price embedded barcode that it is fulfilled with and issue a refund for the overage square online charged (e.g. purchased 0.75 lb @ 12.99/lb but only picked 0.67lb the difference would be refunded to the card)
- When one comes in, we have a notification and the person marks it pending via our app (using UpdateOrder and set fulfillment state to PREPARED, and COMPLETED).

EDIT: It looks like that State field is editable by the API [API PUT /v2/orders/{order\_id} Can't set fulfillment state or order state - #3 by ryanlath](https://developer.squareup.com/forums/t/api-put-v2-orders-order-id-cant-set-fulfillment-state-or-order-state/1259/3), that thread shows how to do so.

Wanted to make sure these order updates are possible. Will be testing too.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [May 11, 2024, 4:20am UTC](https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663/2 "2024-05-11T04:20:58Z")

</div>

👋 I’m Square Dev AI, here to help answer your question!  
Based on the information you’ve provided, the following documentation will help answer your question:

> **[Payments Pricing with Square APIs and SDKs](https://developer.squareup.com/docs/payments-pricing)**
>
> Learn about the processing fees that Square charges for payments made with Square payment APIs.

> **[Orders API: How It Works](https://developer.squareup.com/docs/orders-api/how-it-works)**
>
> Learn how the Orders API processes and returns information.

> **Additional Documentation**
>
> [Publish your App to the App Marketplace](https://developer.squareup.com/docs/app-marketplace/application-wireframe)  
> [Square Developer](https://developer.squareup.com/docs/app-marketplace/requirements/payments-api)  
> [Square Developer Documentation](https://developer.squareup.com/docs/pos-api/how-it-works)

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.  
Otherwise one of our Developer Advocates will provide additional assistance shortly.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [May 13, 2024, 4:18pm UTC](https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663/3 "2024-05-13T16:18:20Z")

</div>

Yes, your idea is feasible with the Square APIs. You can use the Orders API to watch for online orders and check each of the line items for fulfillment. You can also use the UpdateOrder endpoint to change the fulfillment state to PREPARED and COMPLETED.

For issuing refunds, you can use the Refunds API. When you scan the exact price embedded barcode and calculate the overage, you can create a refund for the difference. This will refund the amount back to the customer’s card.

Remember to handle any errors or edge cases that might occur during this process, such as failed refunds or issues with updating the order status. Also, ensure that your application securely handles sensitive customer information, such as card details, in compliance with PCI standards.

_This answer was reviewed by @Bryan-Square._

---

<div class="post-metadata">

**Author:** ![DevelopingForFun](https://avatars.discourse-cdn.com/v4/letter/d/4bbf92/32.png) [@DevelopingForFun](https://developer.squareup.com/forums/u/DevelopingForFun)\
**Post date:** [May 28, 2024, 3:41pm UTC](https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663/4 "2024-05-28T15:41:20Z")

</div>

Thanks Bryan, appreciate it.

I think to have inventory correct (a big value of Square, especially when paying for Retail) is we’d need to do two things:

- do the refund, but the API doesn’t support itemized refunds or exchanges which is actually what we’d want
- then correct the inventory, possibly by moving the state from SOLD to IN\_STOCK. When we look at what the 1st party Retail app does on an exchange is it moves from SOLD to RETURNED\_BY\_CUSTOMER (but that’s read only [InventoryChange Object - Square API Reference](https://developer.squareup.com/reference/square/objects/InventoryChange)) and then to IN\_STOCK. I haven’t tried that yet to see if it is possible, or if it correctly tracks inventory.

This is the inventory changes that I see when doing the in 1st party app refund and exchange, but we just can’t set RETURNED\_BY\_CUSTOMER in the API.

```auto
   {
            "type": "ADJUSTMENT",
            "adjustment": {
                "id": "YPJJVDOFLRDYVNAXF46KFY5F",
                "from_state": "SOLD",
                "to_state": "RETURNED_BY_CUSTOMER",
                "location_id": "LTGR8RKS9T3X1",
                "catalog_object_id": "7AT2HW7XAK2S4J445XXRQTFX",
                "catalog_object_type": "ITEM_VARIATION",
                "quantity": "2",
                "total_price_money": {
                    "amount": 300,
                    "currency": "USD"
                },
                "occurred_at": "2024-05-12T13:38:55Z",
                "created_at": "2024-05-12T13:49:55.783Z",
                "transaction_id": "sfL8XP20sLuh91zGdl2JydmeV"
            },
            "measurement_unit": {
                "measurement_unit": {
                    "weight_unit": "IMPERIAL_POUND",
                    "type": "TYPE_WEIGHT"
                },
                "precision": 2
            },
            "measurement_unit_id": "QFHQIDOQC4YL2YFKPB7IHW3G"
        },
        {
            "type": "ADJUSTMENT",
            "adjustment": {
                "id": "LWSXVXQ6255CMWTFYY54L5KB",
                "from_state": "RETURNED_BY_CUSTOMER",
                "to_state": "IN_STOCK",
                "location_id": "LTGR8RKS9T3X1",
                "catalog_object_id": "7AT2HW7XAK2S4J445XXRQTFX",
                "catalog_object_type": "ITEM_VARIATION",
                "quantity": "2",
                "occurred_at": "2024-05-12T13:38:57.396Z",
                "created_at": "2024-05-12T13:38:57.491Z"
            },
            "measurement_unit": {
                "measurement_unit": {
                    "weight_unit": "IMPERIAL_POUND",
                    "type": "TYPE_WEIGHT"
                },
                "precision": 2
            },
            "measurement_unit_id": "QFHQIDOQC4YL2YFKPB7IHW3G"
        }

```

When restocking it, ideally we could link the `transaction_id` too of the refund, but that is read only (and deprecated) uggg. The deprecated Transactions API does not have `sfL8XP20sLuh91zGdl2JydmeV` but calling that on Retrieve Order actually works. **Can that field be renamed to order\_id? Very confusing, inventory adjustment.transaction\_id is really an Order**.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 28, 2024, 5:39pm UTC](https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663/5 "2024-05-28T17:39:28Z")

</div>

At this time itemized refunds aren’t currently available with the Refunds API.

Yes, that is confusing that the `transaction_id` is in the adjustment. I’ve reached out to the team about that. 🙂

---

<div class="post-metadata">

**Author:** ![DevelopingForFun](https://avatars.discourse-cdn.com/v4/letter/d/4bbf92/32.png) [@DevelopingForFun](https://developer.squareup.com/forums/u/DevelopingForFun)\
**Post date:** [May 28, 2024, 5:48pm UTC](https://developer.squareup.com/forums/t/is-this-possible-updating-store-curb-pickup-fulfillment-via-orders-api-as-we-pick-each-item/15663/6 "2024-05-28T17:48:02Z")

</div>

Thanks, gotcha - sorry I created a separate thread for the docs change about transaction\_id so it wouldn’t get missed. Of course you caught it and nothing was missed. Feel free to delete the other thread, no need to clutter. Thanks!
