Reversals

When either creating an order or redeeming a card, you will also need to build in the functionality to reverse that action. For example, if a staff member selling or redeeming the card on-site needs to undo what they did.

To reverse a transaction, make a mutation request to createReversal.

Take a look at the API playground example >

What line item ID should I use?

As you'll see, you also need to provide the line item you wish to reverse. To find this, you'll first need to make another query to fetch this for the transaction that you are trying to reverse.

query($page: Int!, $limit: Int!, $merchant_transaction_reference: String!) {
  LineItems(
    page: $page
    limit: $limit
    merchant_transaction_reference: $merchant_transaction_reference
  ) {
    data {
      id
    }
  }
}

This will give you the line item ID for the transaction you are trying to reverse.

What merchant transaction reference should I use?

The merchant_transaction_reference you pass in for the reversal is expected to be a uniquely generated reference (e.g. an identifier of the reversal transaction on the till).

If your system doesn't create transaction references for reversals, then you could potentially just append "-REVERSAL" on the end of the original reference. e.g. "test-123-123-123-REVERSAL"

This use-case is aimed at book-keepers and for troubleshooting, whereby if someone downloaded, say, a CSV list of till transactions (e.g. card sales, redemptions, reversals etc.) and each has a unique till transaction identifier, then if someone pulled down an equivalent CSV list of balance adjustments on the Toggle side, someone could - if needs be - match them up with your unique identifier for each one.

What about partial refunds?

With the CreateReversal mutation you can only refund the full value of the LineItem you are wanting to refund.

In order to do partial refunds you would need to refund the whole line item and then subsequently create a new balance adjustment with the corrected value.

Last updated