BTCardClient
Objective-C
@interface BTCardClient : NSObject
Swift
class BTCardClient : NSObject
Used to process cards
-
Creates a card client.
Declaration
Objective-C
- (nonnull instancetype)initWithAPIClient:(nonnull BTAPIClient *)apiClient;
Swift
init(apiClient: BTAPIClient)
Parameters
apiClient
An API client
-
Unavailable
Please use initWithAPIClient:
Base initializer - do not use.
Declaration
Objective-C
- (nonnull instancetype)init;
-
Tokenizes a card.
Declaration
Objective-C
- (void)tokenizeCard:(nonnull BTCard *)card completion:(nonnull void (^)(BTCardNonce *_Nullable, NSError *_Nullable))completion;
Swift
func tokenizeCard(_ card: BTCard) async throws -> BTCardNonce
Parameters
card
The card to tokenize.
completion
A completion block that is invoked when card tokenization has completed. If tokenization succeeds,
tokenizedCard
will contain a nonce anderror
will benil
; if it fails,tokenizedCard
will benil
anderror
will describe the failure. -
Deprecated
The UnionPay SMS integration is deprecated, as UnionPay can now be processed as a credit card through their partnership with Discover. Use
BTCardClient.tokenizeCard(card: completion:)
.Tokenizes a card.
Declaration
Objective-C
- (void)tokenizeCard:(nonnull BTCardRequest *)request options:(nullable NSDictionary *)options completion:(nonnull void (^)(BTCardNonce *_Nullable, NSError *_Nullable))completion;
Swift
func tokenizeCard(_ request: BTCardRequest, options: [AnyHashable : Any]? = nil) async throws -> BTCardNonce
Parameters
request
A card tokenization request that contains an enrolled card, the enrollment ID from
enrollUnionPayCard:completion:
, and the enrollment auth code sent to the mobile phone number.options
A dictionary containing additional options to send when performing tokenization. Optional.
completion
A completion block that is invoked when card tokenization has completed. If tokenization succeeds,
tokenizedCard
will contain a nonce anderror
will benil
; if it fails,tokenizedCard
will benil
anderror
will describe the failure.
-
Deprecated
The UnionPay SMS integration is deprecated, as UnionPay can now be processed as a credit card through their partnership with Discover. Use
BTCardClient.tokenizeCard(card: completion:)
.Fetches the capabilities of a card number.
This should be used to look up a card PAN to see whether it is UnionPay, and if so, what is required to tokenize it.
Declaration
Objective-C
- (void)fetchCapabilities:(nonnull NSString *)cardNumber completion:(nonnull void (^)(BTCardCapabilities *_Nullable, NSError *_Nullable))completion;
Swift
func fetchCapabilities(_ cardNumber: String) async throws -> BTCardCapabilities
Parameters
cardNumber
The card number.
completion
A completion block that is invoked when the card capabilities have been fetched.
-
Deprecated
The UnionPay SMS integration is deprecated, as UnionPay can now be processed as a credit card through their partnership with Discover. Use
BTCardClient.tokenizeCard(card: completion:)
.Enrolls a UnionPay card and returns an enrollment ID. The
enrollmentID
property ofBTCardRequest
must be set to this IDbefore the card can be tokenized.Attempting to enroll cards that do not require enrollment – including non-UnionPay cards – will cause an error. This can be prevented by checking the card’s capabilities first.
See
-fetchCapabilities:completion:See
BTCardClient -tokenizeCard:options:completion:Declaration
Objective-C
- (void)enrollCard:(nonnull BTCardRequest *)request completion:(nonnull void (^)(NSString *_Nullable, BOOL, NSError *_Nullable))completion;
Swift
func enrollCard(_ request: BTCardRequest) async throws -> (String, Bool)
Parameters
request
A card tokenization request that contains a card, mobile phone number, and country code. Cannot be
nil
.completion
A callback block that will be invoked on the main thread when enrollment has completed. When enrollment succeeds,
error
isnil
,enrollmentID
contains the enrollment ID, andsmsCodeRequired
indicates whether an SMS code was sent to the customer. If an SMS code is not sent, tokenization can occur immediately afterwards.