Sabs Sabs - 2 months ago 10x
Swift Question

Stripe - STPPaymentCardTextField - How to remove or hide CVC code field?

Stripe's iOS SDK's "STPPaymentCardTextField" has 4 fields for generating a token for a card : 1. credit card number 2. expiration month 3. expiration year 4. CVC field

We are saving only credit card number and expiration month/year. We don't need to get CVC number from user. So how to hide or remove CVC field from STPPaymentCardTextField.

Please give me some idea to handle this process.


it is possbile but we need to do this carefully , ok open STPPaymentCardTextField.m file and you get the property of CVC field name as STPFormTextField

@property(nonatomic, readwrite, weak)STPFormTextField *cvcField; 

finally hide related to cvcField where ever it comes on that page around it occupy the 21 Places in that page , for e.g

STPFormTextField *cvcField = [self buildTextField];
cvcField.tag = STPCardFieldTypeCVC;
cvcField.alpha = 0;
self.cvcField = cvcField;
self.cvcPlaceholder = @"CVC";
[self.fieldsView addSubview:cvcField];

- (void)setCvcPlaceholder:(NSString * __nullable)cvcPlaceholder {
_cvcPlaceholder = [cvcPlaceholder copy];
self.cvcField.placeholder = _cvcPlaceholder;

else make a trick hide

[self.fieldsView addSubview:cvcField];