Skip to content

Fulfill and ship orders

Once an order is paid, your warehouse, store, or team gets the goods to the buyer, and Flint records how. A fulfillment covers some quantity of the order's line items and says how they reach the buyer. You report each step. Flint keeps the fulfillment's status, the order's fulfillment_status, the stock ledger, and the buyer's shipping emails in step with what you report.

Flint doesn't buy labels or track carriers. Your shipping software or carrier integration reports package progress, and Flint emails the buyer at each moment that matters. To set up the delivery methods and rates the buyer picks at checkout, see Add shipping to a checkout. Every field is in the Fulfillment API reference.

A shipped order, end to endResponse
Your serverFlintBuyerfulfillment.created, shortly after paymentmark_picked or mark_packed (optional)POST /v1/fulfillments/{id}/shipments with shipped packagesshipped email for each package, with trackingfulfillment.updated, status dispatchedmark_delivered on each packagedelivered email for each packagefulfillment.completed
  1. Flint sends fulfillment.created, shortly after payment to Your server
  2. Your server sends mark_picked or mark_packed (optional) to Flint
  3. Your server sends POST /v1/fulfillments/{id}/shipments with shipped packages to Flint
  4. Flint sends shipped email for each package, with tracking to Buyer
  5. Flint sends fulfillment.updated, status dispatched to Your server
  6. Your server sends mark_delivered on each package to Flint
  7. Flint sends delivered email for each package to Buyer
  8. Flint sends fulfillment.completed to Your server

How a fulfillment is organized#

Each fulfillment has a type, which decides the steps it accepts and when its stock leaves on hand:

typeSteps you sendStock leaves on hand at
shipmentaccept, mark_picked, mark_packed, then package actionsdispatch, or complete if it skips dispatch
local_deliveryaccept, mark_preparing, dispatch, completedispatch, or complete if it skips dispatch
pickupaccept, mark_preparing, mark_ready, completecomplete
digitalaccept, completecomplete
serviceaccept, schedule, start, completecomplete

Every step is optional. A fulfillment can go straight from pending to the last step when you have nothing to report in between.

A shipment-type fulfillment holds one or more shipments, one per carrier leg. Each shipment holds packages, one per parcel. Tracking lives on the package, and package items record which order line quantities are in each box. The shipment has no actions of its own: its status comes from its packages, where an exception outranks everything else and otherwise the least advanced package sets the pace.

Flint also keeps two logs for each fulfillment. Fulfillment events are its timeline: status changes, tracking changes, and carrier scans. Fulfillment notifications record every buyer email Flint sent or skipped.

1. Find the work#

Fulfillments Flint creates#

When an order is paid with a delivery choice (shipping, pickup, or local delivery), Flint creates its fulfillments shortly after payment: one for each execution leg of the delivery the buyer chose. Each starts at pending, and Flint sends fulfillment.created for each one. Start your delivery work from that event and use those fulfillments. This applies whether the buyer chose at checkout or your backend selected the delivery and paid.

To list an order's fulfillments:

cURL
curl "https://api.withflintpay.com/v1/fulfillments?order_id=ord_1kmn0aExample" \
  -H "Authorization: Bearer YOUR_API_KEY"

fulfillment.created is the signal to act on. A handler that reacts to order.paid instead can find this list still empty, because creation runs after payment. Don't create a fulfillment of your own for those quantities. While Flint is still creating them, that returns 409 OPERATION_IN_PROGRESS with details[0].reason: delivery_selection_materializing; afterward, it returns 409 LIMIT_EXCEEDED.

Flint never creates digital or service fulfillments, and you can create one only for a custom line whose fulfillment sets requirement: "required", resolution_mode: "manual", and allowed_types with digital or service. See Create a fulfillment yourself. A catalog product with product_type digital or service, and a custom line with requirement: "none", has nothing to fulfill: the order's fulfillment_status is not_applicable, and creating a fulfillment for the line returns 404 RESOURCE_NOT_FOUND. Deliver those from your own app after order.paid.

Work from queues#

To work from a list instead of reacting to each event, filter by state. GET /v1/fulfillments takes status, type, location_id, and order_id. Repeat status or type, or separate values with commas, to match any of them. To work through a schedule, add sort_by=scheduled_start_at&sort_direction=asc. scheduled_start_at is the start of the pickup, local delivery, or shipment window, or the service appointment, and is null for digital and unbooked fulfillments.

Once shipments exist, list them by state. This lists outbound shipments that are packed and waiting for the carrier:

cURL
curl "https://api.withflintpay.com/v1/shipments?direction=outbound&status=packed&page_size=50" \
  -H "Authorization: Bearer YOUR_API_KEY"

status=exception,delivery_attempted finds shipments that need attention. To find the package behind a carrier scan, send its carrier and tracking number. Both match the whole stored value exactly, and tracking numbers can repeat across carriers, so send both:

cURL
curl "https://api.withflintpay.com/v1/packages?carrier=ups&tracking_number=1Z999AA10123456784" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "data": [
    {
      "package_id": "pkg_1kmn0aExample",
      "shipment_id": "shp_1kmn0aExample",
      "fulfillment_id": "ful_1kmn0aExample",
      "order_id": "ord_1kmn0aExample",
      "status": "shipped",
      "carrier": "ups",
      "tracking_number": "1Z999AA10123456784",
      "shipped_at": "2026-09-22T16:05:00Z"
    }
  ],
  "request_id": "req_01KWM6WAHG3N9Q8T2V5XRZ7C4D"
}

This example leaves out most package fields. With no next_page_token, it is the last page. When you page, send the same filters with each page_token; a token works only with the filters it was issued for. List shipments and packages has every filter, including updated_after, handed_off_after, and partial matching with query. Add expand=order to any of these lists to get each row's order beside it.

Find orders that still need a fulfillment#

To find paid orders with quantity that no fulfillment owns, such as digital lines or units handed back by a failed fulfillment:

cURL
curl "https://api.withflintpay.com/v1/orders?payment_status=paid&has_unassigned_fulfillment_quantity=true" \
  -H "Authorization: Bearer YOUR_API_KEY"

Each line item carries fulfillment_quantities. Its unassigned_quantity is what you can put into a new fulfillment. An order leaves this list once fulfillments own all of its quantity, and comes back when a fulfillment fails with release_quantity: true. A shipping, pickup, or local delivery order also appears here for the moment before Flint creates its fulfillments, so check the order's fulfillments before you create one. See Filter orders by unassigned quantity.

2. Prepare the order#

Every fulfillment lists the actions it accepts right now in supported_actions. Send one of them to its transitions endpoint:

cURL
curl -X POST https://api.withflintpay.com/v1/fulfillments/ful_1kmn0aExample/transitions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: ful_1kmn0aExample-packed" \
  -H "Content-Type: application/json" \
  -d '{ "action": "mark_packed", "expected_version": 2 }'
Response
{
  "data": {
    "fulfillment_id": "ful_1kmn0aExample",
    "order_id": "ord_1kmn0aExample",
    "type": "shipment",
    "status": "packed",
    "version": 3,
    "picked_at": "2026-09-22T14:30:00Z",
    "packed_at": "2026-09-22T15:10:00Z",
    "supported_actions": ["dispatch", "complete", "cancel", "fail", "hold"]
  },
  "request_id": "req_01KWM6S28J37K3GFF9QRM8YWA4"
}

The response is the updated fulfillment; this example leaves out most of its fields. It doesn't include the timeline event or email records the action created. Read those as in Read events and notifications.

  • Send expected_version. It must match the fulfillment's version. A stale value returns 409 VERSION_CONFLICT and changes nothing.
  • Each action takes only its own fields. hold needs a reason, schedule needs scheduled_start_at and scheduled_end_at, fail needs release_quantity, and mark_no_show needs a reason. Every action accepts occurred_at for when it happened and reason_message, a note of up to 500 characters.
  • Retry with the same Idempotency-Key and body. A replay returns the original result without another email. See Idempotency.

Until dispatch, every type also accepts hold and fail, and cancel while it has no shipment that isn't voided. A service also accepts mark_no_show. A dispatched fulfillment accepts only complete and fail.

Fulfillment status#

status reports exactly where the fulfillment is. Each type uses the values its steps reach. Filter GET /v1/fulfillments by any of them.

status on fulfillment
Final values do not change again
  • pending
    Created, and nobody has started or accepted the work.
  • accepted
    Someone accepted the work, which hasn't started.
  • scheduled
    A service appointment window is booked.
  • in_progress
    Service work has started.
  • preparing
    A pickup or local delivery is being prepared.
  • picked
    The shipment's items are picked.
  • packed
    The shipment's items are packed.
  • ready
    A pickup is waiting for the buyer.
  • dispatched
    The goods have left for delivery. dispatched_at records when.
  • on_hold
    Work is paused. active_hold gives the reason and the status it paused at.
  • completedFinal
    All the work is done. completed_at records the delivery or handover time when it is known.
  • canceledFinal
    The work was called off.
  • failedFinal
    The work couldn't be finished.
  • no_showFinal
    A service appointment was missed. outcome records the reason.

active_hold is present exactly when status is on_hold, and outcome exactly when it is no_show. terminal_at records when the fulfillment reached a terminal status.

Hold and release#

hold pauses the fulfillment at on_hold with a reason, such as address_issue or customer_request. Your reason_message appears as active_hold.reason_notes:

cURL
curl -X POST https://api.withflintpay.com/v1/fulfillments/ful_1kmn0aExample/transitions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: ful_1kmn0aExample-hold-1" \
  -H "Content-Type: application/json" \
  -d '{ "action": "hold", "reason": "address_issue", "reason_message": "Confirming the apartment number", "expected_version": 3 }'

active_hold.initiated_by is merchant when you or your integration placed the hold, or flint when Flint placed a payment hold. This read-only field identifies who paused the work. Merchant holds block package-derived progress whatever their reason, including legacy holds with reason payment_review.

payment_review is reserved for Flint. Sending it as the reason for a merchant hold returns 400 INVALID_REQUEST with detail INVALID_VALUE at reason. Use fraud_review for your own review, or other with reason_message.

active_hold.previous_status records the status the hold paused, which is never on_hold or terminal. A held fulfillment can only move forward from there:

  • release_hold returns it to previous_status. It keeps the schedule and progress timestamps such as picked_at and packed_at, never emails the buyer, and rejects buyer_notification_behavior.
  • Any other action that previous_status allows, except hold, moves it on and clears the hold. A fulfillment held at packed accepts dispatch but not mark_picked.

supported_actions lists exactly these exits. Holds are private to the merchant: buyer responses under /v1/me show a held fulfillment at its previous_status with no active_hold, and putting work on hold sends no email.

Require approval#

When the merchant turns on fulfillment.approval_required in settings, a new fulfillment offers only accept, hold, cancel, and fail until someone accepts it. A fulfillment held before acceptance also offers release_hold.

3. Ship the packages#

For a shipment-type fulfillment, create its shipment with one package per box. Give each package its contents and tracking, and status: shipped to report the carrier handoff in the same call:

cURL
curl -X POST https://api.withflintpay.com/v1/fulfillments/ful_1kmn0aExample/shipments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: shipment-1042" \
  -H "Content-Type: application/json" \
  -d '{
    "direction": "outbound",
    "packages": [
      {
        "status": "shipped", "carrier": "ups", "tracking_number": "1Z999AA10123456784",
        "items": [
          { "order_line_item_id": "li_1kmn0aExampleA", "quantity": 1 },
          { "order_line_item_id": "li_1kmn0aExampleB", "quantity": 1 }
        ]
      },
      {
        "status": "shipped", "carrier": "ups", "tracking_number": "1Z999AA10123456785",
        "items": [{ "order_line_item_id": "li_1kmn0aExampleC", "quantity": 1 }]
      }
    ]
  }'
Response
{
  "data": {
    "shipment_id": "shp_1kmn0aExample",
    "fulfillment_id": "ful_1kmn0aExample",
    "order_id": "ord_1kmn0aExample",
    "direction": "outbound",
    "status": "shipped",
    "package_count": 2,
    "shipped_at": "2026-09-22T16:05:00Z",
    "handed_off_at": "2026-09-22T16:05:00Z",
    "packages": [
      { "package_id": "pkg_1kmn0aExample", "status": "shipped", "carrier": "ups", "tracking_number": "1Z999AA10123456784" },
      { "package_id": "pkg_1kmn0aExampleB", "status": "shipped", "carrier": "ups", "tracking_number": "1Z999AA10123456785" }
    ]
  },
  "request_id": "req_01KWM6H6EF3N5C3ZK19ZSFRE11"
}

These examples leave out most fields. The shipment, its packages and items, the timeline entries, the buyer emails, and any fulfillment progress commit together; a failure commits nothing. Because every unit is in a shipped box, this call also moves the fulfillment to dispatched, as described in How packages move the fulfillment.

  • Send 1 to 20 packages. Each needs status: created or status: shipped. items is optional per package; when you send it, give 1 to 100 entries, with each order line at most once per box. Across all packages, quantities can't exceed what the fulfillment covers.
  • Create labels before handoff. Send status: created, then mark_shipped on each package when the carrier takes it. To add a box later, use POST /v1/shipments/{shipment_id}/packages.
  • Choose when to email. Each shipped package sends one shipped email with its tracking link. Set buyer_notification_behavior: suppress on a package to skip its email. shipped_at defaults to the request time. Both fields are allowed only with shipped.
  • Retry with the same Idempotency-Key and body. A replay returns the original IDs and sends no second email. external_reference_id helps you find a shipment later but doesn't prevent duplicates.
  • The delivery address is on the fulfillment. recipient holds the address and buyer email copied from the order. If the buyer asks for a change, update it with PATCH /v1/fulfillments/{fulfillment_id}.

Return shipments carry goods back from the buyer and take no packages here; see Return labels and tracking.

Change a box's contents#

Read a package's contents with GET /v1/packages/{package_id}/items. Each item has its own version. To change a quantity only if nobody changed the item since you read it, send that version as expected_version:

cURL
curl -X PATCH https://api.withflintpay.com/v1/packages/pkg_1kmn0aExample/items/pki_1kmn0aExample \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: pkg-item-qty-pki_1kmn0aExample-1" \
  -H "Content-Type: application/json" \
  -d '{ "quantity": 2, "expected_version": 1 }'

DELETE /v1/packages/{package_id}/items/{package_item_id}?expected_version=1 removes an item the same way. A stale value returns 409 VERSION_CONFLICT and changes nothing. Contents, new packages, and voids are allowed only before handoff.

Correct tracking#

PATCH /v1/packages/{package_id} corrects tracking, carrier, service, label URL, weight, dimensions, expected delivery time, status reason, external references, or metadata. These fields stay editable after delivery and completion, until the package is voided. Send null to clear a field. PATCH /v1/shipments/{shipment_id} corrects a shipment's external references and metadata until it is voided. Corrections never email the buyer.

Void a mistake#

Before handoff, void what you created by mistake. POST /v1/packages/{package_id}/void and POST /v1/shipments/{shipment_id}/void work while the shipment is created or packed. Voiding a package returns the package. Voiding a shipment voids its packages too, so it returns both:

Response
{
  "data": {
    "shipment": { "shipment_id": "shp_1kmn0aExample", "status": "voided" },
    "packages": [{ "package_id": "pkg_1kmn0aExample", "status": "voided" }]
  }
}

This example leaves out most fields. Voided packages and shipments no longer count toward the fulfillment's progress.

4. Report carrier progress#

As each parcel moves, send its package action to POST /v1/packages/{package_id}/transitions. Each package publishes the actions it accepts in supported_actions. For label-first work, mark_shipped records the handoff and can set the final tracking in the same request:

cURL
curl -X POST https://api.withflintpay.com/v1/packages/pkg_1kmn0aExample/transitions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: pkg_1kmn0aExample-shipped" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "mark_shipped",
    "occurred_at": "2026-09-22T16:05:00Z",
    "carrier": "ups",
    "service_code": "ground",
    "tracking_number": "1Z999AA10123456784",
    "tracking_url": "https://www.ups.com/track?tracknum=1Z999AA10123456784"
  }'

carrier, service_code, tracking_number, and tracking_url are accepted only on mark_shipped. Fields you send replace the package's values before the shipped email is built; fields you leave out stay unchanged. They can't be null here, so clear a field with PATCH. The response is the updated package.

ActionPackage statusBuyer email
mark_packedpackedNone
mark_shippedshippedShipped, with the tracking link
mark_in_transitin_transitNone
mark_out_for_deliveryout_for_deliveryOut for delivery
mark_delivery_attempteddelivery_attemptedDelivery attempted
mark_delivereddeliveredDelivered
mark_exceptionexceptionDelivery issue
mark_returnedreturnedReturned to sender

A package starts at created or shipped, and voiding it sets voided. Every action accepts occurred_at, reason_message, expected_version, and buyer_notification_behavior. Nothing in Flint moves a package on its own, in live mode or a sandbox, so your integration sends each step it learns from the carrier.

Share an expected delivery time#

expected_delivery_at is when you or the carrier expect a package to arrive. Set it when you create the package, change it with PATCH /v1/packages/{package_id}, or send it with mark_shipped, mark_in_transit, or mark_out_for_delivery:

cURL
curl -X POST https://api.withflintpay.com/v1/packages/pkg_1kmn0aExample/transitions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: pkg_1kmn0aExample-in-transit-1" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "mark_in_transit",
    "occurred_at": "2026-09-23T09:40:00Z",
    "expected_delivery_at": "2026-09-25T21:00:00Z"
  }'

Leave it out to keep the current value, or send null to clear it. Past times are accepted, so a late parcel keeps its estimate as history, and the value stays on the package after delivery; hide it from buyer arrival estimates once the package is delivered. It belongs to one package and is separate from the fulfillment's promised shipping window, shipment_details.window_start_at and window_end_at.

Record a carrier scan#

A scan that changes no status, such as a departure from a sorting facility, goes to the fulfillment's timeline instead:

cURL
curl -X POST https://api.withflintpay.com/v1/fulfillments/ful_1kmn0aExample/events \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "carrier_scan",
    "package_id": "pkg_1kmn0aExample",
    "external_system": "ups",
    "external_event_id": "scan-88412",
    "external_status": "Departed facility",
    "location_description": "Louisville, KY",
    "occurred_at": "2026-09-23T03:12:00Z"
  }'

event_type is carrier_scan or custom. Add package_id or shipment_id to attach the entry to a box or a leg. Send external_system with external_event_id so a repeated scan is recorded once: the first returns 201 with the new event, and a repeat returns 200 with the same fulfillment_event_id. Reusing an external_event_id with different details returns 409 ALREADY_EXISTS with the recorded event in details[0].current_resource. These entries never email the buyer. Status changes such as shipped or delivered are package actions; sending one as an event_type returns 400 INVALID_REQUEST with param: event_type.

How packages move the fulfillment#

Once a shipment-type fulfillment has a package, its packages move it forward. Only packages that aren't voided, in outbound shipments that aren't voided, count:

  • Dispatched once every unit of the fulfillment is in a package and every package has left with the carrier (shipped or later). dispatched_at is the latest package's shipped_at, and stock leaves on hand.
  • Completed once, with every unit packed, every package is delivered. completed_at is the latest package's delivered_at, so a return window that starts at delivery counts from the carrier's delivery. The order's fulfillment_status updates and fulfillment.completed fires.
  • Not yet while any unit is outside a package, any package is still created or packed, or, for completion, any package is in exception or returned.

Each step happens in the same request as the package action that triggers it. That response is the package, so read the fulfillment or listen for fulfillment.updated and fulfillment.completed to see the step. Two packages delivered at the same moment complete the fulfillment once.

Packages don't move a fulfillment that is waiting for accept, that you put on hold (whatever the hold reason), or whose payment is holding fulfillment. The package still records its progress and emails the buyer. When the fulfillment can go on, send dispatch or complete yourself. On a held fulfillment, that also clears the hold.

Once completed, a fulfillment stays completed. A later package action, such as mark_returned after a return to sender, changes only the package and sends its own events and email. With packages, the delivery time comes only from them, so PATCH /v1/fulfillments/{fulfillment_id} with completed_at returns 409 ACTION_NOT_ALLOWED with details[0].reason: derived_from_packages.

5. Complete it#

With packages, delivery of the last package completes the fulfillment. Send complete yourself when nothing will report it: a pickup handed over, a local delivery dropped off, a digital or service order finished, a shipment you track without packages, or a parcel whose carrier never reports delivery.

cURL
curl -X POST https://api.withflintpay.com/v1/fulfillments/ful_1kmn0aExample/transitions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: ful_1kmn0aExample-complete" \
  -H "Content-Type: application/json" \
  -d '{ "action": "complete", "occurred_at": "2026-09-24T18:20:00Z" }'

occurred_at on complete becomes the fulfillment's completed_at, the delivery or handover time. Send it when you know it. Without it, completed_at stays empty, and a return window that counts from delivery sends the order's returns to manual review. To record the time later, PATCH /v1/fulfillments/{fulfillment_id} with completed_at.

The order's fulfillment_status counts only completed fulfillments. It stays not_fulfilled through packing and dispatch, moves to partially_fulfilled when some quantity is complete, and reaches fulfilled when all of it is. If all of it was canceled, the order ends canceled, and if some was completed and the rest canceled, it ends closed. An order with nothing to ship is not_applicable. The full list is in Statuses and lifecycles.

Pickup, local delivery, digital, and service#

  • Pickup. mark_ready emails the buyer that the order is waiting. complete records the collection and takes the stock off hand. For a buyer who never comes, send cancel or fail; mark_no_show is for services only. pickup_details names the store, and recipient.instructions holds any note the buyer left for it.
  • Local delivery. Works like a shipment without shipments or packages: dispatch when the courier leaves, which emails the buyer, then complete on delivery. Put the courier's link in local_delivery_details.tracking_url.
  • Digital. Only a custom line that requires a digital fulfillment gets one. Put the download link in digital_details.delivery_url and send complete once the buyer has it. The completed email links the buyer to their order in their account rather than to the file. A catalog digital product gets no fulfillment, so deliver it from your app after order.paid.
  • Service. schedule books the appointment window, start marks it underway, and mark_no_show records a missed appointment with a reason, such as customer_no_show.

Create a fulfillment yourself#

Create a fulfillment with POST /v1/orders/{order_id}/fulfillments when no fulfillment covers the quantity: a custom line that requires a digital or service fulfillment, or units a failed fulfillment handed back. The order must be paid, and the fulfillment's type must be in the line's allowed_types. For a custom line created with "fulfillment": {"requirement": "required", "resolution_mode": "manual", "allowed_types": ["digital"]}:

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/fulfillments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-1042-ebook" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "digital",
    "line_items": [{ "order_line_item_id": "li_1kmn0aExampleD", "quantity": 1 }],
    "digital_details": { "delivery_url": "https://downloads.example.com/orders/1042/guide.pdf" }
  }'

For a shipment, you can create its boxes in the same call. shipment.packaging: itemized takes 1 to 20 shipment.packages, each with non-empty items naming only lines in the request's line_items. Their totals can cover less than, but not more than, each requested quantity. For one box holding every requested unit, send packaging: single_package and a shipment.package without items. This reships three units from another warehouse:

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/fulfillments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-1042-reship" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "shipment",
    "line_items": [
      { "order_line_item_id": "li_1kmn0aExampleA", "quantity": 1 },
      { "order_line_item_id": "li_1kmn0aExampleB", "quantity": 1 },
      { "order_line_item_id": "li_1kmn0aExampleC", "quantity": 1 }
    ],
    "external_reference_id": "wms-order-1042-reship",
    "shipment": {
      "packaging": "itemized",
      "packages": [
        {
          "status": "shipped", "carrier": "ups", "tracking_number": "1Z999AA10123456786",
          "items": [
            { "order_line_item_id": "li_1kmn0aExampleA", "quantity": 1 },
            { "order_line_item_id": "li_1kmn0aExampleB", "quantity": 1 }
          ]
        },
        {
          "status": "shipped", "carrier": "ups", "tracking_number": "1Z999AA10123456787",
          "items": [{ "order_line_item_id": "li_1kmn0aExampleC", "quantity": 1 }]
        }
      ]
    }
  }'

The response is the new fulfillment, with the created shipment and packages in its shipments and packages fields. An item for a line outside line_items returns 400 INVALID_REQUEST with detail NOT_ALLOWED, and the item that pushes a line over its requested quantity returns detail INVALID_VALUE. Both name the item in param.

  • Quantities are capped. A line can be split across several fulfillments, but a request can't claim more than the unassigned_quantity in the line's fulfillment_quantities (see Read what is left to fulfill). Asking for more returns 409 LIMIT_EXCEEDED with the quantity field in param and the remaining amount in details[0].available_quantity.
  • Tracked stock comes from one location. For inventory items, a fulfillment draws on stock committed at a single location, so stock committed at two locations needs two fulfillments.
  • The address comes from the order. Without recipient, Flint copies the order's delivery destination and buyer email.
  • Supply an Idempotency-Key for every fulfillment create. An inline shipped package can consume stock, so the key is required for every body. A missing key returns 400 INVALID_REQUEST with detail REQUIRED at Idempotency-Key. Store it before you send, so after a timeout you can replay the same key and body and get the original IDs. external_reference_id lets you find the fulfillment later with GET /v1/fulfillments?order_id=...&external_reference_id=....

Cancel, fail, and try again#

Canceling and failing both end a fulfillment, but they leave the order in different places:

ActionStockQuantityUse it when
cancelReleasedStays with the fulfillment and counts in the line's canceled_quantityThe goods won't be sent at all
fail with release_quantity: trueReleased, unless it already left on hand. A shipment fulfillment with a shipment that isn't voided returns 409 RESOURCE_IN_USE insteadReturns to the line's unassigned_quantityYou'll send it another way, such as from another warehouse
fail with release_quantity: falseStays committed or consumedStays with the fulfillment and counts in the line's failed_quantityThe goods are gone, such as a parcel lost after it shipped

A no_show counts in canceled_quantity too. After a fail with release_quantity: true, read the line's unassigned_quantity and create the replacement:

cURL
curl -X POST https://api.withflintpay.com/v1/fulfillments/ful_1kmn0aExample/transitions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: ful_1kmn0aExample-fail" \
  -H "Content-Type: application/json" \
  -d '{ "action": "fail", "release_quantity": true, "reason_message": "Out of stock at the east warehouse" }'

While a fulfillment has a shipment that isn't voided, cancel drops out of supported_actions, and fail with release_quantity: true returns 409 RESOURCE_IN_USE with the shipment in details[0].blocking_resources. Before handoff, void the shipment first. Once a parcel has left, its shipment can't be voided, so fail with release_quantity: false is the way to end the fulfillment without completing it.

When a payment stops shipping#

A payment provider can ask Flint to stop shipping for a payment, for example while it reviews the payment. Every open fulfillment on the order then goes on hold with reason payment_review, and only cancel and hold remain in supported_actions. Any other action, including release_hold, returns 409 ACTION_NOT_ALLOWED with details[0].reason: on_hold. You receive payment_intent.fulfillment_hold_updated when the stop starts and again when it lifts.

Lifting the payment stop leaves the fulfillment on_hold. You can send release_hold or the next forward action. Later package progress can also advance a hold placed by Flint once the payment stop lifts; it never advances a merchant hold.

Refunding money never cancels a fulfillment or restocks anything on its own. Returned goods come back through Returns.

What the buyer receives#

Flint sends the buyer one email per moment, from the call that reports it:

SourceEmails on
Package actionsmark_shipped, mark_out_for_delivery, mark_delivery_attempted, mark_delivered, mark_exception, and mark_returned, once per package. A package created as shipped counts as mark_shipped
Fulfillment actionsmark_ready, complete, cancel, fail, mark_no_show, and dispatch for local delivery
A shipment without packagesdispatch sends the shipped email, and complete the delivered email

Nothing else emails: not accept, mark_picked, mark_packed, mark_preparing, schedule, start, hold, release_hold, mark_in_transit, tracking corrections, or entries posted to the events endpoint. When packages move a fulfillment to dispatched or completed, the package email is the only one, and a dispatch or complete you send stays silent when a package already sent that moment. Flint also drops a repeat of a moment it already recorded, such as two integrations both reporting that the same package shipped.

  • Recipient. Each email goes to the fulfillment's recipient.email. Without one, Flint uses the order's buyer_contact.email, then the email of the order's customer. With no address at all, the email is skipped with suppression_reason: recipient_missing.
  • Skipping one. Send buyer_notification_behavior: suppress on the action.
  • Unsubscribes. Buyers can unsubscribe from shipping progress emails: shipped, out for delivery, delivered, and a local delivery's dispatch. Every other email always goes out.
  • Sending your own. Set customer_email_delivery.fulfillment_updates to merchant_sends and Flint sends none of these. See Customer email delivery.

A signed-in buyer can read their own fulfillments, shipments, and packages through GET /v1/me/fulfillments, /v1/me/shipments, and /v1/me/packages with a customer session.

Read events and notifications#

Writes return the resource they changed, not the records they logged. Read those through their lists:

  • GET /v1/fulfillment-events?fulfillment_id=... returns the timeline: every status change, with previous_status and current_status, plus tracking changes and carrier scans. Filter by package_id, shipment_id, order_id, or event_type. Sort by received_at (the default) or occurred_at, with sort_direction desc (the default) or asc.
  • GET /v1/fulfillment-notifications?fulfillment_id=... returns the email record. Each entry has a status of pending, sent, failed, or suppressed, and a suppression_reason when it was skipped. Filter by fulfillment_event_id to find the email a step sent.

Staying in sync#

Each event carries its resource in data.object, as its GET returns it. A status change sends exactly one fulfillment event: fulfillment.completed, fulfillment.canceled, or fulfillment.failed for those statuses, with no fulfillment.updated, and fulfillment.updated for every other status. Changes to the order's embedded fulfillments or fulfillment_status send order.updated, and order.closed is sent only when the order moves from open to closed. Delivery details are in the event catalog.

  • Calls you make send events too. Resources a call creates send their .created events at their final revision, with no .updated events of their own. The call also sends its timeline entries and the fulfillment and order events for any progress it causes. Adding a package to an existing shipment sends package.created and a shipment.updated with the final package_count.
  • Tracking changes are timeline entries. A tracking change, through PATCH or mark_shipped, sends package.updated and a fulfillment_event.created with event_type: tracking_updated. A correction alone sends no fulfillment or order event.
  • Contents aren't in the package snapshot. Creating, editing, or deleting a package item advances the package's version and sends one package.updated. When you receive a package with a higher version than your copy, list GET /v1/packages/{package_id}/items, paging to the end, to refresh its contents.
  • Deliveries can repeat or arrive out of order. Deduplicate by webhook_event_id, and replace a stored fulfillment, shipment, or package only when the snapshot's version is higher. A retry resends the original snapshot, so fetch the resource when you need its current state.
  • Updates aren't moments. An update event says a resource changed. It isn't a timeline entry and doesn't mean the buyer got an email. To send your own mail, key it to the moments Flint emails for, which fulfillment_event.created records.

Common errors#

  • HTTP 409
    The current state refuses the action. Branch on details[0].reason. unsupported_state: the action isn't in supported_actions, or contents, new packages, or a void came after handoff; details[0] carries the current status, version, and supported_actions. status_not_reached: the order isn't paid, or the fulfillment needs accept first. on_hold: a payment is holding fulfillment, so only cancel and hold work. terminal_status: the fulfillment, shipment, or package has ended; package and shipment corrections still work until they are voided. field_locked: a completed fulfillment's details can't be replaced, and param names the field. derived_from_packages: packages set this fulfillment's completed_at.
  • HTTP 409
    VERSION_CONFLICTRefresh, then retry
    The expected_version you sent is stale (param names it), or another change landed while your request ran (no param). details[0].current_resource is the current fulfillment, shipment, or package. Read it again, decide again, and send the new request with a new Idempotency-Key.
  • HTTP 409
    A quantity is more than what is left. When creating a fulfillment, read the line's unassigned_quantity; details[0].available_quantity has the remaining amount. For package items, reduce the quantity or move it to another package.
  • HTTP 409
    OPERATION_IN_PROGRESSRetry the same request
    With delivery_selection_materializing, Flint is still creating the fulfillments for the buyer's delivery choice. Wait for fulfillment.created and use those fulfillments.
  • HTTP 409
    A shipment that isn't voided still holds the quantity. Void the shipment in details[0].blocking_resources, then cancel or fail.
  • HTTP 409
    An external_event_id was reused with different details. Send a new ID for a new event.
  • HTTP 400
    A field is missing, unknown for this action, or invalid; param names it. Common causes are a field another action owns, null tracking on mark_shipped, and a status sent as an event_type.

The full list is in the error reference.

Endpoints#

Was this helpful?