Skip to content

Commit c13f384

Browse files
author
MostronatorCoder[bot]
committed
docs: add payment-failed documentation
Clarifies that payment-failed is an Action (notification), NOT an order Status. Key points documented: - Order remains in settled-hold-invoice status during payment retries - Mostro retries automatically based on payment_attempts and interval - If all retries fail, Mostro sends add-invoice for buyer to provide new invoice - Clients should NOT create a PaymentFailed order status Also updated release.md to reference the new payment_failed.md page.
1 parent 2c96971 commit c13f384

3 files changed

Lines changed: 116 additions & 1 deletion

File tree

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [Seller pays hold invoice](./seller_pay_hold_invoice.md)
2020
- [Fiat sent](./fiatsent.md)
2121
- [Release](./release.md)
22+
- [Payment Failed](./payment_failed.md)
2223
- [Rate user](./user_rating.md)
2324
- [Cancel](./cancel.md)
2425
- [Peer-to-peer Chat](./chat.md)

src/payment_failed.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Payment Failed
2+
3+
After the seller releases the sats, Mostro attempts to pay the buyer's Lightning invoice. If this payment fails, Mostro sends a `payment-failed` action to the buyer.
4+
5+
> ⚠️ **Important:** `payment-failed` is an **Action** (notification), NOT an order **Status**. The order remains in `settled-hold-invoice` status while Mostro retries the payment.
6+
7+
## When Payment Fails
8+
9+
When Mostro cannot pay the buyer's Lightning invoice, it sends this message to the buyer:
10+
11+
```json
12+
[
13+
{
14+
"order": {
15+
"version": 1,
16+
"id": "<Order Id>",
17+
"action": "payment-failed",
18+
"payload": {
19+
"payment_failed": {
20+
"payment_attempts": 3,
21+
"payment_retries_interval": 5
22+
}
23+
}
24+
}
25+
},
26+
null
27+
]
28+
```
29+
30+
### Payload Fields
31+
32+
| Field | Type | Description |
33+
|-------|------|-------------|
34+
| `payment_attempts` | integer | Number of retry attempts remaining |
35+
| `payment_retries_interval` | integer | Minutes between retry attempts |
36+
37+
## What Happens Next
38+
39+
1. **Automatic retries**: Mostro will automatically retry the payment according to `payment_attempts` and `payment_retries_interval`
40+
41+
2. **Order status unchanged**: The order remains in `settled-hold-invoice` status during retries
42+
43+
3. **All retries failed**: If all payment attempts fail, Mostro sends `add-invoice` action requesting the buyer to provide a new Lightning invoice:
44+
45+
```json
46+
[
47+
{
48+
"order": {
49+
"version": 1,
50+
"id": "<Order Id>",
51+
"action": "add-invoice",
52+
"payload": {
53+
"order": {
54+
"id": "<Order Id>",
55+
"amount": 50000,
56+
...
57+
}
58+
}
59+
}
60+
},
61+
null
62+
]
63+
```
64+
65+
4. **Buyer provides new invoice**: The buyer must submit a new Lightning invoice for the sats to be delivered
66+
67+
## Client Implementation Notes
68+
69+
- **Do NOT create a "PaymentFailed" order status** — this action is a notification only
70+
- Display a message to the buyer explaining the payment failed and retries are in progress
71+
- When `add-invoice` is received after failed retries, prompt the buyer to provide a new invoice
72+
- The sats remain safely locked in escrow (`settled-hold-invoice`) throughout this process
73+
74+
## Flow Diagram
75+
76+
```text
77+
Seller releases sats
78+
79+
80+
Order status: settled-hold-invoice
81+
82+
83+
Mostro attempts Lightning payment
84+
85+
├─── Success ──────────────► Order status: success
86+
│ (buyer receives purchase-completed)
87+
88+
└─── Failure
89+
90+
91+
Action: payment-failed (to buyer)
92+
Order status: still settled-hold-invoice
93+
94+
95+
Mostro retries (up to payment_attempts times)
96+
97+
├─── Retry succeeds ──► Order status: success
98+
99+
└─── All retries fail
100+
101+
102+
Action: add-invoice (to buyer)
103+
Buyer provides new invoice
104+
105+
106+
Mostro pays new invoice ──► Order status: success
107+
```
108+
109+
## Related Actions
110+
111+
- [release](./release.md) - Seller releases sats
112+
- [add-invoice](./take_sell.md) - Buyer provides Lightning invoice

src/release.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ And a message to the buyer to let him know that the sats were released:
5454

5555
## Buyer receives sats
5656

57-
Right after seller release sats Mostro will attempt to pay the buyer's lightning invoice. When the payment succeeds, Mostro will send a message to the buyer indicating that the purchase was completed:
57+
Right after seller releases sats, Mostro will attempt to pay the buyer's Lightning invoice. When the payment succeeds, Mostro will send a message to the buyer indicating that the purchase was completed:
58+
59+
> **Note:** If the Lightning payment fails, Mostro will retry automatically. See [Payment Failed](./payment_failed.md) for details on how payment failures are handled.
5860
5961
```json
6062
[

0 commit comments

Comments
 (0)