# Rollback, Export and Audit

> **Info:**
All three read the [transaction log](transaction-log.md), so they only see changes it still keeps. The confirmation time is in config.yml and **Editor > Settings > Payments**.

## Rollback

`/pcur rollback <player> [currency] <time|#id>` undoes either every change of the player in the last stretch of time, such as `2h` or `3d`, or the single transaction with that id. It needs `phoenixcurrencies.command.rollback`.

<figure><img src="../.gitbook/assets/settings/rollback-confirmation-time.png" alt="" width="563"><figcaption><p>Payments (Rollback Confirmation Time)</p></figcaption></figure>

It first shows what each account gains or loses, per currency, and does nothing until `/pcur rollback confirm`, or the **Confirm** button, within the confirmation time.

| Change | Rolled back as |
| ------ | -------------- |
| Payment | Both sides, and the fee, even when only one player was named |
| Exchange | Both currencies |
| Banknote withdrawn, note not redeemed yet | The note is voided, so it pays nothing, and the money is refunded |
| Banknote withdrawn, note already redeemed | Kept, since the money already reached the redeemer; the preview counts them |
| Banknote redeemed | The amount is taken back; the note stays used |
| Anything else | The opposite change |

Every transaction is rolled back once at most, and the rollback itself is logged with the reason Rollback. When an account no longer has enough, what it has is taken and the shortfall is reported.

## Export

`/pcur export <player|all> [currency] [days]` writes the log to a CSV file in the exports folder, in the background, one row per change with its id, time, player, currency, change, balance after it, reason, who made it, the transfer it belongs to and whether it was rolled back. Without days it writes everything the log keeps. It needs `phoenixcurrencies.command.export`.

<figure><img src="../.gitbook/assets/transaction-log/export.png" alt="" width="563"><figcaption><p>Transactions (Export)</p></figcaption></figure>

## Audit

`/pcur audit [currency]` compares each account's balance with the balance its last logged change left it at, and reports the accounts that differ and by how much in total. A difference means money moved without a log line: an edit straight in the database, a plugin writing balances itself, or the log being off for a while. Accounts with no logged change are counted, not compared. It needs `phoenixcurrencies.command.audit`.

Balance writes still waiting in the queue show as a difference until they finish; the audit says how many are waiting.

Source: https://www.phoenixplugins.com/docs/phoenix-currencies/features/rollback-and-audit