Skip to content

Commit

Permalink
Merge pull request #278 from blockchyp/feature/CHYP-3573
Browse files Browse the repository at this point in the history
Card Metadata and HSA/EBT
  • Loading branch information
devops-blockchyp committed Sep 18, 2024
1 parent bfee0c4 commit cbd96ca
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 0 deletions.
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,96 @@ class ExampleClass {



#### 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.



##### From Objective-C:

```objective-c
#import <Foundation/Foundation.h>
#import <BlockChyp/BlockChyp.h>

int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

BlockChyp *client = [[BlockChyp alloc]
initWithApiKey:@"SPBXTSDAQVFFX5MGQMUMIRINVI"
bearerToken:@"7BXBTBUPSL3BP7I6Z2CFU6H3WQ"
signingKey:@"bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e"];

NSMutableDictionary *request = [[NSMutableDictionary alloc] init];
request["test"] = true
request["terminalName"] = "Test Terminal"
[client cardMetadataWithRequest:request handler:^(NSDictionary *request, NSDictionary *response, NSError *error) {
NSNumber *success = [response objectForKey:@"success"];
if (success.boolValue) {
NSLog(@"success");
}
}];
[pool drain];
return 0;
}

```

##### From Swift:

```swift
import BlockChyp

class ExampleClass {

func example() {
let client = BlockChyp.init(
apiKey: "ZN5WQGX5PN6BE2MF75CEAWRETM",
bearerToken: "SVVHJCYVFWJR2QKYKFWMZQVZL4",
signingKey: "7c1b9e4d1308e7bbe76a1920ddd9449ce50af2629f6bb70ed3c110365935970b"
)

var request: [String:Any] = [:]
request["test"] = true
request["terminalName"] = "Test Terminal"
client.cardMetadata(withRequest: request, handler: { (request, response, error) in
let approved = response["success"] as? Bool
if (approved.unsafelyUnwrapped) {
NSLog("success")
}
})
}


```



#### Time Out Reversal


Expand Down
24 changes: 24 additions & 0 deletions blockchyp-ios-examples/CardMetadataExample.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#import <Foundation/Foundation.h>
#import <BlockChyp/BlockChyp.h>

int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

BlockChyp *client = [[BlockChyp alloc]
initWithApiKey:@"SPBXTSDAQVFFX5MGQMUMIRINVI"
bearerToken:@"7BXBTBUPSL3BP7I6Z2CFU6H3WQ"
signingKey:@"bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e"];

NSMutableDictionary *request = [[NSMutableDictionary alloc] init];
request["test"] = true
request["terminalName"] = "Test Terminal"
[client cardMetadataWithRequest:request handler:^(NSDictionary *request, NSDictionary *response, NSError *error) {
NSNumber *success = [response objectForKey:@"success"];
if (success.boolValue) {
NSLog(@"success");
}
}];
[pool drain];
return 0;
}
22 changes: 22 additions & 0 deletions blockchyp-ios-examples/CardMetadataExample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import BlockChyp

class ExampleClass {

func example() {
let client = BlockChyp.init(
apiKey: "ZN5WQGX5PN6BE2MF75CEAWRETM",
bearerToken: "SVVHJCYVFWJR2QKYKFWMZQVZL4",
signingKey: "7c1b9e4d1308e7bbe76a1920ddd9449ce50af2629f6bb70ed3c110365935970b"
)

var request: [String:Any] = [:]
request["test"] = true
request["terminalName"] = "Test Terminal"
client.cardMetadata(withRequest: request, handler: { (request, response, error) in
let approved = response["success"] as? Bool
if (approved.unsafelyUnwrapped) {
NSLog("success")
}
})
}

3 changes: 3 additions & 0 deletions blockchyp-ios/BlockChyp/BlockChyp.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ NS_ASSUME_NONNULL_BEGIN
// Adds a new payment method to the token vault.
-(void)enrollWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler;

// Retrieves card metadata.
-(void)cardMetadataWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler;

// Activates or recharges a gift card.
-(void)giftActivateWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler;

Expand Down
7 changes: 7 additions & 0 deletions blockchyp-ios/BlockChyp/BlockChyp.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ -(void)enrollWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHan

}

// Retrieves card metadata.
-(void)cardMetadataWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler; {

[self routeTerminalRequestWith:request terminalPath:@"/api/card-metadata" gatewayPath:@"/api/card-metadata" method:@"POST" handler:handler];

}

// Activates or recharges a gift card.
-(void)giftActivateWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler; {

Expand Down

0 comments on commit cbd96ca

Please sign in to comment.