Toggle Developers
HomeAcademy
  • Welcome
  • GraphQL
    • Getting started
    • Exploring our API
    • Authentication
    • API playground
    • Error handling
  • Key concepts
    • Overview
      • Orders, Transactions & Line Items
      • Card number formats
  • Basics
    • Create a card
    • Check a card balance
    • Redeem a card
  • Webhooks
    • Overview
      • Getting started
      • Authentication & responses
    • Events
      • Card.balance_adjusted
      • Card.card_reference_updated
      • Card.expiry_reminder
      • Card.registered
      • Card.send_recipient_email
      • Card.resend_recipient_email
      • Order.created
      • Order.cancelled
      • Order.send_receipt_email
      • Order.send_cancellation_email
      • Payment.failed
      • Payment.review_opened
      • Fulfilment.dispatched
  • Partner Guides
    • EPOS & Ordering
      • Overview
      • Accreditation
      • Configuration variables
      • Playground examples
      • Physical card orders
      • Custom validity rules
      • Balance check
      • Redemptions & top-ups
      • Reversals
    • Guest gratuity
      • Overview
      • Accreditation
      • Configuration variables
      • Playground examples
      • Creating a card
      • Cancelling a card
      • Register a card
    • CRM
      • Overview
      • Historic data via GraphQL
      • Real time data via webhooks
Powered by GitBook
On this page
  • What line item ID should I use?
  • What merchant transaction reference should I use?
  1. Partner Guides
  2. Guest gratuity

Cancelling a card

PreviousCreating a cardNextRegister a card

Last updated 3 years ago

If a card has been created in error, you can reverse the transaction that created it. This may or may not be relevant depending if a card cancellation is a requirement on your particular integration.

You can view how to perform a createReversal on the

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
    }
  }
}
{
  "merchant_transaction_reference": "test-123-123-123",
  "page": 1,
  "limit": 1
}

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.

API playground examples >