- Basic Integration has been removed. Please use Mobile Payment Element instead.
- Card image verification has been removed. Please use card OCR instead.
- PaymentSheet displays payment methods in either a vertical or horizontal layout. Prior to this major version, PaymentSheet defaulted to a horizontal layout. Now, Stripe optimizes the layout automatically. To set a specific layout instead, set the
PaymentSheet.Configuration.Builder.paymentMethodLayout
property to either Horizontal or Vertical.
- Changes to
PaymentSheetContract
:- The class has been deprecated and will be removed in a future release. Use the
PaymentSheet
constructor or the newrememberPaymentSheet()
method.
- The class has been deprecated and will be removed in a future release. Use the
- Changes to
PaymentLauncher
:PaymentLauncher.rememberLauncher()
has been deprecated and will be removed in a future release. Use the top-levelrememberPaymentLauncher()
method instead.
- Changes to
GooglePayLauncher
:GooglePayLauncher.rememberLauncher()
has been deprecated and will be removed in a future release. Use the top-levelrememberGooglePayLauncher()
method instead.
- Changes to
GooglePayPaymentMethodLauncher
:GooglePayPaymentMethodLauncher.rememberLauncher()
has been deprecated and will be removed in a future release. Use the top-levelrememberGooglePayPaymentMethodLauncher()
method instead.
- Changes to
GooglePayLauncherContract
:- The class has been deprecated and will be removed in a future release. Use
GooglePayLauncher
directly.
- The class has been deprecated and will be removed in a future release. Use
- Changes to
GooglePayPaymentMethodLauncherContract
:- The class has been deprecated and will be removed in a future release. Use
GooglePayPaymentMethodLauncher
directly.
- The class has been deprecated and will be removed in a future release. Use
- Changes to
PaymentSheet.Configuration
primaryButtonColor
is now deprecated. Please use the newAppearance
parameter instead:Appearance.colorsLight/colorsDark.primary
PrimaryButton.colorsLight/colorsDark.backgroundColor
- Changes to
CollectBankAccountLauncher
- Required, dependent artifact
com.stripe.connections
has been renamed tocom.stripe.financial-connections
.
- Required, dependent artifact
- The following classes' packages are changed
com.stripe.android.AppInfo
->com.stripe.android.core.AppInfo
com.stripe.android.model.StripeFile
->com.stripe.android.core.model.StripeFile
com.stripe.android.model.StripeFileParams
->com.stripe.android.core.model.StripeFileParams
com.stripe.android.model.StripeFilePurpose
->com.stripe.android.core.model.StripeFilePurpose
com.stripe.android.exception.AuthenticationException
->com.stripe.android.core.exception.AuthenticationException
com.stripe.android.exception.PermissionException
->com.stripe.android.core.exception.PermissionException
com.stripe.android.exception.RateLimitException
->com.stripe.android.core.exception.RateLimitException
- Changes to
StripeCardScan.Configuration
- Setting custom scan values in
Config
is no longer supported. Configuration values have been moved to theStripeCardScan.Configuration
object. If a value was removed that you need access to, please file an issue against this repository.
- Setting custom scan values in
- The following list of classes' package names are changed from
com.stripe.android
tocom.stripe.android.core
StripeModel
StripeError
StripeException
APIException
APIConnectionException
InvalidRequestException
- Changes to
PaymentSheet.Configuration
- If you're modifying values in your
Configuration
class after instantiating it then you won't be able to build your project. You should create the object with the final values or use the newBuilder
.
- If you're modifying values in your
- Changes to
Stripe
ComponentActivity
is now required for payment confirmation methods to make operations lifecycle-aware.authenticatePayment
andauthenticateSetup
have been removedcreateCardToken()
now requiresCardParams
instead ofCard
- Changes to
ConfirmPaymentIntentParams
returnUrl
has been removed as a parameter onConfirmPaymentIntentParams
static creation methods. The SDK manages setting this value internally.extraParams
property has been removed. Static creation methods that accept this parameter have been removed.
- Changes to
ConfirmSetupIntentParams
returnUrl
has been removed as a parameter onConfirmSetupIntentParams
static creation methods. The SDK manages setting this value internally.
- Changes to
Card
number
andcvc
properties have been removed to reflect the Stripe APImetadata
has been removed to reflect that it is no longer returned to clients using a publishable keyCard.Builder
has been removedfromString()
andfromJson()
static methods have been removedtoPaymentMethodsParams()
,toPaymentMethodParamsCard()
,toBuilder()
, and validation instance methods have been removed
- Changes to
PaymentMethod
metadata
has been removed to reflect that it is no longer returned to clients using a publishable keyPaymentMethod.Card.Builder
has been removed
- Changes to
PaymentIntent
nextAction
property has been removed. UsenextActionData
instead.
- Changes to
PaymentMethodCreateParams
Ideal.Builder
,Fpx.Builder
, andSepaDebit.Builder
have been removed
- Changes to
Source
metadata
has been removed to reflect that it is no longer returned to clients using a publishable key
- Changes to
SourceParams
- Most setter methods have been removed
extraParams
property has been removed
- Changes to
Customer
- Remove
fromString()
andfromJson()
- Rename
CustomerSource
toCustomerPaymentSource
and make a sealed class with typesCustomerBankAccount
,CustomerCard
, andCustomerSource
- Remove
- Changes to
CardBrand
- Deprecated methods have been removed
- Changes to
CardInputWidget
card
andcardBuilder
properties have been removed; usecardParams
instead
- Changes to
CardMultilineWidget
card
andcardBuilder
properties have been removed; usecardParams
instead
- Changes to
CardNumberEditText
lengthMax
andcardNumber
properties have been removed
- Changes to
CvcEditText
cvcValue
property has been removed
- Changes to
ExpiryDateEditText
validDateFields
property has been removed
- Changes to
StripeEditText
cachedColorStateList
property has been removed
- Other changes
GooglePayConfig
now requires instantiatedPaymentConfiguration
CardUtils
is nowinternal
StripeTextUtils
has been removedStripe.confirmPayment
andStripe.confirmSetupIntent
will now use Custom Tabs by default when performing 3DS1 Authentication. If Custom Tabs are not available the SDK will launch the device browser to perform authentication.
- Changes to
CardInputWidget
andCardMultilineWidget
- To enable 19-digit card support, [PaymentConfiguration.init] must be called before the card widgets are instantiated.
card
andcardBuilder
are deprecated. UsecardParams
instead.
- Changes to
CardNumberEditText
lengthMax
andcardNumber
are deprecated
- Changes to
CvcEditText
cvcValue
is deprecated
- Changes to
Card
number
andcvc
are deprecated and will be removed in a future release.Card.Builder
andtoBuilder()
are deprecated; useCardParams
instead.Card.fromString()
,Card.fromJson()
, andCard.create()
are deprecated and will be removed in a future release.metadata
is deprecated and no longer populated on the client. It must be fetched on your server using your secret key. If this is causing issues with your deployed app versions please reach out to Stripe Support. This field will be removed in a future SDK version.toPaymentMethodsParams()
andtoPaymentMethodParamsCard()
are deprecated; usePaymentMethodCreateParams.createCard()
instead.validateCard()
,validateNumber()
,validateExpiryDate()
,validateCVC()
,validateExpMonth()
are deprecated
- Changes to
CardBrand
- Methods
fromCardNumber()
,formatNumber()
,groupNumber()
,getSpacePositionsForCardNumber()
,getMaxLengthWithSpacesForCardNumber()
,getMaxLengthForCardNumber()
are deprecated - Properties
defaultMaxLength
,pattern
, anddefaultSpacePositions
are deprecated
- Methods
- Changes to
CardUtils
getPossibleCardBrand()
andisValidCardNumber
are deprecated
- Changes to
StripeTextUtils
removeSpacesAndHyphens()
is deprecated
- Changes to
SourceParams
createCardToken()
that accepts aCard
parameter is deprecated. UsecreateCardToken()
that accepts aCardParams
parameter instead.createCardTokenSynchronous()
that accepts aCard
parameter is deprecated. UsecreateCardTokenSynchronous()
that accepts aCardParams
parameter instead.
- Changes to
Source
metadata
is deprecated and no longer populated on the client. It must be fetched on your server using your secret key. If this is causing issues with your deployed app versions please reach out to Stripe Support. This field will be removed in a future SDK version.
- Changes to
PaymentMethod
metadata
is deprecated and no longer populated on the client. It must be fetched on your server using your secret key. If this is causing issues with your deployed app versions please reach out to Stripe Support. This field will be removed in a future SDK version.
- Changes to
Stripe
createCardParams()
that accepts aCard
parameter is deprecated. UsecreateCardParams()
that accepts aCardParams
parameter instead.createToken()
has been removed; usecreateCardToken()
instead.
- The SDK now targets JVM 1.8
- The SDK now requires Android 5.0+ (API level 21+)
- Changes to
PaymentIntent
PaymentIntent#captureMethod
is now an enum,PaymentIntent.CaptureMethod
// before if (paymentIntent.captureMethod == "automatic") { } else if (paymentIntent.captureMethod == "manual") { } // after when (paymentIntent.captureMethod) { PaymentIntent.CaptureMethod.Automatic -> {} PaymentIntent.CaptureMethod.Manual -> {} }
PaymentIntent#confirmationMethod
is now an enum,PaymentIntent.ConfirmationMethod
// before if (paymentIntent.confirmationMethod == "automatic") { } else if (paymentIntent.confirmationMethod == "manual") { } // after when (paymentIntent.confirmationMethod) { PaymentIntent.ConfirmationMethod.Automatic -> {} PaymentIntent.ConfirmationMethod.Manual -> {} }
- Changes to
PaymentMethod
PaymentMethod.Card#brand
is now aCardBrand
// before when (paymentMethod.card?.brand) { "visa" -> {} "mastercard" -> {} else -> {} } // after when (paymentMethod.card?.brand) { CardBrand.Visa -> {} CardBrand.MasterCard -> {} else -> {} }
- Changes to
Token
Token.TokenType
is renamed toToken.Type
and is now an enum// before when (token.type) { Token.TokenType.CARD -> {} Token.TokenType.BANK_ACCOUNT -> {} else -> {} } // after when (token.type) { Token.Type.Card -> {} Token.Type.BankAccount -> {} else -> {} }
- Changes to
PaymentSession
- Remove
PaymentSession#ActivityPaymentSessionListener
- Remove
- Changes to
CustomerSession
CustomerSession
's constructor no longer takes astripeAccountId
; instead, instantiatePaymentConfiguration
with astripeAccountId
// before PaymentConfiguration.init( context, "pk_test" ) CustomerSession.initCustomerSession( context ephemeralKeyProvider, "acct_1234" ) // after PaymentConfiguration.init( context, "pk_test", "acct_1234" ) CustomerSession.initCustomerSession( context ephemeralKeyProvider )
- Remove
CustomerSession#ActivityCustomerRetrievalListener
,CustomerSession#ActivityPaymentMethodRetrievalListener
,CustomerSession#ActivityPaymentMethodsRetrievalListener
, andCustomerSession#ActivitySourceRetrievalListener
- Changes to
AddPaymentMethodActivity
- When
PaymentConfiguration
is instantiated with astripeAccountId
, it will be used inAddPaymentMethodActivity
when creating a payment methodPaymentConfiguration.init(context, "pk_test", "acct_1234")
AddPaymentMethodActivity.Result
is now a sealed class withSuccess
,Failure
, andCanceled
subclasses// before val result = AddPaymentMethodActivityStarter.Result.fromIntent( intent ) when { result != null -> result.paymentMethod else -> { // error happened or customer canceled } } // after val result = AddPaymentMethodActivityStarter.Result.fromIntent( intent ) when (result) { is AddPaymentMethodActivityStarter.Result.Success -> { result.paymentMethod } is AddPaymentMethodActivityStarter.Result.Failure -> { result.exception } is AddPaymentMethodActivityStarter.Result.Canceled -> { // customer canceled } }
- When
- Changes to
ShippingInfoWidget
setOptionalFields()
is nowoptionalFields
setHiddenFields()
is nowhiddenFields
CustomizableShippingField
is now an enum
- Changes to
Source
Source.SourceFlow
has been renamed toSource.Flow
and is now an enumSource.SourceStatus
has been renamed toSource.Status
and is now an enumSource.Usage
is now an enumSourceCodeVerification
has been moved toSource.CodeVerification
SourceOwner
has been moved toSource.Owner
SourceReceiver
has been moved toSource.Receiver
SourceRedirect
has been moved toSource.Redirect
- Changes to
CustomerSource
CustomerSource#tokenizationMethod
is now aTokenizationMethod?
- Changes to
SourceTypeModel.Card
SourceTypeModel.Card.ThreeDSecureStatus
is now an enum
- Changes to
BankAccount
- public constructors have been removed
BankAccount#accountNumber
has been removedStripe#createBankAccountToken()
no longer accepts aBankAccount
instance; instead, useBankAccountTokenParams
Stripe#createBankAccountTokenSynchronous()
no longer accepts aBankAccount
instance; instead, useBankAccountTokenParams
- Changes to
AccountParams
- Remove
AccountParams.create()
that takes a raw map; instead, usecreate()
method that takes aAccountParams.BusinessTypeParams.Individual
orAccountParams.BusinessTypeParams.Company
- Remove
- Changes to
CardInputListener
FocusField
is now an enum
- Changes to
StripeIntent
-
redirectData
is now deprecated.If a
PaymentIntent
orSetupIntent
requires a redirect to authenticate, this information will be innextActionData
. However, as before, this action will be handled by the SDK inStripe.confirmPayment
/Stripe.confirmSetupIntent
.// before if (intent.redirectData != null) { // requires redirect } // after when (intent.nextActionData) { is StripeIntent.RedirectData.RedirectToUrl -> // requires redirect }
-
stripeSdkData
is now deprecated.If a
PaymentIntent
orSetupIntent
requires 3DS1 or 3DS2 authentication, this information will be innextActionData
. However, as before, this action will be handled by the SDK inStripe.confirmPayment
/Stripe.confirmSetupIntent
.// before if (intent.stripeSdkData != null) { // requires 3D Secure auth } // after when (intent.nextActionData) { is StripeIntent.RedirectData.SdkData -> // requires 3D Secure auth }
-
- Changes to Stripe Error localization
-
All Stripe Error messages are now localized based on the device locale.
For example, when retrieving a SetupIntent with a nonexistent
id
when the device locale is set toLocale.JAPAN
, the error message will now be localized.// before - English "No such setupintent: seti_invalid123" // after - Japanese "そのような setupintent はありません : seti_invalid123"
-
- Changes to Material Components
com.google.android.material:material
has been updated tov1.1.0
- Changes to
PaymentSession
- When instantiating a
PaymentSession()
with anActivity
, it must now be aComponentActivity
(e.g.AppCompatActivity
orFragmentActivity
) PaymentSession#init()
no longer takes asavedInstanceState
argument// before paymentSession.init(listener, savedInstancedState) // after paymentSession.init(listener)
PaymentSession#savePaymentSessionInstanceState()
has been removed; state management is handled byPaymentSession
PaymentSession#onDestroy()
has been removed; thelistener
instance is now released automatically when the hostActivity
orFragment
is destroyed- Remove
PaymentSessionData.paymentSessionData
; this data will be returned viaPaymentSessionListener#onPaymentSessionDataChanged()
- When instantiating a
- Changes to
StripeSourceTypeModel
- Rename to
SourceTypeModel
and make a sealed class - Move
SourceCardData
subclass toSourceTypeModel.Card
- Move
SourceSepaDebitData
subclass toSourceTypeModel.SepaDebit
- Change type of
Source#sourceTypeModel
toSourceTypeModel?
- Rename to
- Changes to
Card.FundingType
- Rename to
CardFunding
and convert to anenum
- Rename to
- Changes to
StripeException
subclassesInvalidRequestException
is nowfinal
- Remove
InvalidRequestException
'sparam
,errorCode
, anderrorDeclineCode
properties; these can be accessed via thestripeError
property// before invalidRequestException.param invalidRequestException.errorCode invalidRequestException.errorDeclineCode // after invalidRequestException.stripeError?.param invalidRequestException.stripeError?.code invalidRequestException.stripeError?.declineCode
RateLimitException
now extendsStripeException
- Update 3DS2 styles
- Create
BaseStripe3DS2TextInputLayout
that extendsWidget.MaterialComponents.TextInputLayout.OutlinedBox
- Create
Stripe3DS2TextInputLayout
that extendsBaseStripe3DS2TextInputLayout
- Apply
Stripe3DS2TextInputLayout
toTextInputLayout
- Create
BaseStripe3DS2EditText
with parentWidget.MaterialComponents.TextInputEditText.OutlinedBox
- Rename
Stripe3DS2EditTextTheme
toStripe3DS2EditText
and change its parent toBaseStripe3DS2EditText
- Apply
Stripe3DS2EditText
toTextInputEditText
- Create
- Changes to
Card
andSourceCardData
- Change the type of
brand
property fromString?
toCardBrand
- Remove
Card.CardBrand
- Change the type of
tokenizationMethod
property fromString?
toTokenizationMethod?
// before card.tokenizationMethod == "google_pay" // after card.tokenizationMethod == TokenizationMethod.GooglePay
- Change the type of
- Changes to
PaymentMethod
- Change the type of
type
property fromString?
toPaymentMethod.Type?
// before paymentMethod.type == "card" // after paymentMethod.type == PaymentMethod.Type.Card
- Change the type of
- Changes to
SourceParams
setOwner()
now takesOwnerParams
instead ofMap
// before sourceParams .setOwner(mapOf( "name" to "Jenny Rosen" )) // after sourceParams .setOwner(OwnerParams( name = "Jenny Rosen" ))
setRedirect()
has been removed; usesetReturnUrl()
instead// before sourceParams .setRedirect(mapOf("return_url" to "myapp://return")) // after sourceParams .setReturnUrl("myapp://return")
- Changes to
AccountParams
AccountParams.createAccountParams()
is now deprecated; use the appropriateAccountParams.create()
method.// before AccountParams.createAccountParams( true, AccountParams.BusinessType.Individual, mapOf( "address" to mapOf( "line1" to "123 Market St", "line2" to "#345", "city" to "San Francisco", "state" to "CA", "postal_code" to "94107", "country" to "US" ), "ssn_last_4" to "1234", "first_name" to "Jenny", "last_name" to "Rosen" ) ) // after AccountParams.create( true, AccountParams.BusinessTypeParams.Individual( address = Address( line1 = "123 Market St", line2 = "#345", city = "San Francisco", state = "CA", postal_code = "94107", country = "US" ), ssnLast4 = "1234", firstName = "Jenny", lastName = "Rosen" ) )
- Changes to
StripeEditText
StripeEditText
now extendsTextInputEditText
instead ofAppCompatEditText
- Changes to
CardInputWidget
- The postal code field is now displayed by default
- The postal code input is not validated
StripeEditText
subclasses (e.g.CardNumberEditText
) used in this widget are now wrapped inTextInputLayout
- Changes to
CardMultilineWidget
- The postal code field is now displayed by default
- The postal code field is now optional when displayed
- The postal code input is not validated
CardInputListener.onPostalCodeComplete()
has been removed
- Changes to
Stripe
- Bindings for API POST methods now take an optional
idempotencyKey
. Read about Idempotent Requests for more details.// before stripe.createPaymentMethod( paymentMethodCreateParams, callback ) // after - without idempotency key stripe.createPaymentMethod( paymentMethodCreateParams, callback = callback ) // after - with idempotency key stripe.createPaymentMethod( paymentMethodCreateParams, idempotencyKey = idempotencyKey, callback = callback )
- Bindings for API POST methods now take an optional
- Changes to
PaymentMethodsActivityStarter.Result
- The type of
paymentMethod
has been changed fromPaymentMethod
toPaymentMethod?
(i.e. it is nullable)
- The type of
- Changes to
PaymentSession
-
PaymentSession
now takes thePaymentSessionConfig
instance through its constructor, instead ofinit()
// before val paymentSession = PaymentSession(activity) paymentSession.init(listener, paymentSessionConfig) // after val paymentSession = PaymentSession(activity, paymentSessionConfig) paymentSession.init(listener)
-
By default, users will be asked for their postal code (i.e.
BillingAddressFields.PostalCode
) when adding a new card payment method. -
PaymentSession#init()
no longer takes ashouldPrefetchCustomer
argument. If you need to specifyshouldPrefetchCustomer
, usePaymentSessionConfig.Builder.setShouldPrefetchCustomer()
. -
PaymentSession#presentPaymentMethodSelection(shouldRequirePostalCode, userSelectedPaymentMethodId)
is deleted. If you need to specify billing details, usePaymentSessionConfig.Builder#setBillingAddressFields()
. -
setShouldRequirePostalCode()
has been removed fromAddPaymentMethodActivityStarter.Args
andPaymentMethodsActivityStarter.Args
. UsesetBillingAddressFields()
instead. -
Shipping information validation and shipping methods creation logic when using
PaymentSession
has been improved. Previously, this was accomplished by creating aBroadcastReceiver
and registering it for a particularIntent
. This has been greatly simplified by providingShippingInformationValidator
andShippingMethodsFactory
interfaces that can be defined when creating thePaymentSessionConfig
. See below for an example.-
Before, using
BroadcastReceiver
class PaymentSessionActivity : AppCompatActivity() { private lateinit var broadcastReceiver: BroadcastReceiver override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val localBroadcastManager = LocalBroadcastManager.getInstance(this) broadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val shippingInformation = intent .getParcelableExtra<ShippingInformation>(EXTRA_SHIPPING_INFO_DATA) val shippingInfoProcessedIntent = Intent(EVENT_SHIPPING_INFO_PROCESSED) if (!isValidShippingInfo(shippingInformation)) { shippingInfoProcessedIntent.putExtra(EXTRA_IS_SHIPPING_INFO_VALID, false) } else { shippingInfoProcessedIntent .putExtra(EXTRA_IS_SHIPPING_INFO_VALID, true) .putParcelableArrayListExtra( EXTRA_VALID_SHIPPING_METHODS, SHIPPING_METHODS ) .putExtra( EXTRA_DEFAULT_SHIPPING_METHOD, SHIPPING_METHODS.last() ) } localBroadcastManager.sendBroadcast(shippingInfoProcessedIntent) } private fun isValidShippingInfo(shippingInfo: ShippingInformation?): Boolean { return shippingInfo?.address?.country == Locale.US.country } } localBroadcastManager.registerReceiver(broadcastReceiver, IntentFilter(EVENT_SHIPPING_INFO_SUBMITTED)) } override fun onDestroy() { LocalBroadcastManager.getInstance(this) .unregisterReceiver(broadcastReceiver) super.onDestroy() } private companion object { private val SHIPPING_METHODS = arrayListOf( ShippingMethod("UPS Ground", "ups-ground", 0, "USD", "Arrives in 3-5 days"), ShippingMethod("FedEx", "fedex", 599, "USD", "Arrives tomorrow") ) } }
-
After, using
ShippingInformationValidator
andShippingMethodsFactory
class PaymentSessionActivity : AppCompatActivity() { private fun createPaymentSession(): PaymentSession { val customerSession = createCustomerSession() val paymentSession = PaymentSession(this) paymentSession.init( listener = createPaymentSessionListener(), paymentSessionConfig = createPaymentSessionConfig(), savedInstanceState = savedInstanceState ) return paymentSession } private fun createPaymentSessionConfig(): PaymentSessionConfig { PaymentSessionConfig.Builder() .setShippingInformationValidator(ShippingInformationValidator()) .setShippingMethodsFactory(ShippingMethodsFactory()) .build() } private class ShippingInformationValidator : PaymentSessionConfig.ShippingInformationValidator { override fun isValid( shippingInformation: ShippingInformation ): Boolean { return shippingInformation.address?.country == Locale.US.country } override fun getErrorMessage( shippingInformation: ShippingInformation ): String { return "The country must be US." } } private class ShippingMethodsFactory : PaymentSessionConfig.ShippingMethodsFactory { override fun create( shippingInformation: ShippingInformation ): List<ShippingMethod> { return listOf( ShippingMethod("UPS Ground", "ups-ground", 0, "USD", "Arrives in 3-5 days"), ShippingMethod("FedEx", "fedex", 599, "USD", "Arrives tomorrow") ) } } }
-
-
Related to the above,
PaymentFlowExtras
is deleted
-
-
Replace
Stripe#createTokenSynchronous(Card)
withStripe#createCardTokenSynchronous(Card)
// Java // before stripe.createTokenSynchronous(card); // after stripe.createCardTokenSynchronous(card);
// Kotlin // before stripe.createTokenSynchronous(card) // after stripe.createCardTokenSynchronous(card)
-
Replace
Card#getCVC()
withCard#getCvc()
// Java // before card.getCVC(); // after card.getCvc();
// Kotlin // before card.getCVC() // after card.cvc
-
Remove
AddPaymentMethodActivity#EXTRA_NEW_PAYMENT_METHOD
, useAddPaymentMethodActivityStarter.Result.fromIntent()
instead// Java // before private PaymentMethod getPaymentMethodFromIntent(@NonNull Intent intent) { return intent.getParcelableExtra<PaymentMethod>(AddPaymentMethodActivity.EXTRA_NEW_PAYMENT_METHOD); } // after private PaymentMethod getPaymentMethodFromIntent(@NonNull Intent intent) { final AddPaymentMethodActivityStarter.Result result = AddPaymentMethodActivityStarter.Result.fromIntent(intent) return result != null ? result.paymentMethod : null; }
// Kotlin // before private fun getPaymentMethodFromIntent(intent: Intent): PaymentMethod? { return intent.getParcelableExtra(AddPaymentMethodActivity.EXTRA_NEW_PAYMENT_METHOD) } // after private fun getPaymentMethodFromIntent(intent: Intent): PaymentMethod? { val result: AddPaymentMethodActivityStarter.Result? = AddPaymentMethodActivityStarter.Result.fromIntent(intent) return result?.paymentMethod }
-
Create overloaded
ShippingMethod
constructor with optionaldetail
argument// Java // before ShippingMethod("FedEx", "fedex", null, 599, "USD"); ShippingMethod("FedEx", "fedex", "Arrives tomorrow", 599, "USD"); // after ShippingMethod("FedEx", "fedex", 599, "USD"); ShippingMethod("FedEx", "fedex", 599, "USD", "Arrives tomorrow");
// Kotlin // before ShippingMethod("FedEx", "fedex", null, 599, "USD") ShippingMethod("FedEx", "fedex", "Arrives tomorrow", 599, "USD") // after ShippingMethod("FedEx", "fedex", 599, "USD") ShippingMethod("FedEx", "fedex", 599, "USD", "Arrives tomorrow")
-
Payment Intent requests (i.e. requests to
/v1/payment_intents
) now return localized error messages// Java // before @Test public void testErrorMessage() { Locale.setDefault(Locale.GERMANY); final Stripe stripe = createStripe(); final InvalidRequestException exception = assertThrows( InvalidRequestException.class, new ThrowingRunnable() { @Override public void run() throws Throwable { stripe.retrievePaymentIntentSynchronous("invalid"); } }); // Locale is Germany, error message is in English assertEquals( "No such payment_intent: invalid", exception.getStripeError().getMessage() ); } // after @Test public void testErrorMessage() { Locale.setDefault(Locale.GERMANY); final Stripe stripe = createStripe(); final InvalidRequestException exception = assertThrows( InvalidRequestException.class, new ThrowingRunnable() { @Override public void run() throws Throwable { stripe.retrievePaymentIntentSynchronous("invalid"); } }); // Locale is Germany, error message is in Germany assertEquals( "Keine solche payment_intent: invalid", exception.getStripeError().getMessage() ); }
- AndroidX is required. Please read the Migrating to AndroidX guide for more information. See #1478.
- The signatures of
PaymentConfiguration.init()
andPaymentConfiguration.getInstance()
have been changed. They now both take aContext
instance as the first argument. See #1479.// before PaymentConfiguration.init("publishable_key") PaymentConfiguration.getInstance() // after PaymentConfiguration.init(context, "publishable_key") PaymentConfiguration.getInstance(context)
- Remove
Stripe
methods that accept a publishable key. Pass publishable key in theStripe
constructor.// Example // before val stripe = Stripe(context) stripe.createPaymentMethodSynchronous(params, "pk_test_demo123") // after val stripe = Stripe(context, "pk_test_demo123") stripe.createPaymentMethodSynchronous(params)
Source
is immutable. All setter methods have been removed. See #1480.TokenCallback
andSourceCallback
have been removed. UseApiResultCallback<Token>
andApiResultCallback<Source>
instead. See #1481.StripeIntent#getStatus()
has been removed. UseStripeIntent#getOutcome()
instead.PaymentIntent#getSource()
has been removed. UsePaymentIntent#getPaymentMethodId()
instead.SetupIntent#getCustomerId()
has been removed. This method was unintentionally added and always returnednull
.- The
samplestore
app has moved to stripe-samples/sample-store-android. - Remove
PaymentMethodsActivity.newIntent()
. UsePaymentMethodsActivityStarter#startForResult()
to startPaymentMethodsActivity
. - Remove
PaymentMethodsActivity.EXTRA_SELECTED_PAYMENT
. UsePaymentMethodsActivityStarter.Result#fromIntent(intent)
to obtain the result ofPaymentMethodsActivity
. - Remove
Stripe#createToken()
withExecutor
argument. Use Stripe#createCardToken() instead.
- You must call
PaymentConfiguration.init()
before callingCustomerSession.initCustomerSession()
.PaymentConfiguration.init(PUBLISHABLE_KEY); CustomerSession.initCustomerSession(context, ephemeralKeyProvider);
-
The signature of
Stripe#retrievePaymentIntentSynchronous()
has changed. It now takes a client_secretString
instead of aPaymentIntentParams
instance. See #1172.// before stripe.retrievePaymentIntentSynchronous( PaymentIntentParams.createRetrievePaymentIntentParams(clientSecret)); // after stripe.retrievePaymentIntentSynchronous(clientSecret);
-
PaymentIntentParams
is nowConfirmPaymentIntentParams
and its method names have been simplified. See #1172.// before PaymentIntentParams.createConfirmPaymentIntentWithPaymentMethodId( paymentMethodId, clientSecret, returnUrl); // after ConfirmPaymentIntentParams.createWithPaymentMethodId(paymentMethodId, clientSecret, returnUrl);
-
All
@StringDef
constants have been inlined in their respective@interface
. Below is an example fromCard.FundingType
. See #1173.// before @Retention(RetentionPolicy.SOURCE) @StringDef({ FUNDING_CREDIT, FUNDING_DEBIT, FUNDING_PREPAID, FUNDING_UNKNOWN }) public @interface FundingType { } public static final String FUNDING_CREDIT = "credit"; public static final String FUNDING_DEBIT = "debit"; public static final String FUNDING_PREPAID = "prepaid"; public static final String FUNDING_UNKNOWN = "unknown"; // after @Retention(RetentionPolicy.SOURCE) @StringDef({ FundingType.CREDIT, FundingType.DEBIT, FundingType.PREPAID, FundingType.UNKNOWN }) public @interface FundingType { String CREDIT = "credit"; String DEBIT = "debit"; String PREPAID = "prepaid"; String UNKNOWN = "unknown"; }
- The enum
PaymentIntent.Status
is nowStripeIntent.Status
- The enum
PaymentIntent.NextActionType
is nowStripeIntent.NextActionType
These changes should not impact Java integrations. For Kotlin integrations, please change your reference as shown in the example below.
// before
PaymentIntent.Status.Succeeded
// after
StripeIntent.Status.Succeeded
-
CustomerSession
's Listener interfaces'sonError()
method now have a@NonNull
errorMessage
argument// before new CustomerSession.CustomerRetrievalListener() { @Override public void onError(int errorCode, @Nullable String errorMessage, @Nullable StripeError stripeError) { } } // after new CustomerSession.CustomerRetrievalListener() { @Override public void onError(int errorCode, @NonNull String errorMessage, @Nullable StripeError stripeError) { } }
-
PaymentResultListener
has been removed -
PaymentSession#completePayment()
has been replaced withPaymentSession#onCompleted()
// before private void chargePaymentMethod() { mPaymentSession.completePayment(new PaymentCompletionProvider() { @Override public void completePayment(@NonNull PaymentSessionData data, @NonNull PaymentResultListener listener) { // Make async request to your backend to charge the payment method. // Upon success, call: listener.onPaymentResult(PaymentResultListener.SUCCESS); } }); } // after private void chargePaymentMethod() { // Make async request to your backend to charge the payment method. // Upon success, call: mPaymentSession.onCompleted(); }
Card
model is now immutableCard#getType()
is nowCard#getBrand()
- Standard UI components now use
PaymentMethod
instead ofSource
- Setting a customer's default payment method is not available for PaymentMethod objects
CustomerSession#getPaymentMethods()
andCustomerSession#attachPaymentMethod()
have been addedPaymentSessionData#getSelectedPaymentMethodId()
is nowPaymentSessionData#getPaymentMethod()
and returns aPaymentMethod
. See usage in the samplestore app's PaymentActivity.java.
- Remove the following unused methods from
PaymentConfiguration
getRequiredBillingAddressFields()
setRequiredBillingAddressFields()
getShouldUseSourcesForCards()
setShouldUseSourcesForCards()
-
minSdkVersion
is now 19 -
AccountParams.createAccountParams()
requires aAccountParams#BusinessType
parameter// before AccountParams.createAccountParams( true, createBusinessData() ); // after, AccountParams.BusinessType is required // for Individual entities AccountParams.createAccountParams( true, BusinessType.Individual, createBusinessData() ); // for Company entities AccountParams.createAccountParams( true, BusinessType.Company, createBusinessData() );
-
CustomerSession.initCustomerSession()
now has aContext
parameter. Related,CustomerSession
public instance methods no longer have aContext
parameter.// before CustomerSession.initCustomerSession(ephemeralKeyProvider); CustomerSession.getInstance().setCustomerShippingInformation(this, listener); // after CustomerSession.initCustomerSession(this, ephemeralKeyProvider); CustomerSession.getInstance().setCustomerShippingInformation(listener);
-
PaymentIntent
has been updated to reflect API version 2019-02-11PaymentIntent.Status.RequiresSource
is nowPaymentIntent.Status.RequiresPaymentMethod
PaymentIntent.Status.RequiresSourceAction
is nowPaymentIntent.Status.RequiresAction
PaymentIntent.NextActionType.AuthorizeWithUrl
has been removedPaymentIntent#getNextSourceAction()
is nowPaymentIntent#getNextAction()
PaymentIntent#getAuthorizationUrl()
is nowPaymentIntent#getRedirectUrl()
PaymentIntent#requiresAction()
has been added as a conveniencePaymentIntent#getStatus()
now returns aPaymentIntent.Status
enum value instead of aString
-
Address
is now immutable and its setters have been removed. UseAddress.Builder
to create a newAddress
object.
- Remove Bitcoin source support because Stripe no longer processes Bitcoin payments
- Sources can no longer have a "BITCOIN" source type. These sources will now be interpreted as "UNKNOWN".
- You can no longer
createBitcoinParams
. Please use a different payment method.
StripeApiHandler
methods can no longer be called directly.PaymentConfiguration
now stores your public key and is depended upon forCustomerSession
.- Many Utils classes have been migrated to package-private access.
- Instantiation of a Stripe object can no longer throw an
AuthenticationException
.- Any time you were instantiating a Stripe object in a try/catch block will be simplified.
now becomesStripe stripe; try { stripe = new Stripe(mContext, MY_PUBLISHABLE_KEY); } catch (AuthenticationException authEx) { // This never happens because you check your key. }
Stripe stripe = new Stripe(mContext, MY_PUBLISHABLE_KEY);
Stripe#setDefaultPublishableKey(String key)
has similarly been changed, and no longer needs to be wrapped.- Both methods can still throw an
IllegalArgumentException
if an invalid key is used, but as a runtime exception, that does not need to be wrapped. AuthenticationException
will now only be thrown if you attempt to create aToken
orSource
with an invalid key.