-
Notifications
You must be signed in to change notification settings - Fork 0
Payload Chart
Shesh Ghimire edited this page Sep 14, 2024
·
4 revisions
Payload that follows CardFactory Schema.
Payload With Keys and Without Keys demonstrates three of the common Payment Card types.
Optional keys whose values are provided in payload examples (With Keys and Without Keys) below:
Card Name | Schema Key | Schema Value | Getter Method |
---|---|---|---|
Diners Club | checkLuhn |
false | $card->needsLuhnCheck(): false |
Visa | type |
Debit Card | $card->getType(): 'Debit Card' |
PHP Indexed Array of Associative Arrays | JSON Array of Objects |
---|---|
array(
array(
'alias' => 'american-express',
'name' => 'American Express',
'breakpoint' => array(4, 10),
'code' => array("CID", 4),
'length' => array(15),
'idRange' => array(34, 37),
),
array(
'alias' => 'diners-club',
'name' => 'Diners Club',
'checkLuhn' => false,
'breakpoint' => array(4, 10),
'code' => array("CVV", 3),
'length' => array(16, array(14, 19)),
'idRange' => array(55, 30, 36, 38, 39),
),
array(
'alias' => 'visa',
'name' => 'Visa',
'type' => CardFactory::DEBIT_CARD,
'breakpoint' => array(4, 8, 12),
'code' => array("CVV", 3),
'length' => array(13, 16, 19),
'idRange' => array(4),
),
); |
[
{
"alias": "american-express",
"name": "American Express",
"breakpoint": [4, 10],
"code": ["CID", 4],
"length": [15],
"idRange": [34, 37]
},
{
"alias": "diners-club",
"name": "Diners Club",
"checkLuhn": false,
"breakpoint": [4, 10],
"code": ["CVV", 3],
"length": [16, [14, 19]],
"idRange": [55, 30, 36, 38, 39]
},
{
"alias": "visa",
"name": "Visa",
"type": "Debit Card",
"breakpoint": [4, 8, 12],
"code": ["CVV", 3],
"length": [13, 16, 19],
"idRange": [4]
}
] |
Getting Diners Club Card instance from factory.
$factory = new CardFactory($payload);
$card = $factory->createCard(index: 1);
PHP Associative Array of Associative Arrays | JSON Object of Objects |
---|---|
array(
'americanExpress' => array(
'alias' => 'american-express',
'name' => 'American Express',
'breakpoint' => array(4, 10),
'code' => array("CID", 4),
'length' => array(15),
'idRange' => array(34, 37),
),
'dinersClub' => array(
'alias' => 'diners-club',
'name' => 'Diners Club',
'checkLuhn' => false,
'breakpoint' => array(4, 10),
'code' => array("CVV", 3),
'length' => array(16, array(14, 19)),
'idRange' => array(55, 30, 36, 38, 39),
),
'visa' => array(
'alias' => 'visa',
'name' => 'Visa',
'type' => CardFactory::DEBIT_CARD,
'breakpoint' => array(4, 8, 12),
'code' => array("CVV", 3),
'length' => array(13, 16, 19),
'idRange' => array(4),
),
); |
{
"americanExpress": {
"alias": "american-express",
"name": "American Express",
"breakpoint": [4, 10],
"code": ["CID", 4],
"length": [15],
"idRange": [34, 37]
},
"dinersClub": {
"alias": "diners-club",
"name": "Diners Club",
"checkLuhn": false,
"breakpoint": [4, 10],
"code": ["CVV", 3],
"length": [16, [14, 19]],
"idRange": [55, 30, 36, 38, 39]
},
"visa": {
"alias": "visa",
"name": "Visa",
"type": "Debit Card",
"breakpoint": [4, 8, 12],
"code": ["CVV", 3],
"length": [13, 16, 19],
"idRange": [4]
} |
Getting Diners Club Card instance from factory.
$factory = new CardFactory($payload);
$card = $factory->createCard(index: 'dinersClub');