STPSourceParams

@interface STPSourceParams : NSObject <STPFormEncodable, NSCopying>

An object representing parameters used to create a Source object.

  • The type of the source to create. Required.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) STPSourceType type;

    Swift

    var type: STPSourceType { get set }
  • 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’s STPSourceType enum.

    Setting this to a value not known by the SDK causes type to return STPSourceTypeUnknown

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *rawTypeString;

    Swift

    var rawTypeString: String? { get set }
  • A positive integer in the smallest currency unit representing the amount to charge the customer (e.g., @1099 for a €10.99 payment). Required for single_use sources.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSNumber *amount;

    Swift

    @NSCopying var amount: NSNumber? { get set }
  • The currency associated with the source. This is the currency for which the source will be chargeable once ready.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *currency;

    Swift

    var currency: String? { get set }
  • The authentication flow of the source to create. flow may be redirect, receiver, verification, or none. It is generally inferred unless a type supports multiple flows.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) STPSourceFlow flow;

    Swift

    var flow: STPSourceFlow { get set }
  • A set of key/value pairs that you can attach to a source object.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDictionary *metadata;

    Swift

    var metadata: [AnyHashable : Any]? { get set }
  • Information about the owner of the payment instrument. May be used or required by particular source types.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDictionary *owner;

    Swift

    var owner: [AnyHashable : Any]? { get set }
  • Parameters required for the redirect flow. Required if the source is authenticated by a redirect (flow is redirect).

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDictionary *redirect;

    Swift

    var redirect: [AnyHashable : Any]? { get set }
  • An optional token used to create the source. When passed, token properties will override source parameters.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *token;

    Swift

    var token: String? { get set }
  • Whether this source should be reusable or not. usage may be reusable or single_use. Some source types may or may not be reusable by construction, while other may leave the option at creation.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) STPSourceUsage usage;

    Swift

    var usage: STPSourceUsage { get set }
  • Creates params for a Bancontact source.

    Note

    The currency for Bancontact must be eur. This will be set automatically for you.

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        bancontactParamsWithAmount:(NSUInteger)amount
                              name:(nonnull NSString *)name
                         returnURL:(nonnull NSString *)returnURL
               statementDescriptor:(nullable NSString *)statementDescriptor;

    Swift

    class func bancontactParams(withAmount amount: UInt, name: String, returnURL: String, statementDescriptor: String?) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer in EUR.

    name

    The full name of the account holder.

    returnURL

    The URL the customer should be redirected to after they have successfully verified the payment.

    statementDescriptor

    (Optional) A custom statement descriptor for the payment.

    Return Value

    an STPSourceParams object populated with the provided values.

  • Creates params for a Card source.

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)cardParamsWithCard:(nonnull STPCardParams *)card;

    Swift

    class func cardParams(withCard card: STPCardParams) -> STPSourceParams

    Parameters

    card

    An object containing the user’s card details

    Return Value

    an STPSourceParams object populated with the provided card details.

  • Creates params for a Giropay source.

    Note

    The currency for Giropay must be eur. This will be set automatically for you.

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        giropayParamsWithAmount:(NSUInteger)amount
                           name:(nonnull NSString *)name
                      returnURL:(nonnull NSString *)returnURL
            statementDescriptor:(nullable NSString *)statementDescriptor;

    Swift

    class func giropayParams(withAmount amount: UInt, name: String, returnURL: String, statementDescriptor: String?) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer in EUR.

    name

    The full name of the account holder.

    returnURL

    The URL the customer should be redirected to after they have successfully verified the payment.

    statementDescriptor

    (Optional) A custom statement descriptor for the payment.

    Return Value

    an STPSourceParams object populated with the provided values.

  • Creates params for an iDEAL source.

    Note

    The currency for iDEAL must be eur. This will be set automatically for you.

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)idealParamsWithAmount:(NSUInteger)amount
                                                  name:(nullable NSString *)name
                                             returnURL:(nonnull NSString *)returnURL
                                   statementDescriptor:
                                       (nullable NSString *)statementDescriptor
                                                  bank:(nullable NSString *)bank;

    Swift

    class func idealParams(withAmount amount: UInt, name: String?, returnURL: String, statementDescriptor: String?, bank: String?) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer in EUR.

    name

    (Optional) The full name of the account holder.

    returnURL

    The URL the customer should be redirected to after they have successfully verified the payment.

    statementDescriptor

    (Optional) A custom statement descriptor for t he payment.

    bank

    (Optional) The customer’s bank.

    Return Value

    an STPSourceParams object populated with the provided values.

  • Creates params for a SEPA Debit source.

    Note

    The currency for SEPA Debit must be eur. This will be set automatically for you.

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        sepaDebitParamsWithName:(nonnull NSString *)name
                           iban:(nonnull NSString *)iban
                   addressLine1:(nullable NSString *)addressLine1
                           city:(nullable NSString *)city
                     postalCode:(nullable NSString *)postalCode
                        country:(nullable NSString *)country;

    Swift

    class func sepaDebitParams(withName name: String, iban: String, addressLine1: String?, city: String?, postalCode: String?, country: String?) -> STPSourceParams

    Parameters

    name

    The full name of the account holder.

    iban

    The IBAN number for the bank account you wish to debit.

    addressLine1

    (Optional) The bank account holder’s first address line.

    city

    (Optional) The bank account holder’s city.

    postalCode

    (Optional) The bank account holder’s postal code.

    country

    (Optional) The bank account holder’s two-letter country code.

    Return Value

    an STPSourceParams object populated with the provided values.

  • Creates params for a Sofort source.

    Note

    The currency for Sofort must be eur. This will be set automatically for you.

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        sofortParamsWithAmount:(NSUInteger)amount
                     returnURL:(nonnull NSString *)returnURL
                       country:(nonnull NSString *)country
           statementDescriptor:(nullable NSString *)statementDescriptor;

    Swift

    class func sofortParams(withAmount amount: UInt, returnURL: String, country: String, statementDescriptor: String?) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer in EUR.

    returnURL

    The URL the customer should be redirected to after they have successfully verified the payment.

    country

    The country code of the customer’s bank.

    statementDescriptor

    (Optional) A custom statement descriptor for the payment.

    Return Value

    an STPSourceParams object populated with the provided values.

  • Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        threeDSecureParamsWithAmount:(NSUInteger)amount
                            currency:(nonnull NSString *)currency
                           returnURL:(nonnull NSString *)returnURL
                                card:(nonnull NSString *)card;

    Swift

    class func threeDSecureParams(withAmount amount: UInt, currency: String, returnURL: String, card: String) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer.

    currency

    The currency the payment is being created in.

    returnURL

    The URL the customer should be redirected to after they have successfully verified the payment.

    card

    The ID of the card source.

    Return Value

    an STPSourceParams object populated with the provided card details.

  • Creates params for a single-use Alipay source

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)alipayParamsWithAmount:(NSUInteger)amount
                                               currency:(nonnull NSString *)currency
                                              returnURL:
                                                  (nonnull NSString *)returnURL;

    Swift

    class func alipayParams(withAmount amount: UInt, currency: String, returnURL: String) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer.

    currency

    The currency the payment is being created in.

    returnURL

    The URL the customer should be redirected to after they have successfully verified the payment.

    Return Value

    An STPSourceParams object populated with the provided values

  • Creates params for a reusable Alipay source

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        alipayReusableParamsWithCurrency:(nonnull NSString *)currency
                               returnURL:(nonnull NSString *)returnURL;

    Swift

    class func alipayReusableParams(withCurrency currency: String, returnURL: String) -> STPSourceParams

    Parameters

    currency

    The currency the payment is being created in.

    returnURL

    The URL the customer should be redirected to after they have successfully verified the payment.

    Return Value

    An STPSourceParams object populated with the provided values

  • Creates params for a P24 source

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)p24ParamsWithAmount:(NSUInteger)amount
                                            currency:(nonnull NSString *)currency
                                               email:(nonnull NSString *)email
                                                name:(nullable NSString *)name
                                           returnURL:(nonnull NSString *)returnURL;

    Swift

    class func p24Params(withAmount amount: UInt, currency: String, email: String, name: String?, returnURL: String) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer.

    currency

    The currency the payment is being created in (this must be EUR or PLN)

    email

    The email address of the account holder.

    name

    The full name of the account holder (optional).

    returnURL

    The URL the customer should be redirected to after they have

    Return Value

    An STPSourceParams object populated with the provided values.

  • Creates params for a card source created from Visa Checkout.

    Note

    Creating an STPSource with these params will give you a source with type == STPSourceTypeCard

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)visaCheckoutParamsWithCallId:
        (nonnull NSString *)callId;

    Swift

    class func visaCheckoutParams(withCallId callId: String) -> STPSourceParams

    Parameters

    callId

    The callId property from a VisaCheckoutResult object.

    Return Value

    An STPSourceParams object populated with the provided values.

  • Creates params for a card source created from Masterpass.

    Note

    Creating an STPSource with these params will give you a source with type == STPSourceTypeCard

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        masterpassParamsWithCartId:(nonnull NSString *)cartId
                     transactionId:(nonnull NSString *)transactionId;

    Swift

    class func masterpassParams(withCartId cartId: String, transactionId: String) -> STPSourceParams

    Parameters

    cartId

    The cartId from a MCCCheckoutResponse object.

    transactionId

    The transactionid from a MCCCheckoutResponse object.

    Return Value

    An STPSourceParams object populated with the provided values.

  • Create params for an EPS source

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)epsParamsWithAmount:(NSUInteger)amount
                                                name:(nonnull NSString *)name
                                           returnURL:(nonnull NSString *)returnURL
                                 statementDescriptor:
                                     (nullable NSString *)statementDescriptor;

    Swift

    class func epsParams(withAmount amount: UInt, name: String, returnURL: String, statementDescriptor: String?) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer.

    name

    The full name of the account holder.

    returnURL

    The URL the customer should be redirected to after the authorization process.

    statementDescriptor

    A custom statement descriptor for the payment (optional).

    Return Value

    An STPSourceParams object populated with the provided values.

  • Create params for a Multibanco source

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        multibancoParamsWithAmount:(NSUInteger)amount
                         returnURL:(nonnull NSString *)returnURL
                             email:(nonnull NSString *)email;

    Swift

    class func multibancoParams(withAmount amount: UInt, returnURL: String, email: String) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer.

    returnURL

    The URL the customer should be redirected to after the authorization process.

    email

    The full email address of the customer.

    Return Value

    An STPSourceParams object populated with the provided values.

  • Create params for a WeChat Pay native app redirect source

    Note

    This feature is in private beta. For participating users, see https://stripe.com/docs/sources/wechat-pay/ios

    Declaration

    Objective-C

    + (nonnull STPSourceParams *)
        wechatPayParamsWithAmount:(NSUInteger)amount
                         currency:(nonnull NSString *)currency
                            appId:(nonnull NSString *)appId
              statementDescriptor:(nullable NSString *)statementDescriptor;

    Swift

    class func wechatPay(withAmount amount: UInt, currency: String, appId: String, statementDescriptor: String?) -> STPSourceParams

    Parameters

    amount

    The amount to charge the customer.

    currency

    The currency of the payment

    appId

    Your WeChat-provided application id. WeChat Pay uses this as the redirect URL scheme

    statementDescriptor

    A custom statement descriptor for the payment (optional).

    Return Value

    An STPSourceParams object populated with the provided values.