Cards & Wallets · PaySuite payment page · Advanced features

Custom Fields

Send custom fields when you create a PaySuite Payment Page session to capture extra information from your customer, such as discount codes or terms acceptance.

For an overview of custom fields, including how they work when using the PaySuite Payment Page, see Custom fields.

Within the PaySuite Payment Page you can configure fields for customer input, examples include:

  • the type of field: text entry field, multiple radio button selection, multiple dropdown selection or simply additional text on page
  • the content of the field: default values, options available, masked values
  • text for the field label
  • the name of the field that we’ll send back to you in responses, call-backs and notifications if it needs to differ from the customer facing description
  • the position of the field on the hosted page: form top (before the payment capture fields) or form bottom (after the payment capture fields).

When you create a hosted payment session, add a customFields object to the request body. It contains an array called dataFieldOrTextFieldOrLabelField, where each element can be one of the following types:

Field typeDescription
dataFieldA plain name/value field.
textFieldA text entry field shown on the hosted page.
labelFieldAdditional descriptive text shown on the hosted page.
radioFieldA set of radio buttons with predefined options.
passwordFieldA masked text entry field.
selectFieldA dropdown list with predefined options.
skinFieldA field passed to the skin for custom rendering.

Common properties for each field are:

PropertyTypeDescription
namestringThe field name returned to you in responses, callbacks and notifications.
valuestringThe default or selected value of the field. For skinField this can be a JSON string.
transientbooleanIf true, the value is not stored as part of the transaction.
locatorstringWhere the field appears on the page. Use FORM_TOP for before the payment fields, or FORM_BOTTOM for after them.
optionsobjectFor radioField and selectField, the list of choices with label and value pairs.
maxLengthintegerFor passwordField, the maximum number of characters.
formatstringFor skinField, the content type of the value, for example application/json.

Create a hosted payment session with custom fields

The example below creates a payment session with several custom fields. The values your customer enters are returned to you on the transaction, in callbacks and in notifications.

Create a payment session with custom fields
EndpointDefinition
POST /hosted/rest/sessions/{instId}/payments
Request body
{
  "session": {
    "returnUrl": {
      "url": "https://www.example.com/return"
    }
  },
  "transaction": {
    "money": {
      "currency": "GBP",
      "amount": {
        "fixed": 10.00
      }
    },
    "merchantReference": "SESS-CF-0001"
  },
  "customFields": {
    "dataFieldOrTextFieldOrLabelField": [
      {
        "dataField": {
          "name": "customerAccountRef",
          "value": "CUST-1234",
          "transient": false
        }
      },
      {
        "labelField": {
          "name": "discountLabel",
          "value": "Have a discount code? Enter it below.",
          "transient": true,
          "locator": "FORM_TOP"
        }
      },
      {
        "textField": {
          "name": "discountCode",
          "value": "SUMMER2025",
          "transient": false,
          "locator": "FORM_TOP"
        }
      },
      {
        "selectField": {
          "name": "deliveryOption",
          "value": "standard",
          "transient": false,
          "locator": "FORM_BOTTOM",
          "options": {
            "option": [
              {
                "label": "Standard delivery",
                "value": "standard"
              },
              {
                "label": "Next day delivery",
                "value": "nextday"
              }
            ]
          }
        }
      },
      {
        "radioField": {
          "name": "termsAccepted",
          "value": "yes",
          "transient": false,
          "locator": "FORM_BOTTOM",
          "options": {
            "option": [
              {
                "label": "I accept the terms and conditions",
                "value": "yes"
              },
              {
                "label": "I do not accept",
                "value": "no"
              }
            ]
          }
        }
      },
      {
        "passwordField": {
          "name": "membershipNumber",
          "value": "",
          "transient": false,
          "locator": "FORM_TOP",
          "maxLength": 11
        }
      }
    ]
  }
}
cURL
curl -X POST "{targetEnvironmentPath}/hosted/rest/sessions/{instId}/payments" \
  -u "{apiUser}:{apiPassword}" \
  -H "Content-Type: application/json" \
  -d '{
  "session": {
    "returnUrl": {
      "url": "https://www.example.com/return"
    }
  },
  "transaction": {
    "money": {
      "currency": "GBP",
      "amount": {
        "fixed": 10.00
      }
    },
    "merchantReference": "SESS-CF-0001"
  },
  "customFields": {
    "dataFieldOrTextFieldOrLabelField": [
      {
        "dataField": {
          "name": "customerAccountRef",
          "value": "CUST-1234",
          "transient": false
        }
      },
      {
        "labelField": {
          "name": "discountLabel",
          "value": "Have a discount code? Enter it below.",
          "transient": true,
          "locator": "FORM_TOP"
        }
      },
      {
        "textField": {
          "name": "discountCode",
          "value": "SUMMER2025",
          "transient": false,
          "locator": "FORM_TOP"
        }
      },
      {
        "selectField": {
          "name": "deliveryOption",
          "value": "standard",
          "transient": false,
          "locator": "FORM_BOTTOM",
          "options": {
            "option": [
              {
                "label": "Standard delivery",
                "value": "standard"
              },
              {
                "label": "Next day delivery",
                "value": "nextday"
              }
            ]
          }
        }
      },
      {
        "radioField": {
          "name": "termsAccepted",
          "value": "yes",
          "transient": false,
          "locator": "FORM_BOTTOM",
          "options": {
            "option": [
              {
                "label": "I accept the terms and conditions",
                "value": "yes"
              },
              {
                "label": "I do not accept",
                "value": "no"
              }
            ]
          }
        }
      },
      {
        "passwordField": {
          "name": "membershipNumber",
          "value": "",
          "transient": false,
          "locator": "FORM_TOP",
          "maxLength": 11
        }
      }
    ]
  }
}'
Response
HTTP/1.1 201 Created

{
  "sessionId": "SMjrMTP1q7iRK4YIMxyfAbza5",
  "redirectUrl": "https://secure.mite.pay360.com/hosted/SMjrMTP1q7iRK4YIMxyfAbza5/begin/SMjrMTP1q7iRK4YIMxyfAbza5",
  "status": "SUCCESS"
}