Examples Submit Transaction E-Gift Product Purchase
February 14, 2023 at 10:38 AME-Gift Card products are similar to PIN products and commonly (not always) return a PIN (Card Number). Some of these products may require some users inputs to proceed.
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. Firstly must get all products inputs required to make the refill.
query ($id: ID!) {
node(id: $id) {
... on Product {
isPIN
inputs {
name
type
required
label
html {
type
maxlength
minlength
min
max
pattern
}
}
}
}
}
{
"id": "14231h4PQ=="
}
{
"data": {
"node": {
"isPIN": true,
"inputs": [
{
"name": "amount",
"type": "float",
"required": true,
"label": "Amount",
"html": {
"type": "number",
"maxlength": null,
"minlength": null,
"min": 1,
"max": 100,
"pattern": null
}
},
{
"name": "accountNumber",
"type": "email",
"required": true,
"label": "Email",
"html": {
"type": "email",
"maxlength": null,
"minlength": null,
"min": null,
"max": null,
"pattern": null
}
}
]
}
}
}
Then submit the transaction with all user inputs
mutation ($input: SubmitTransactionInput!) {
transactions {
submit(input: $input) {
transaction {
date
status
grossTotal
adjustments {
name
total
}
total
response {
... on PinSaleResponse {
pin
code
}
message
redemptionUrl
}
}
}
}
}
{
"input": {
"product": "14231h4PQ==",
"inputs": { "amount": 5, "accountNumber" : "[email protected]" }
}
}
{
"data": {
"transactions": {
"submit": {
"transaction": {
"date": "2020-12-16T13:10:43-05:00",
"status": "COMPLETED",
"grossTotal": 5,
"adjustments": [],
"total": 5,
"response": {
"pin": "600631232272957187",
"code": "1312",
"redemptionUrl": "https://paynup.link/1x423a3a",
"message": "Your eGift Card is ready to activate"
}
}
}
}
}
}
These products have a different behavior based on the response, some products return the pin
, code
and redemptionUrl
and other only the redemptionUrl
, must display all available values in the receipt.
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