BTDropInResult

Objective-C

@interface BTDropInResult : NSObject

/// True if the modal was dismissed without selecting a payment method
@property (nonatomic, assign, getter=isCanceled) BOOL canceled;

/// The type of the payment option
@property (nonatomic, assign) BTDropInPaymentMethodType paymentMethodType;

/// A UIView (BTUIKPaymentOptionCardView) that represents the payment option
@property (nonatomic, readonly) UIView *paymentIcon;

/**
 * A description of the payment option.
 * For cards, the last four digits of the card number.
 * For PayPal, the email address associated with the account.
 * For Venmo, the username associated with the account.
 * For Apple Pay, the text "Apple Pay".
 */
@property (nonatomic, readonly) NSString *paymentDescription;

/// The payment method nonce
@property (nonatomic, strong, nullable) BTPaymentMethodNonce *paymentMethod;

/**
 * A `deviceData` string that represents data about a customer's device. This is generated from Braintree's advanced fraud protection service.
 *
 * `deviceData` should be passed into server-side calls, such as `Transaction.sale`. This enables you to collect data about a customer's device and correlate it with a session identifier on your server.
 *
 * Collecting and passing this data with transactions helps reduce decline rates and detect fraudulent transactions.
 */
@property (nonatomic, strong, nullable) NSString *deviceData;

/**
 * Fetch a `BTDropInResult` with the customer's vaulted payment method.
 * The payment method returned is not guaranteed to be the most recently added payment method.
 * If the vaulted payment method is Apple Pay, a `BTDropInResult` with
 * `paymentMethodType == .applePay` will be returned in the completion block.
 *
 * @param clientToken Client token. Must be generated with a customer ID.
 * @param completion The completion block, which passes back a result or an error. Both result and error may be nil if the customer does not have any vaulted payment methods.
 */
 // NEXT_MAJOR_VERSION: - update this function name to more accurately represent the behavior of the function
+ (void)mostRecentPaymentMethodForClientToken:(NSString *)clientToken
                                   completion:(void (^)(BTDropInResult * _Nullable result, NSError * _Nullable error))completion;

@end

Swift

class BTDropInResult : NSObject

Undocumented

  • True if the modal was dismissed without selecting a payment method

    Declaration

    Objective-C

    @property (nonatomic, getter=isCanceled) BOOL canceled;

    Swift

    var isCanceled: Bool { get set }
  • The type of the payment option

    Declaration

    Objective-C

    @property (nonatomic) BTDropInPaymentMethodType paymentMethodType;

    Swift

    var paymentMethodType: BTDropInPaymentMethodType { get set }
  • A UIView (BTUIKPaymentOptionCardView) that represents the payment option

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIView *_Nonnull paymentIcon;

    Swift

    var paymentIcon: UIView { get }
  • A description of the payment option. For cards, the last four digits of the card number. For PayPal, the email address associated with the account. For Venmo, the username associated with the account. For Apple Pay, the text “Apple Pay”.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull paymentDescription;

    Swift

    var paymentDescription: String { get }
  • The payment method nonce

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) BTPaymentMethodNonce *paymentMethod;

    Swift

    var paymentMethod: BTPaymentMethodNonce? { get set }
  • A deviceData string that represents data about a customer’s device. This is generated from Braintree’s advanced fraud protection service.

    deviceData should be passed into server-side calls, such as Transaction.sale. This enables you to collect data about a customer’s device and correlate it with a session identifier on your server.

    Collecting and passing this data with transactions helps reduce decline rates and detect fraudulent transactions.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSString *deviceData;

    Swift

    var deviceData: String? { get set }
  • Fetch a BTDropInResult with the customer’s vaulted payment method. The payment method returned is not guaranteed to be the most recently added payment method. If the vaulted payment method is Apple Pay, a BTDropInResult with paymentMethodType == .applePay will be returned in the completion block.

    Declaration

    Objective-C

    + (void)mostRecentPaymentMethodForClientToken:(nonnull NSString *)clientToken
                                       completion:
                                           (nonnull void (^)(
                                               BTDropInResult *_Nullable,
                                               NSError *_Nullable))completion;

    Swift

    class func mostRecentPaymentMethod(forClientToken clientToken: String) async throws -> BTDropInResult

    Parameters

    clientToken

    Client token. Must be generated with a customer ID.

    completion

    The completion block, which passes back a result or an error. Both result and error may be nil if the customer does not have any vaulted payment methods.