Currently, if an amend() call is made, the Zuora API will sometimes respond with a 504 - Gateway Timeout. However, the amend continues in the background for an indeterminate period of time until it completes. The problem is that when we receive an error from Zuora, we assume it failed, so we attempt to retry it until it succeeds. This leads to billing the customer multiple times for the same item, since we don't know if it succeeded or failed. We've attempted to use a read-ahead before doing the amendments to ensure that the rate plan charges do not exist on the subscription, but that doesn't work when the amend call is still running in the background for some indeterminate period of time. Since there's no way to know how long is "long enough" to wait for it to finish, the only way for client code to guarantee that something is billed exactly once is to amend until it succeeds, then read the subscription back afterwards and remove duplicate rate plan charges that may have been created accidentally. Since that solution is very onerous to all clients, instead the Zuora amend API should be transactional - that is, if an error code is sent to the client, the entire operation should fail and roll back. This is the typical, expected pattern when it comes to billing software.
... View more