Payments¶
Payments use credits on a ledger service. Amounts are integers.
Flow¶
- The caller asks the ledger to hold the price for the provider and route. The hold expires after 900 seconds.
- The request carries the ledger's signed confirmation.
- The provider verifies it, and that the hold was not used before, and runs the work.
- On success, the provider captures the hold with the digest of the result. On failure, it cancels the hold, and the caller is refunded.
- The reply carries the ledger's signed receipt. The caller verifies that it names this hold and this result.
If the provider disappears, the hold expires and is refunded.
Accounts¶
curl -X POST http://ledger:8080/v1/fund -H "Authorization: Bearer $LEDGER_TOKEN" -H "Content-Type: application/json" \
-d '{"aid": "<identifier>", "amount": 1000, "ref": "invoice-7"}'
curl http://ledger:8080/v1/balance/<identifier> -H "Authorization: Bearer $LEDGER_TOKEN"
Funding with the same ref is applied once.
Audit¶
Every movement is a row in an append-only journal. GET /v1/audit compares issued credits with balances and holds and reports consistent.