Skip to content

Migration guide for v6

Olivier Bellone edited this page Sep 13, 2018 · 7 revisions

Deleted models

All Deleted* models have been removed. Instead, deletable resources now have a deleted attribute.

Deprecated methods

All methods that accepted a String apiKey as their last argument have been removed. If you want to send a request with a specific API key, use the signature with the RequestOptions options argument instead.

E.g.:

// Don't do this
Charge charge = Charge.create(chargeParams, "sk_...");

// Instead do this
RequestOptions options = (new RequestOptionsBuilder()).setApiKey("sk_...").build();
Charge charge = Charge.create(chargeParams, options);

// Or even better, use the `Stripe-Account` header
RequestOptions options = (new RequestOptionsBuilder()).setStripeAccount("acct_...").build();
Charge charge = Charge.create(chargeParams, options);

Some older deprecated methods have been removed:

Removed method Replacement
<Resource>.all() <Resource>.list()
ApplicationFee.refund() ApplicationFee.getRefunds().create()
Charge.closeDispute() Dispute.close()
Charge.updateDispute() Dispute.update()
Customer.cancelSubscription() Subscription.cancel()
Customer.createBankAccount() Customer.getSources().create()
Customer.createCard() Customer.getSources().create()
Customer.createSubscription() Subscription.create()
Customer.updateSubscription() Subscription.update()
Recipient.createCard() Recipient.getCards().create()

Nested object classes

Some classes that were used to represent nested properties of main API resources have been moved directly onto the API resource class:

Old class New name
AccountDeclineChargeOn Account.DeclineChargeOn
AccountPayoutSchedule Account.PayoutSchedule
AccountTosAcceptance Account.TosAcceptance
AccountTransferSchedule Account.TransferSchedule
AlternateStatementDescriptors Charge.AlternateStatementDescriptors
ChargeLevel3 Charge.Level3
ChargeLevel3LineItem Charge.Level3.LineItem
ChargeOutcome Charge.Outcome
ChargeOutcomeRule Charge.Outcome.Rule
Inventory Sku.Inventory
Money Balance.Money
NextRecurringCharge Customer.NextRecurringCharge
PaymentIntentTransferData PaymentIntent.TransferData
PlanTier Plan.Tier
PlanTransformUsage Plan.TransformUsage
ShippingMethod Order.ShippingMethod
SourceCodeVerificationFlow Source.CodeVerificationFlow
SourceOwner Source.Owner
SourceReceiverFlow Source.ReceiverFlow
SourceRedirectFlow Source.RedirectFlow
StatusTransitions Order.StatusTransitions
Summary Transfer.Summary
VerificationFields CountrySpec.VerificationFields
VerificationFieldsDetails CountrySpec.VerificationFields.Details

Capitalization changes

The library now adheres strictly to Google's Java style rules. Only the first letter of acronyms is capitalized.

Old name New name
APIConnectionException ApiConnectionException
APIResource ApiResource
getURL() getUrl()
getRedirectURL() getRedirectUrl()
getReturnURL() getReturnUrl()
SKU Sku

Numeric types

Resource attributes with numeric types have now been unified:

  • all integer types are now Long (previously, they were either Integer or Long)
  • all floating point types are now BigDecimal (previously, they were either Float or Double)

New exception class

A new exception class IdempotencyException was added, and may be raised by all Stripe methods. If you use idempotent requests, you should catch this new exception. (Previously, such errors were raised InvalidRequestException.)