When to use it
Use it to design an after-sales system, to integrate a payment channel's refund API, or to give support and finance one shared view of where a refund stands. There are two paths: refund-only goes straight to processing once approved, while return-and-refund passes through the buyer shipping and the seller receiving, with timeout rules along the way.
Make it yours
- Put the time limit in the trigger text, such as "Seller timeout after 48 hours auto-approves".
- A store with no marketplace arbitration can delete Dispute and its transitions.
- Partial refunds can use the same states with the refunded amount recorded on the order.
Mermaid code
stateDiagram-v2
[*] --> PendingReview : Buyer requests refund
PendingReview --> Cancelled : Buyer cancels
PendingReview --> Rejected : Seller rejects
PendingReview --> Processing : Refund only and seller agrees
PendingReview --> AwaitingReturn : Return and refund and seller agrees
PendingReview --> Processing : Seller timeout auto-approves
AwaitingReturn --> AwaitingReceipt : Buyer enters tracking number
AwaitingReturn --> Cancelled : Not shipped in time
AwaitingReceipt --> Processing : Seller confirms receipt
AwaitingReceipt --> Rejected : Item fails inspection
Rejected --> PendingReview : Buyer edits and reapplies
Rejected --> Dispute : Buyer appeals
Dispute --> Processing : Decided for buyer
Dispute --> Rejected : Decided for seller
Processing --> Refunded : Payment channel completes refund
Processing --> Processing : Retry after channel failure
Refunded --> [*]
Cancelled --> [*]Ask an AI for one with this structure
Send the prompt below to ChatGPT or Claude, then paste the whole reply into the editor; the code inside is detected automatically.
Draw a refund status state diagram with Mermaid stateDiagram-v2 syntax. A buyer request enters PendingReview. The buyer may cancel and the seller may reject. Refund-only with seller agreement goes to Processing; return-and-refund with agreement goes to AwaitingReturn; a seller timeout auto-approves. Entering a tracking number moves to AwaitingReceipt, and not shipping in time cancels. Confirmed receipt goes to Processing, and a failed inspection is Rejected. After rejection the buyer may reapply or appeal into Dispute. Processing becomes Refunded when the payment channel completes, and retries on failure. Use state names without spaces and write the trigger after a colon. Output only the mermaid code block.
FAQ
- Can two lines go from one state to the same target?
Yes. PendingReview has two lines to Processing, one for seller agreement and one for automatic approval on timeout, which are different triggers.
- How long does a refund take to arrive?
That depends on the payment channel and bank, so the diagram gives no time. Follow your payment channel's documentation.
- Is there a template for the returns procedure?
Yes. The returns and exchanges flowchart in the library shows what support and the warehouse do and pairs with this state diagram.
More in this category
Updated 2026-11-11