Mark Digital Download as Fulfilled

I’m using the API to create an order in shopify, the payment is captured but not taken until 7 days after (direct debit UK).
The order is created and marked as authorized, and 7 days later, I marked it PAID.
at the point of marking it as PAID i also want to mark the order as Fulfilled so that Shopifys Digital downloads will send the digital files to the customer. The problem is I can’t work out a way of marking the item as fulfilled using the API.

I have queried the order number, and got the FulfillmentOrderID, I’m then using that to mark the fulfillmentOrderclosed i.e.

{
  "query": "mutation fulfillmentOrderClose($id: ID!) { fulfillmentOrderClose(id: $id) { fulfillmentOrder { id status } userErrors { field message } } }",
  "variables": {
    "id": "gid://shopify/FulfillmentOrder/123456789"
  }
}

but I’m getting the error…

"userErrors": [
                {
                    "field": null,
                    "message": "The fulfillment order's assigned fulfillment service must be of api type"
                }
            ]

I’m not sure how to proceed from here, how to get my app to have a fulfillment API type or if there is a better solution to mark the item fulfilled so that Digital Downloads sends the digital files.

Any help will be massively appreciated.

Hey @Juniper

The fulfillmentOrderClose mutation isn’t quite what you need here. It’s specifically for when a fulfillment service wants to mark an in-progress fulfillment as incomplete.

For your use case, where you want to mark digital downloads as fulfilled after payment is captured, you’ll want to use the fulfillmentCreate mutation instead. This triggers the same flow as it would clicking the “fulfill” button in the admin.

You might also find this guide on apps in orders and fulfillment interesting. It gives you a high-level overview of how these APIs work together for different common use cases

Hi @Juniper

Just wanted to follow up here - are you still experiencing an issue or can I mark this as solved/closed?