Examples Submit Transaction PIN Product Purchase
February 14, 2023 at 10:38 AMPrepaid PIN based products generally do not require any user input,
in this case, for example, the product have an input labeled “Phone Number”, but it is not required.
You can decide if you need to show this input to your client or not.
Can use the property isPIN
to know if the product is a PIN based product or RTR.
PIN based products unlike RTR products does not refill or credit the user account, instead return a PIN in the transaction response
Firstly must get all products inputs required to purchase the PIN.
query ($id: ID!) {
node(id: $id) {
... on Product {
isPIN
inputs {
name
type
required
label
html {
type
maxlength
minlength
min
max
pattern
}
}
}
}
}
{
"id": "amkxMWQ0YzBhM0QwPQ=="
}
{
"data": {
"node": {
"isPIN": true,
"inputs": [
{
"name": "accountNumber",
"type": "phone",
"required": false,
"label": "Phone Number",
"html": {
"type": "tel",
"maxlength": null,
"minlength": null,
"min": null,
"max": null,
"pattern": null
}
}
]
}
}
}
Then submit the transaction (in this example without any user input)
mutation ($input: SubmitTransactionInput!) {
transactions {
submit(input: $input) {
transaction {
date
status
grossTotal
adjustments {
name
total
}
total
response {
... on PinSaleResponse {
pin
code
}
message
redemptionUrl
}
}
}
}
}
{
"input": {
"product": "amkxMWQ0YzBhM0QwPQ==",
"inputs": {}
}
}
{
"data": {
"transactions": {
"submit": {
"transaction": {
"date": "2020-12-16T12:46:41-05:00",
"status": "COMPLETED",
"grossTotal": 5,
"adjustments": [
{
"name": "E911 User Fee",
"total": 0.4
},
{
"name": "Discount",
"total": -0.5
}
],
"total": 4.9,
"response": {
"pin": "10097505452535",
"code": null,
"redemptionUrl": null,
"message": "<p>To redeem PIN Dial #289 from your phone and follow the prompts. Or, dial 1-866-594-3644 on any touch-tone phone.</p>"
}
}
}
}
}
}
For these products you need display the PIN in the customer receipt
and if the field redemptionUrl
have a valid url must display a link to given url to allow the customer redeem the PIN directly on given url.
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