.createSourceWithParams(params) -> Promise

Creates source object based on params. Sources are used to create payments for a variety of payment methods

NOTE: For sources that require redirecting your customer to authorize the payment, you need to specify a return URL when you create the source. This allows your customer to be redirected back to your app after they authorize the payment. For this return URL, you can either use a custom URL scheme or a universal link supported by your app. For more information on registering and handling URLs in your app, refer to the Apple documentation:

You also need to setup yourAppDelegate.mapp delegate to forward URLs to the Stripe SDK according to the official iOS implementation

params — An object with the following keys:

Depending on the type you need to provide different params. Check the STPSourceParams docs for reference

Key Type Description
type (Required) String The type of the source to create. Can be one of: bancontact ‖ bitcoin ‖ card ‖ griopay ‖ ideal ‖ sepaDebit ‖ sofort ‖ threeDSecure ‖ alipay
amount Number A positive number in the smallest currency unit representing the amount to charge the customer (e.g., 1099 for a €10.99 payment)
name String The full name of the account holder
returnURL String The URL the customer should be redirected to after they have successfully verified the payment
statementDescriptor String A custom statement descriptor for the payment
currency String The currency associated with the source. This is the currency for which the source will be chargeable once ready
email String The customer’s email address
bank String The customer’s bank
iban String The IBAN number for the bank account you wish to debit
addressLine1 String The bank account holder’s first address line (optional)
city String The bank account holder’s city
postalCode String The bank account holder’s postal code
country String The bank account holder’s two-letter country code (sepaDebit) or the country code of the customer’s bank (sofort)
card String The ID of the card source

Example

const params = {
  type: 'alipay',
  amount: 5,
  currency: 'EUR',
  returnURL: 'example://stripe-redirect',
}

const source = await stripe.createSourceWithParams(params)

// Client specific code
// api.sendSourceToBackend(source)

results matching ""

    No results matching ""