---
title: "Amounts and orders · Agent Wranglers"
url: https://agentwranglers.se/playbook/payments/amounts-and-orders
updated: 2026-10-20
licence: "All rights reserved"
---

# Amounts and orders

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> Hold money as integers with a currency, freeze what the customer agreed to, move orders through fixed states and never charge the same order twice.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers payments playbook: https://agentwranglers.se/playbook/payments/amounts-and-orders`.

## Required

- [Hold money as integer minor units everywhere](https://agentwranglers.se/playbook/payments/amounts-and-orders/money-in-minor-units): Hold every amount as an integer count of the currency's minor unit, with its ISO 4217 code, in code, database, provider calls and stored events.
- [Freeze what the customer agreed to on the order](https://agentwranglers.se/playbook/payments/amounts-and-orders/order-snapshot): When the order is created, copy the unit price, quantity, discount, tax rate, tax amount and currency onto each line. Never recompute them from the catalogue.
- [Move orders through a fixed set of states](https://agentwranglers.se/playbook/payments/amounts-and-orders/payment-state-machine): Give orders a fixed list of states and allowed transitions in one place, and refuse any other change with a conditional database update.
- [Create each charge with an idempotency key](https://agentwranglers.se/playbook/payments/amounts-and-orders/idempotent-charge-creation): Send an idempotency key, built from your own stable IDs, on every provider request that creates a payment, a refund or a payout.
- [Keep one open payment per order](https://agentwranglers.se/playbook/payments/amounts-and-orders/one-open-payment-per-order): Allow at most one open payment attempt per order, and reuse it when the customer comes back to checkout.

## Recommended

- [Split amounts without losing a cent](https://agentwranglers.se/playbook/payments/amounts-and-orders/allocate-remainders): When you split an amount, such as instalments or a discount across lines, hand out the leftover minor units in a fixed order. The parts must sum exactly to the total.

- Previous: [Checkout and card data](https://agentwranglers.se/playbook/payments/checkout-and-card-data)
- Next: [Payment events and reconciliation](https://agentwranglers.se/playbook/payments/payment-events-and-reconciliation)
- [All chapters](https://agentwranglers.se/playbook/payments)
