STPPaymentMethodParams
@interface STPPaymentMethodParams : NSObject <STPFormEncodable>
An object representing parameters used to create a PaymentMethod object.
Note
To create a PaymentMethod from an Apple Pay PKPaymentToken, see STPAPIClient createPaymentMethodWithPayment:completion:
-
The type of payment method. The associated property will contain additional information (e.g.
type == STPPaymentMethodTypeCard
meanscard
should also be populated).Declaration
Objective-C
@property (readonly, nonatomic) STPPaymentMethodType type;
Swift
var type: STPPaymentMethodType { get }
-
The raw underlying type string sent to the server.
Generally you should use
type
instead unless you have a reason not to. You can use this if you want to create a param of a type not yet supported by the current version of the SDK’sSTPPaymentMethodType
enum.Setting this to a value not known by the SDK causes
type
to returnSTPPaymentMethodTypeUnknown
Declaration
Objective-C
@property (readwrite, copy, nonatomic) NSString *_Nonnull rawTypeString;
Swift
var rawTypeString: String { get set }
-
Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
Declaration
Objective-C
@property (readwrite, strong, nonatomic, nullable) STPPaymentMethodBillingDetails *billingDetails;
Swift
var billingDetails: STPPaymentMethodBillingDetails? { get set }
-
If this is a card PaymentMethod, this contains the user’s card details.
Declaration
Objective-C
@property (readwrite, strong, nonatomic, nullable) STPPaymentMethodCardParams *card;
Swift
var card: STPPaymentMethodCardParams? { get set }
-
If this is a iDEAL PaymentMethod, this contains details about user’s bank.
Declaration
Objective-C
@property (assign, readwrite, nonatomic, nullable) STPPaymentMethodiDEALParams *iDEAL;
Swift
var iDEAL: STPPaymentMethodiDEALParams? { get set }
-
If this is a FPX PaymentMethod, this contains details about user’s bank.
Declaration
Objective-C
@property (assign, readwrite, nonatomic, nullable) STPPaymentMethodFPXParams *fpx;
Swift
var fpx: STPPaymentMethodFPXParams? { get set }
-
Set of key-value pairs that you can attach to the PaymentMethod. This can be useful for storing additional information about the PaymentMethod in a structured format.
Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NSDictionary<NSString *, NSString *> *metadata;
Swift
var metadata: [String : String]? { get set }
-
Creates params for a card PaymentMethod.
Declaration
Objective-C
+ (nonnull STPPaymentMethodParams *) paramsWithCard:(nonnull STPPaymentMethodCardParams *)card billingDetails:(nullable STPPaymentMethodBillingDetails *)billingDetails metadata:(nullable NSDictionary<NSString *, NSString *> *)metadata;
Swift
/*not inherited*/ init(card: STPPaymentMethodCardParams, billingDetails: STPPaymentMethodBillingDetails?, metadata: [String : String]?)
Parameters
card
An object containing the user’s card details.
billingDetails
An object containing the user’s billing details.
metadata
Additional information to attach to the PaymentMethod.
-
Creates params for an iDEAL PaymentMethod.
Declaration
Objective-C
+ (nonnull STPPaymentMethodParams *) paramsWithiDEAL:(nonnull STPPaymentMethodiDEALParams *)iDEAL billingDetails:(nullable STPPaymentMethodBillingDetails *)billingDetails metadata:(nullable NSDictionary<NSString *, NSString *> *)metadata;
Swift
/*not inherited*/ init(iDEAL: STPPaymentMethodiDEALParams, billingDetails: STPPaymentMethodBillingDetails?, metadata: [String : String]?)
Parameters
iDEAL
An object containing the user’s iDEAL bank details.
billingDetails
An object containing the user’s billing details.
metadata
Additional information to attach to the PaymentMethod.
-
Creates params for an FPX PaymentMethod.
Declaration
Objective-C
+ (nonnull STPPaymentMethodParams *) paramsWithFPX:(nonnull STPPaymentMethodFPXParams *)fpx billingDetails:(nullable STPPaymentMethodBillingDetails *)billingDetails metadata:(nullable NSDictionary<NSString *, NSString *> *)metadata;
Swift
/*not inherited*/ init(fpx: STPPaymentMethodFPXParams, billingDetails: STPPaymentMethodBillingDetails?, metadata: [String : String]?)
Parameters
fpx
An object containing the user’s FPX bank details.
billingDetails
An object containing the user’s billing details.
metadata
Additional information to attach to the PaymentMethod.
-
Creates params from a single-use PaymentMethod. This is useful for recreating a new payment method with similar settings. It will return nil if used with a reusable PaymentMethod.
Declaration
Objective-C
+ (nullable STPPaymentMethodParams *)paramsWithSingleUsePaymentMethod: (nonnull STPPaymentMethod *)paymentMethod;
Swift
/*not inherited*/ init?(singleUse paymentMethod: STPPaymentMethod)
Parameters
paymentMethod
An object containing the original single-use PaymentMethod.