Examples Submit Transaction Gift Card Activation
February 14, 2023 at 10:38 AMGift Card activations have a special input type called magdata
when a product return this type of input you must
integrate a special card reader to read magnetic card information.
What is the difference between a Gift Card and an E-Gift Card?: Gift Card is a plastic card that can be used for online, catalog and outlet store purchases. An E-Gift Card (“E” signifying electronic) works the same way as the plastic version but it’s sent electronically to an e-mail address or printed in the receipt and can be redeemed at any moment.
query ($id: ID!) {
node(id: $id) {
... on Product {
isPIN
inputs {
name
type
required
label
html {
type
maxlength
minlength
min
max
pattern
}
}
}
}
}
{
"id": "s31hcmQ6MzI4MzM="
}
{
"data": {
"node": {
"inputs": [
{
"name": "cardMagData",
"type": "magdata",
"required": false,
"label": "Card Mag Data",
"html": {
"type": "hidden",
"maxlength": null,
"minlength": null,
"min": null,
"max": null,
"pattern": null
}
},
{
"name": "accountNumber",
"type": "string",
"required": true,
"label": "Account Number",
"html": {
"type": "hidden",
"maxlength": null,
"minlength": null,
"min": null,
"max": null,
"pattern": null
}
}
]
}
}
}
The input magdata
is optional because not all gift cards have magnetic stripe and instead use barcode.
In both cases must sent always the accountNumber
, this number for Gift Cards with magnetic stripe must
be extracted from magnetic information and in cards using barcode is the code number.
To extract accountNumber
from magnetic stripe you must read the mangnetic
information and then you get something like this:
%B6058124181523113132^79936670109$05000$^0000000000?
;6058124181523113132=0000000000?
The magdata
contains two lines, track1 and track2.
The accountNumber
is the number between %B
and ^
sentinels, in this case: 6058124181523113132
For cards using magnetic stripe you must send always the entire
magdata
concatenating both tracks using (\n
) line separator and theaccountNumber
. For cards using only barcode you need send only theaccountNumber
Activate Gift Card with magnetic stripe:
mutation ($input: SubmitTransactionInput!) {
transactions {
submit(input: $input) {
transaction {
date
status
grossTotal
adjustments {
name
total
}
total
response {
... on PinSaleResponse {
pin
}
message
}
}
}
}
}
{
"input": {
"product": "RWa1ZUVkVK21==",
"inputs": {
"cardMagData": "%B6058124181523113132^79936670109$05000$^0000000000?\n;6058124181523113132=0000000000?",
"accountNumber": "6058124181523113132"
},
}
}
{
"data": {
"transactions": {
"submit": {
"transaction": {
"date": "2020-12-16T13:40:01-05:00",
"status": "COMPLETED",
"grossTotal": 50,
"adjustments": [],
"total": 50,
"response": {
"message": "Gift Card activated."
}
}
}
}
}
}
The response has more properties than shown here, this is a basic example, to see all possible properties look for the
SubmitTransactionPayload
type object in the explorer