Setting a custom idempotency key via extra_headers={'Idempotency-Key': 'mykey123'} on e.g. client.payment_orders.create(...) didn't stick: framework code looked for options.idempotency_key and overwrote the header with its own generated self._idempotency_key(). A maintainer confirmed this was a bug. The reporter's interim workaround was to assign client._idempotency_key to a custom function after creating the client.
modern-treasury python: Idempotency-Key passed via extra_headers gets overwritten
Confirmed bug: the SDK ignored a manually provided Idempotency-Key header and replaced it with an auto-generated one. The maintainer said the fix would add an idempotency_key kwarg and also honor a manually provided header; the fix was merged and released in 1.10. Until you can upgrade, the reporter's workaround is to override client._idempotency_key with your own function after constructing the client. Source: https://github.com/Modern-Treasury/modern-treasury-python/issues/70
Source: https://github.com/Modern-Treasury/modern-treasury-python/issues/70