zipcode - Stripe iOS integration - How to add zip code to PTKView -
I am fully able to integrate the stripe with your iOS code Pitikeviyu shows that the card number, expiration month / Year, cvv number In PTKView, I do not see zip code text area, but I can see addressZip property.
Is it possible to capture zip code with viewing the iOS stripe?
Thanks in advance.
It seems that, know that UI component to PTKView out-of-the-box Is (yet). However, they give the PTKAddressZip type to verify that the signed zip code is valid or not.
I have created my own zip field, which looks like a credit card field using the supplied "textField.png" image that comes with a payment pest.
This is both Objective-C and Swift examples here ...
Objective-C:
UITextField * zipTextField; ZipTextField = [[UITextField alloc] initWithFrame: CGRectMake (15,170,290,55)]; ZipTextField.keyboardType = UIKeyboardTypeNumberPad; ZipTextField.placeholder = @ "" ZIP Code "; // Left padding UIView * paddingView = [[UIView alloc] initWithFrame: CGRectMake (0, 0, 5, 20)]; ZipTextField.leftView = paddingView; ZipTextField.leftViewMode = UITextFieldViewModeAlways; // It looks like a CC box UIImageView * backgroundImageView = [[UIImageView alloc] initWithFrame: zipTextField.bounds]; backgroundImageView.image = [[UIImage imageNamed: @ "text field"] resizableImageWithCapInsets: UIEdgeInsetsMake (0, 8, 0, 8)]; [ZIPFastfieldAdviewview: background image]]; // Add zip area at the end [self.view addSubview: zipTextField]; // Validate the ZIP - Put this code in your submit button PTKAddressZip * zip = [[PTKAddressZip alloc] initWithString: zipTextField.text]; NSLog (zip.isValid? @ "Zip is valid": @ "zip is invalid");
SWIFT:
// Setup zip area self.zipTextField = UITextField (frame: CGRectMake (15,170,290,45)) self.zipTextField.keyboardType = UIKeyboardType .NumberPad self.zipTextField.placeholder = "zip code" // paddingView = UIView (frame: CGRectMake (0, 0, 5, 20) on the left padding) self.zipTextField.leftView = paddingView self.zipTextField.leftViewMode = UITextFieldViewMode.Always BackgroundImageView.image = UIImage: // it looks like backgroundImageView on CC Box = UIImageView (self.zipTextField.bounds frame)? (Name: "text field") backgroundImageView.image = backgroundImageView.image .resizableImageWithCapInsets (UIEdgeInsetsMake (0,8, 0,8)) self.zipTextField.addSubview (backgroundImageView) Zip valid // - self.view your Submit button. addSubview (self.zipTextField) put the code var ZIP = PTKAddressZip (string: "15227") NSLog (Zip.isValid (). details)
Comments
Post a Comment