Custom Fields with Ruby
Custom fields need to be created in the control panel before they can be used in the API. Custom fields are never required, so you can safely configure them before updating your code to pass them to the gateway. However, it doesn’t work the other way around – if you send a custom field in the API that you haven’t configured in the control panel you’ll get a validation error.
Custom field definitions have two fields:
- API name: identifier to be used when passing values in via the API; must start with a lower case letter followed by any number of lower case letters, numbers, and underscores
- Display name: field title that will be visible in the Control Panel
Once defined, custom fields can be associated with newly created transactions or customer Vault records.
Values passed to custom fields are restricted to a maximum length of 255 characters. Anything more than that will generate a “custom field is too long” validation error.
Types of Custom Fields
There are two types of custom fields, one which is stored along with its associated record in the gateway, and the other which is just passed through. All custom fields submitted in the API will be returned in the response. Only custom fields configured to be stored will be stored with the transaction or customer.
Pass Thru Field
Setting up a custom field as a pass thru field will cause any data entered into this field to be passed through the gateway. Data for this type of custom field is not stored in the gateway. This is intended to be used with the Transparent Redirect API.
Stored and Pass Thru Field
In addition to being passed back in responses from the gateway, the data for a Stored and Pass Thru custom field is stored in the gateway.