How to detach a payment from an invoice?
Certain use cases may require to "unlink" a registered payment from an invoice – a wrong automatic assignment, a user's mistake, a manual solution for some dispute, etc.
To prevent errors in any further operations, make sure to follow these steps when doing so:
-
Unregister the wrong payment balance from the invoice.
For details, see Manually Unassigning Balance From Invoice.
-
Create an "offsetting" balance on the account.
Make sure to not use
Clearing
as the type for the new balance, because this may produce errors in possible future operations. UsePayout
,Refund
or a custom type.For details, see Creating Balance on Account.
The first step revokes the assignment of the wrong payment to the current invoice, cleaning the invoice balance. The unlinked balance is assigned to the account. The second step offsets the payment balance on the account, cleaning the account balance.
This approach makes sure that any possible future operations, like cancellations, settlements or bookkeeping data generation, will not conflict with the originally wrong balance and its offsetting balance.