
#import <MonetaryMobileToken/MonetaryMobileToken.h>MonetaryTokenDelegate protocol@interface ViewController : UIViewController <MonetaryTokenDelegate>MonetaryTokenDelegate methods- (void)tokenLoading
{
// The framework has begun tokenizing user-input account data.
}- (void)tokenCreated:(MonetaryToken *)token
{
// A token has been received!
}In the tokenCreated method, the received MonetaryToken object contains 5 NSString properties:
Token: The one-time-use token for the user-entered account data.Brand: The card brand of account represented by the token.ExpirationMonth: The 2-digit expiration month of the account.ExpirationYear: The 4-digit expiration year of the account.Last4: The last 4 digits of the account number.- (void)tokenizationError:(NSError *)error
{
// A tokenization error has occurred!
}The tokenizationError method will receive an NSError object with one of the 4 following error codes:
MMTConnectionError: Failed to communicate with Monetary Token API.MMTAuthenticationError: Public key authentication failed.MMTDataValidationError: Failed to tokenize due to invalid account information.MMTTokenizationError: An error has occurred tokenizing the account data at the Monetary Token API.- (void)tokenizationCancelled
{
// The user has cancelled tokenization!
}MonetaryTokenizer object with a Monetary public key, a MonetaryTokenDelegate object which to send events, and a UIViewController over which to display the account entry viewsMonetaryTokenizer *tokenizer = [MonetaryTokenizer new];
[tokenizer requestKeyedTokenWithPublicKey:@"[Public Key Goes Here]"
andDelegate:self
overViewController:self];If you encounter any bugs or issues with the latest version of MobileToken for iOS, please report them to us by opening a GitHub Issue!