Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Step 4 - Setup the Initial Call to Cardinal


Excerpt

Calling cardinal session setup will begin the communication process with Cardinal to ensure your user's experience is seamless, by authenticating your credentials (serverJwt) and completing the data collection process. By the time they are ready to checkout, all necessary pre-processing will be completed.Use the code snippet below for completing the cardinal session setup

Note

The following function call must be placed in your Checkout ViewController.


Expand
titleObjective-C


Code Block
NSString *jwtString = @"INSERT_YOUR_JWT_HERE";

[session setupWithJWT:jwtString 
		  didComplete:^(NSString * _Nonnull consumerSessionId){
    //
    // You may have your Submit button disabled on page load. Once you are setup
    // for CCA, you may then enable it. This will prevent users from submitting
    // their order before CCA is ready.
    //
} didValidate:^(CardinalResponse * _Nonnull validateResponse) {
   	// Handle failed setup
    // If there was an error with setup, cardinal will call this function with
    // validate response and empty serverJWT
}];



Expand
titleSwift


Code Block
let jwtString = "INSERT_YOUR_JWT_HERE"

session.setup(jwtString: jwtString, completed: { (consumerSessionId: String) in
    //
    // You may have your Submit button disabled on page load. Once you are setup
    // for CCA, you may then enable it. This will prevent users from submitting
    // their order before CCA is ready.
    //
}) { (validateResponse: CardinalResponse) in
    // Handle failed setup
    // If there was an error with setup, cardinal will call this function with
    // validate response and empty serverJWT
}



Note

The following feature is deprecated as of 2.2.4


If you already have the credit card number and just need to pass it to Cardinal, you can pass it in cardinal session setup.It is ideal in a flow where the consumer has already entered their payment information.


Expand
titleObjective-C : Cardinal Set up with Account Number


Code Block
NSString *accountNumberString = @"1234567890123456";
NSString *jwtString = @"INSERT_YOUR_JWT_HERE";

[session setupWithJWT:jwtString 
		accountNumber:accountNumberString 
		  didComplete:^(NSString * _Nonnull consumerSessionId) {
    //
    // You may have your Submit button disabled on page load. Once you are setup
    // for CCA, you may then enable it. This will prevent users from submitting
    // their order before CCA is ready.
    //
} didValidate:^(CardinalResponse * _Nonnull validateResponse) {
   	// Handle failed setup
    // If there was an error with setup, cardinal will call this function with
    // validate response and empty serverJWT        
}];



Expand
titleSwift : Cardinal Setup with AccountNumber


Code Block
let accountNumberString = "1234567890123456"
let jwtString = "INSERT_YOUR_JWT_HERE"

session.setup(jwtString: jwtString, 
				account: accountNumberString, 
			  completed: { (consumerSessionId: String) in
    //
    // You may have your Submit button disabled on page load. Once you are setup
    // for CCA, you may then enable it. This will prevent users from submitting
    // their order before CCA is ready.
    //
}) { (validateResponse: CardinalResponse) in
    // Handle failed setup
    // If there was an error with setup, cardinal will call this function with
    // validate response and empty serverJWT
}



...