Your first return
Take one item back from a paid order and refund it to the original payment. Pick the flow that matches where the item is:
| The item is | Calls | Section |
|---|---|---|
| In your hands, at a register or service desk | Create the Return, then process it | Items are here |
| Still with the customer, who will send it back | Create the Return, approve it, then process it when the item arrives | Customer will send items back |
Both flows end the same way: Flint refunds the original payment and completes the Return once the refund succeeds.
Before you start#
You need:
- A sandbox API key with
commerce.returns.read,commerce.returns.write,commerce.returns.operations.write, andcommerce.returns.resolutions.write. - A paid order whose item is in a completed fulfillment. Flint returns only fulfilled quantity. To make one, pay an order with a test token, then complete its fulfillment.
- A Location with a postal address to receive the item at.
The examples return one $24.00 mug with no tax, and assume no return policy covers it, which is true until you create one. Replace the example IDs with your own.
Find the line to return#
Ask Flint what the order can send back. The preview reserves nothing:
curl -X POST https://api.withflintpay.com/v1/return-previews \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "eligibility",
"eligibility": {
"order_id": "ord_1kmn0aExample",
"selection": { "selection_type": "all_remaining_fulfilled" }
}
}'
{
"data": {
"mode": "eligibility",
"eligibility": {
"order_id": "ord_1kmn0aExample",
"status": "review_required",
"line_items": [{
"order_line_item_id": "li_1kmn0aExample",
"fulfillment_id": "ful_1kmn0aExample",
"name": "Ceramic mug",
"can_buyer_request": false,
"eligibility": {
"status": "review_required",
"reason": "no_matching_policy",
"eligible_quantity": 1
}
}]
}
},
"request_id": "req_..."
}
Each line gives the order_line_item_id and fulfillment_id to return and how many units can still come back in eligible_quantity. review_required with no_matching_policy means no policy decides the request for you, so you decide it in the calls below.
Choose a return reason#
Every Return line needs the return_reason_id of an active reason. The examples use Flint's built-in changed_mind reason, rrsn_1T6HXAX0CEXP6YA5K1T392KJE6, which needs no note. Return reasons lists all nine built-in IDs. Some, such as defective and other, require a buyer_note on the line.
If your counter doesn't ask why things come back, create one reason of your own for it and send its ID on every line. Creating a reason needs commerce.returns.reasons.write:
curl -X POST https://api.withflintpay.com/v1/return-reasons \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: reason-in-store-001" \
-d '{
"handle": "in_store",
"name": "Returned in store",
"is_note_required": false
}'
Find it again later with GET /v1/return-reasons?handle=in_store.
Items are here#
At a counter the item is already in front of you, so one call records the decision, the receipt, where the item goes, and the refund.
Customer will send items back#
When the item is still with the customer, approve the Return first so they know where to send it, then record the arrival.
When a policy decides first#
Once you create return policies, a policy with automatic approval can open the Return on its own shortly after you create it, and Flint sends return.decision_recorded. Read the Return's status before you choose the process body:
requested. Send adecisionfor every line, as above. Fields you leave out default to the policy's proposal instead of Flint's no-policy defaults. A decision that differs from the proposal needs anoverride_reason.open. Leave outdecisionandcompletion_mode. Sending either unchanged is accepted; a different value is refused withfield_locked. If the line has anautomatic_resolution_type, Flint already created that resolution, so leave outresolutionand send only the receipt.
Errors to handle#
Deciding and processing lists every refusal on these routes and what details[0] names in each.
Retry a lost response#
Create and process require an Idempotency-Key. If a response is lost, send the same request again with the same key and body: Flint returns the original result and its IDs without moving stock or money twice. Derive the keys from something your system still has when the response disappears, such as the register transaction ID, as the examples do with pos-1042-0087.
To find a Return whose create response was lost, list GET /v1/returns?idempotency_key=pos-1042-0087-return. Recovery reads covers the other routes.
To guard against a concurrent change from another register or the Dashboard, send the version from your last read as expected_version on process or decide.
Webhooks#
Follow these to know where a Return stands without polling:
Webhooks on Returns lists the rest.
