Initiating a Payment for Mobile iOS Payments

The following callNonApplePayFlow method will open the Credit Card information form.

-(void)callNonApplePayFlow
{
}
func callNonApplePayFlow()
{
}

The beginNonApplePayment method below will call the single-use token service using credit card details. Single-use tokens are valid for only 15 minutes and are not consumed by verification.

self.PaysafeAuthPaymentController.authDelegate = self;
[self.PaysafeAuthPaymentController
beginNonApplePayment:self withRequestData:[self createDataDictionary]
withEnvSettingDict:envSettingDict];
appDelegate.PaysafeApplePaySDKObj?.authDelegate=self
appDelegate.PaysafeApplePaySDKObj?.beginNonApplePayment(self,
withRequestData: createDataDictionary(), withEnvSettingDict: enviDictionary)

In order to pass data from the merchant application to the SDK, you must create and call the following internal method: createDataDictionary.

This method will create dictionaries or data sets to include in the beginNonApplePayment method (mentioned above).

-(NSMutableDictionary *)createDataDictionary
{
NSMutableDictionary *cardExpData= [[NSMutableDictionary alloc]init];
[cardExpData setValue:txtExpMonth.text forKey:@"month"];
[cardExpData setValue:txtExpYear.text forKey:@"year"];

NSMutableDictionary *cardBillingAddress= [[NSMutableDictionary alloc]init];

[cardBillingAddress setValue:txtStreet1.text forKey:@"street"];
[cardBillingAddress setValue:txtStreet2.text forKey:@"street2"];
[cardBillingAddress setValue:txtCity.text forKey:@"city"];
[cardBillingAddress setValue:txtCountry.text forKey:@"country"];
[cardBillingAddress setValue:txtState.text forKey:@"state"];
[cardBillingAddress setValue:txtZip.text forKey:@"zip"];

NSMutableDictionary *cardData= [[NSMutableDictionary alloc]init];
[cardData setValue:txtCardNo.text forKey:@"cardNum"];
[cardData setValue:txtNameOnCard.text forKey:@"holderName"];
[cardData setValue:cardExpData forKey:@"cardExpiry"];
[cardData setValue:cardBillingAddress forKey:@"billingAddress"];

NSMutableDictionary *cardDataDetails= [[NSMutableDictionary alloc]init];
[cardDataDetails setValue:cardData forKey:@"card"];
return cardDataDetails;
}
This will provide the env setting data
NSString *envType = @"TEST_ENV"; //PROD_ENV TEST_ENV
NSString *timeIntrval = @"30.0"; //Time interval for connection to Paysafe server
 NSMutableDictionary
*envSettingDict = [NSMutableDictionary
dictionaryWithObjectsAndKeys:envType,@"EnvType",timeIntrval,@"TimeIntrval",nil];
func createDataDictionary() -> Dictionary <String , AnyObject>
{
var cardExpData: [String: String] = ["month":txtExpMonth.text, "year":txtExpYear.text]
 var cardBillingAddress: [String: String] = ["street":txtStreet1.text, "street2":txtStreet2.text,"city":txtCity.text,"country":txtCountry.text,"state":txtState.text,"zip":txtZip.text]
 var cardData:[String:AnyObject]=["cardNum":txtCardNo.text , "holderName":txtNameOnCard.text,"cardExpiry":cardExpData,"billingAddress":cardBillingAddress];
 var cardDataDetails:[String:AnyObject]=["card":cardData];
 return cardDataDetails
}
 This will provide the env setting data
 var envType:String = "TEST_ENV"; //PROD_ENV TEST_ENV
 var timeIntrval:String = "30.0"; //Time interval for connection to the Paysafe server
 var enviDictionary:
[String: String] = ["EnvType":envType,
"TimeIntrval":timeIntrval]
Key Description
cardNum Card number
holderName Card holder name
cardExpiry Card expiry details
billingAddress Billing address details
card Card and billing information
cardBillingAddress – Billing Address Information Dictionary
Key Description
street First line of address
street2 Second line of address
city City name
country Country name
state State name
zip Zip/postal code
cardDataDetails – Credit Card Information Dictionary
Key Description
cardExpData Card expiry information dictionary
month Card expiry month
year Card expiry year
Did you find this page useful?