Code Monkey home page Code Monkey logo

mobiletoken-ios's Introduction

Getting started with MobileToken for iOS Build Status

Add MonetaryMobileToken.framework to your Xcode project

  1. In the project navigator, select the project or group within a project to which you want to add the framework.
  2. Choose File > Add Files to โ€œYour Project Nameโ€.
  3. Select the MonetaryMobileToken.framework bundle, and click Add.
  4. In the project settings, choose the Build Phases tab.
  5. Under the Embed Frameworks section, choose "+" to add a new Embedded Framework.
  6. Select the MonetaryMobileToken.framework bundle, and click Add.

Include the framework in your code

#import <MonetaryMobileToken/MonetaryMobileToken.h>

Implement the tokenization delegate

Implement the MonetaryTokenDelegate protocol
@interface ViewController : UIViewController <MonetaryTokenDelegate>
Implement MonetaryTokenDelegate methods

On Loading:

- (void)tokenLoading
{
  // The framework has begun tokenizing user-input account data.
}

On Success:

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

On Error:

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

On Cancel:

- (void)tokenizationCancelled
{
  // The user has cancelled tokenization!
}

Request a token for keyed account

Provide a MonetaryTokenizer object with a Monetary public key, a MonetaryTokenDelegate object which to send events, and a UIViewController over which to display the account entry views
MonetaryTokenizer *tokenizer = [MonetaryTokenizer new];
[tokenizer requestKeyedTokenWithPublicKey:@"[Public Key Goes Here]"
                              andDelegate:self
                       overViewController:self];

Report bugs

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!

mobiletoken-ios's People

Contributors

rbonestell avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobiletoken-ios's Issues

Localizable The MobileToken

The MobileToken-iOS is a great lib for us. we want to localize the tools for other languages. Can you give us some suggestions

Thanks

Calling requestKeyedTokenWithPublicKey when the network connection is disconnected will cause the app to crash.

Thread 9 Crashed:
0 libobjc.A.dylib 0x1a1253a7c objc_retain + 16
1 MonetaryMobileToken 0x10242ffe4 -[RestUtil sendRequestToURL:forRequestType:withBody:andKey:error:] + 420
2 MonetaryMobileToken 0x10242b3fc +[TokenizationController getTokenForAccount:cvv:andExpiration:withPublicKey:andEncKey:error:] + 840
3 MonetaryMobileToken 0x102430c28 __78-[MonetaryTokenizer tokenizeAccount:cvv:expiration:andPublicKey:withDelegate:]_block_invoke + 156
4 libdispatch.dylib 0x1af612320 _dispatch_call_block_and_release + 32
5 libdispatch.dylib 0x1af613eac _dispatch_client_callout + 20
6 libdispatch.dylib 0x1af616f8c _dispatch_queue_override_invoke + 788
7 libdispatch.dylib 0x1af625944 _dispatch_root_queue_drain + 396
8 libdispatch.dylib 0x1af626158 _dispatch_worker_thread2 + 164
9 libsystem_pthread.dylib 0x207502da0 _pthread_wqthread + 228
10 libsystem_pthread.dylib 0x207502b7c start_wqthread + 8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.