Skip to main content
Version: 1.0

Card Formats

Introduction

Card formats determine how reader output should be interpreted. There are two types of card formats:

  • Standard: The standard schema contains a set of properties that determine how reader output should be interpreted. Note that this schema type is distinct from the standard property at the root of the card format object, which indicates whether a card format was provided by PDK.

  • Custom: The custom js schema contains a user-defined JavaScript module, which can be used to interpret output from uncommon or proprietary readers.

The card format object

{
"id": 1,
"name": "Standard 26-bit Format",
"schema": {
"type": "standard",
"num_bits": 26,
"default_min_bits": 20,
"default_max_bits": 32,
"cardholder_id_bits": 16,
"cardholder_start_address": 9,
"num_bits_to_sum_for_even_parity": 13,
"even_start_address": 0,
"num_bits_to_sum_for_odd_parity": 13,
"odd_start_address": 13,
"facility_code": {
"num_facility_code_bits": 8,
"facility_start_address": 1
}
},
"standard": true
}
PropertyTypeDescription
idIntegerThe card format ID.
nameStringThe card format name.
schema.typeStringThe card format schema type. Possible values include standard and js.
schema.num_bitsIntegerThe nominal number of bits in the card number.
schema.default_min_bitsIntegerThe minimum number of bits in the card number.
schema.default_max_bitsIntegerThe maximum number of bits in the card number.
schema.cardholder_id_bitsIntegerThe number of bits in the cardholder ID.
schema.cardholder_start_addressIntegerThe starting address of the cardholder ID.
schema.num_bits_to_sum_for_even_parityIntegerThe number of bits to sum for even parity.
schema.even_start_addressIntegerThe starting address for even parity.
schema.num_bits_to_sum_for_odd_parityIntegerThe number of bits to sum for odd parity.
schema.odd_start_addressIntegerThe starting address for odd parity.
schema.facility_code.num_facility_code_bitsIntegerThe number of bits in the facility code.
schema.facility_code.facility_start_addressIntegerThe starting address of the facility code.
standardBooleanWhether the card format was provided by PDK. If set to true, the card format can't be deleted.

Basic Endpoints

Create a card format

Request

The parameters required to create a card format depend on the schema type.

POST https://panel-{{panel_id}}.pdk.io/api/config/formats HTTP/1.1
Authorization: Bearer {{panel_token}}
Content-Type: application/json

{
"name": "Test Card Format",
"schema": {
"num_bits": 26,
"default_min_bits": 20,
"default_max_bits": 32,
"cardholder_id_bits": 16,
"cardholder_start_address": 9
}
}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
panel_tokenHeaderStringYesA valid panel token.
nameBodyStringYesThe card format name.
schema.num_bitsBodyIntegerYesThe nominal number of bits in the card number.
schema.default_min_bitsBodyIntegerYesThe minimum number of bits in the card number.
schema.default_max_bitsBodyIntegerYesThe maximum number of bits in the card number.
schema.cardholder_id_bitsBodyIntegerYesThe number of bits in the cardholder ID.
schema.cardholder_start_addressBodyIntegerYesThe starting address of the cardholder ID.
schema.num_bits_to_sum_for_even_parityBodyIntegerNoThe number of bits to sum for even parity.
schema.even_start_addressBodyIntegerNoThe starting address for even parity.
schema.num_bits_to_sum_for_odd_parityBodyIntegerNoThe number of bits to sum for odd parity.
schema.odd_start_addressBodyIntegerNoThe starting address for odd parity.
schema.facility_code.num_facility_code_bitsBodyIntegerNoThe number of bits in the facility code.
schema.facility_code.facility_start_addressBodyIntegerNoThe starting address of the facility code.

Response

The response contains the ID of the newly created card format object.

HTTP/1.1 200 OK
Content-Type: application/json

{
"id": 1
}

Retrieve a card format

Request

GET https://panel-{{panel_id}}.pdk.io/api/config/formats/{{card_format_id}} HTTP/1.1
Authorization: Bearer {{panel_token}}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
card_format_idPathStringYesThe card format ID.
panel_tokenHeaderStringYesA valid panel token.

Response

The response contains a card format object.

HTTP/1.1 200 OK
Content-Type: application/json

{
"id": 1,
"name": "Standard 26-bit Format",
"schema": {
"type": "standard",
"num_bits": 26,
"default_min_bits": 20,
"default_max_bits": 32,
"cardholder_id_bits": 16,
"cardholder_start_address": 9,
"num_bits_to_sum_for_even_parity": 13,
"even_start_address": 0,
"num_bits_to_sum_for_odd_parity": 13,
"odd_start_address": 13,
"facility_code": {
"num_facility_code_bits": 8,
"facility_start_address": 1
}
},
"standard": true
}

Delete a card format

Request

DELETE https://panel-{{panel_id}}.pdk.io/api/config/formats/{{card_format_id}} HTTP/1.1
Authorization: Bearer {{panel_token}}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
card_format_idPathStringYesThe card format ID.
panel_tokenHeaderStringYesA valid panel token.

Response

HTTP/1.1 204 No Content

List all card formats

Request

GET https://panel-{{panel_id}}.pdk.io/api/config/formats HTTP/1.1
Authorization: Bearer {{panel_token}}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
panel_tokenHeaderStringYesA valid panel token.

Response

The response contains an array of card format objects.

HTTP/1.1 200 OK
Content-Type: application/json

[
{
"id": 1,
"name": "Standard 26-bit Format",
"schema": {
"type": "standard",
"num_bits": 26,
"default_min_bits": 20,
"default_max_bits": 32,
"cardholder_id_bits": 16,
"cardholder_start_address": 9,
"num_bits_to_sum_for_even_parity": 13,
"even_start_address": 0,
"num_bits_to_sum_for_odd_parity": 13,
"odd_start_address": 13,
"facility_code": {
"num_facility_code_bits": 8,
"facility_start_address": 1
}
},
"standard": true
},
{
"id": 2,
"name": "Test Card Format",
"schema": {
"type": "js",
"default_min_bits": 9,
"default_max_bits": 512
},
"cardFormat": "exports={name:'Test Card Format',parse:function(cardNumber){return cardNumber}}",
"standard": false
}
]