Error in fulfilling order

I have found the following three errors during order fulfillment, which are causing me great confusion. How can I resolve them?
Interface error: The fulfillment order is not assigned to the requesting fulfillment service
Interface error: All fulfillment orders must be assigned to a single location. Multiple locations with IDs [65189085392, 65239875792] were found
Interface error: The assigned fulfillment service for the fulfillment order must be of api type

Hi @xin_li! These are three different errors with three different causes, so I’ll address each individually below:

  • The fulfillment order is not assigned to the requesting fulfillment service means your app is trying to act on a fulfillment order that’s assigned to a location your app doesn’t own. If you’re building a fulfillment service app, it can only fulfill orders assigned to its own registered location. If you need to fulfill orders at merchant-managed locations, you’ll want the write_merchant_managed_fulfillment_orders scope instead of (or in addition to) write_assigned_fulfillment_orders. The access scope requirements section on the FulfillmentOrder docs covers which scope maps to which location type.

  • All fulfillment orders must be assigned to a single location happens when you pass multiple fulfillment order IDs into a single fulfillmentCreate call and they belong to different locations. Your two location IDs (65189085392 and 65239875792) tell me you’re mixing fulfillment orders from different locations in one call. Group them by location and make a separate fulfillment call per location.

  • The assigned fulfillment service must be of api type means the fulfillment order is assigned to a merchant-managed (manual) location rather than a third-party fulfillment service. Operations like fulfillmentOrderAcceptFulfillmentRequest or fulfillmentOrderRejectFulfillmentRequest only work on fulfillment orders assigned to a THIRD_PARTY type fulfillment service. If you’re working with merchant-managed locations, you skip the accept/reject flow entirely and just call fulfillmentCreate directly.

A good debugging step is to query your fulfillment orders and check their assignedLocation and supportedActions fields before trying to act on them. That’ll tell you exactly which workflow and mutations apply. The build fulfillment solutions guide walks through the full flow for order management apps, which you might find helpful!