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
  1. Basics

Create a card

Simple card creation

Configuration

Variable

Description

account_id

sales_channel_id

Sales channels allow reporting by the source of an order. Commonly used are:

3 - In store

5 - B2B

7 - Guest Gratuity

product_id

merchant_id

Orders can be linked back to specific merchants. You can use 26 as a catch-all "third party" merchant. But if you are an official Toggle partner, you'll have been issued your own merchant_id.


mutation(
  $account_id                   : Int!
  $order_items                  : [OrderItemInput]!
  $total                        : Int!
  $currency                     : String!
  $group_fulfilment             : Boolean!
  $sales_channel_id             : Int!
  $auto_fulfil_group_fulfilment : Boolean!
  $merchant_id                  : Int!
  
) {
  createOrder(
    account_id                   :   $account_id,  
    order_items                  :   $order_items,
    total                        :   $total,
    currency                     :   $currency,
    group_fulfilment             :   $group_fulfilment,
    sales_channel_id             :   $sales_channel_id,
    auto_fulfil_group_fulfilment :   $auto_fulfil_group_fulfilment,
    merchant_id                  :   $merchant_id
  ) {
    LineItems{
        Card{
            id,
            card_reference,
            pin,
            balance
        }
    }
  }
}
{
	"account_id": 3,
	"order_items": [
		{
			"product_id": 1591,
			"custom_price_modifier_value": 1000, // £10 card
			"fulfilment_method_id": 8, // "Third party"
      "discounts": [
				{
					"discount_type_id": 1, // Discount type "FOC"
					"value": 1000 // £10 discount 
				}
			]
		}
	],
	"currency": "GBP",
	"total": 0, // No money taken for this card, so transaction total is "£0"
	"group_fulfilment": true, // Mandatory
	"sales_channel_id": 3, // 3 = "In store"
	"auto_fulfil_group_fulfilment": true, // don't hold order open pending dispatch
	"merchant_id" : 26 // 26 = "Third party" merchant
}
PreviousCard number formatsNextCheck a card balance

Last updated 3 years ago

This represents the Toggle account that you are connecting to. You can get a list of accounts linked with your API user .

All cards created need to be associated back to a product. Products can be created in the Toggle dashboard. You can retrieve a list of products for an account .

using an Accounts query
using the Products query