diff --git a/README.md b/README.md index 56f0721..8e485f3 100644 --- a/README.md +++ b/README.md @@ -430,6 +430,67 @@ $request = [ $response = BlockChyp::void($request); +// View the result +echo 'Response: ' . print_r($response, true) . PHP_EOL; + +``` + +#### Card Metadata + + + +* **API Credential Types:** Merchant +* **Required Role:** Payment API Access + +This API allows you to retrieve card metadata. + +Card metadata requests can use a payment terminal to retrieve metadata or +use a previously enrolled payment token. + +**Terminal Transactions** + +For terminal transactions, make sure you pass in the terminal name using the `terminalName` property. + +**Token Transactions** + +If you have a payment token, omit the `terminalName` property and pass in the token with the `token` +property instead. + +**Card Numbers and Mag Stripes** + +You can also pass in PANs and Mag Stripes, but you probably shouldn't, as this will +put you in PCI scope and the most common vector for POS breaches is keylogging. +If you use terminals for manual card entry, you'll bypass any keyloggers that +might be maliciously running on the point-of-sale system. + + + + +```php + true, + 'terminalName' => 'Test Terminal', +]; + + +$response = BlockChyp::cardMetadata($request); + + // View the result echo 'Response: ' . print_r($response, true) . PHP_EOL; diff --git a/examples/CardMetadataExample.php b/examples/CardMetadataExample.php new file mode 100644 index 0000000..66f1b17 --- /dev/null +++ b/examples/CardMetadataExample.php @@ -0,0 +1,26 @@ + true, + 'terminalName' => 'Test Terminal', +]; + + +$response = BlockChyp::cardMetadata($request); + + +// View the result +echo 'Response: ' . print_r($response, true) . PHP_EOL; diff --git a/lib/BlockChyp.php b/lib/BlockChyp.php index 0d62e4c..711bc2d 100644 --- a/lib/BlockChyp.php +++ b/lib/BlockChyp.php @@ -88,6 +88,20 @@ public static function enroll($request) return self::routeTerminalRequest('POST', '/api/enroll', '/api/enroll', $request); } + /** + * Retrieves card metadata. + * + * @param array $request The request body. + * + * @throws \BlockChyp\Exception\ConnectionException if the connection fails. + * + * @return array The API response. + */ + public static function cardMetadata($request) + { + return self::routeTerminalRequest('POST', '/api/card-metadata', '/api/card-metadata', $request); + } + /** * Activates or recharges a gift card. * diff --git a/lib/BlockChypClient.php b/lib/BlockChypClient.php index 7de90e2..68c6008 100644 --- a/lib/BlockChypClient.php +++ b/lib/BlockChypClient.php @@ -57,7 +57,7 @@ class BlockChypClient const ROUNDING_MODE_NEAREST = 'nearest'; const ROUNDING_MODE_DOWN = 'down'; - const VERSION = '2.18.8'; + const VERSION = '2.20.1'; protected static $apiKey; @@ -67,9 +67,9 @@ class BlockChypClient protected static $gatewayHost = 'https://api.blockchyp.com'; - protected static $testGatewayHost = 'https://dashboard.blockchyp.com'; + protected static $dashboardHost = 'https://dashboard.blockchyp.com'; - protected static $dashboardHost = 'https://test.blockchyp.com'; + protected static $testGatewayHost = 'https://test.blockchyp.com'; protected static $https = true;