Many products require a special set of inputs to process a payment. For example a RTR prepaid plan requires enter the customer phone in order to perform a replenishment, others products use a variable price, in these cases the customer must enter the amount to pay.

In order to request all inputs required for some product can use a query like this:

query ($id: ID!) {
  node(id: $id) {
    ... on Product {
      inputs {
        name
        type
        required
        label
        html {
          type
          maxlength
          minlength
          min
          max
          pattern
        }
      }
    }
  }
}
{
  "id": "ji12sd4c0a3D0="
}
{
  "data": {
    "node": {
      "inputs": [
        {
          "name": "amount",
          "type": "float",
          "required": true,
          "label": "Amount",
          "html": {
            "type": "number",
            "maxlength": null,
            "minlength": null,
            "min": 3,
            "max": 299,
            "pattern": null
          }
        },
        {
          "name": "accountNumber",
          "type": "phone",
          "required": true,
          "label": "Phone Number",
          "html": {
            "type": "tel",
            "maxlength": null,
            "minlength": null,
            "min": null,
            "max": null,
            "pattern": "/^\\+\\d{10,11}$/"
          }
        }
      ]
    }
  }
}

In the above query the requested product return two inputs, amount and accountNumber, because these two fields are required submit a transaction without these inputs will be fail.

Each input has the following properties:

  • name: (string) name of the field, used later to set a value and submit the transaction
  • type: (InputFieldType) internal field type
  • required: (boolean) required field or optional
  • label: (label) optional label to display to final users
  • html: (InputFieldHtmlAttr) set of html attributes that can be used to build the UI.

Must use products inputs to request information to the customer before process a payment, for example in the above query must create a form with two inputs, example: