mirror of
https://github.com/luxfi/treasury.git
synced 2026-10-30 15:15:00 +00:00
CreatePayment now sets the JSON body field idempotency_key (Square's required shape — per developer.squareup.com/docs/working-with-apis/ idempotency, NOT a header) from req.IdempotencyKey. Drops the previous wall-clock-derived "lux_<UnixNano>" value, which was worse than nothing because retries got fresh keys and Square would happily create duplicate payments. Empty IdempotencyKey now falls back to provider.DeriveIdempotencyKey, computed over the body BEFORE the idempotency_key field is added to avoid self-feedback. Hermetic httptest covers caller-supplied (body-field) and deterministic-fallback paths.