- PayPal
- Fix a bug where vault flows that used a tokenization key could not tokenize
- Add prefix to
BraintreeError
codes to prevent namespace collisions - PayPal
- Return a
PAYPAL_POPUP_CLOSED
error code when the customer closes the popup - Return a
PAYPAL_INVALID_PAYMENT_OPTION
error code when PayPal options are invalid - Fix a bug where some locale codes were not accepted
- Fix bug where JPY could not be used as PayPal currency
- vault flows will automatically vault PayPal accounts if client token was generated with a customer id
- Return a
- Hosted Fields
- Automatic input formatting disabled for iOS and Android
- Apple Pay
- Use error codes
- Some wrapped errors were inconsistently placed under the
err.details
property; they are now undererr.details.originalError
- Client
- Errors are now always instances of BraintreeError
- UnionPay
- Add
vault
as an option totokenize
which allows cards to be vaulted on tokenization
- Add
-
Some error messages have been changed to be more consistent across components
-
Update
BraintreeError
to include acode
, which can be used to check for specific errors:hostedFieldsInstance.tokenize(function (err, payload) { if (err && err.code === 'FIELDS_EMPTY') { // Handle user input error } });
-
Fix an incorrect
<script>
tag example in API docs -
Fix an error in Require.js API docs
-
Hosted Fields
- Automatic input formatting disabled for Android Firefox
- Add
vault
as an option totokenize
which allows cards to be vaulted on tokenization - Add
addClass
andremoveClass
for updating classes on fields - Stop applying
invalid
CSS classes topotentiallyValid
fields on tokenization attempts
-
PayPal
- Consistently return
BraintreeError
objects when the PayPal flow is cancelled - Return error during
create
when using a webview
- Consistently return
-
UnionPay
- Add
type
to tokenize payload
- Add
-
Add Apple Pay component.
- Update create error messages to be more consistent
- Add
type
to Hosted Fields and PayPal tokenize payloads - Hosted Fields
- Add
getState
method that returns the state of all fields and possible card types - Fixes a regression where expiration dates with a past month within the current year were treated as valid
- Add
- PayPal
- Add
useraction
option topaypal.tokenize
- Add
BREAKING CHANGES
- UnionPay improvements.
- Card capabilities
- Renamed
isUnionPayEnrollmentRequired
toisSupported
. - When
isSupported
is false, Braintree cannot process UnionPay card. Customer would need to use a different card.
- Renamed
- Enrollment response has
smsCodeRequired
flag.- If
true
, customer will receive an SMS code, that is required for tokenization. - If
false
, SMS code should not be passed during tokenization. Tokenization can be done immediately.
- If
- Card capabilities
- Return a human readable error message when requests are rate-limited.
- Add 3D Secure component.
- Hosted Fields
- Throw an error when initializing with an invalid field key. See BREAKING CHANGES.
- The formatting for expiration dates no longer inserts a leading
0
if the date begins with1
. This prevents the numbers from jumping around for dates beginning01
,10
,11
, or12
.
BREAKING CHANGES
- An error is now returned when initializing Hosted Fields with an invalid field; it is no longer silently ignored.
- No longer throws exceptions when using
require('braintree-web')
during server-side rendering with libraries such as React.js. index.js
anddebug.js
in the npm/bower modules no longer referencepackage.json
.- Ajax errors in IE9 now report as general error instead of an empty string. It is impossible to get details additional about network errors in IE9 XDomainRequests.
- Add 3D Secure component
- UnionPay
- Expiration date or month/year together are now optional as some UnionPay cards do not have expiration dates.
- PayPal
- All
create
options aside fromclient
have now moved totokenize
. See BREAKING CHANGES. - For one-time checkout, add
intent
option which can besale
orauthorize
- HTTPS is no longer required
- Add
offerCredit
as an option totokenize
for offering customers PayPal Credit as a form of payment
- All
BREAKING CHANGES
-
PayPal's
create
options have moved totokenize
. Deferring these options to tokenization time allows greater flexibility in your checkout experience.braintree.paypal.create({ client: clientInstance }, function (err, paypalInstance) { paypalInstance.tokenize({ flow: 'checkout', amount: '10.00', currency: 'USD' }, function (tokenizeErr, payload) { // ... }); });
- Hosted Fields
- Update
card-validator
to2.2.8
- Throw a proper error when creating without a callback
- Update
- UnionPay
- Fix tokenization bugs
- Data Collector
- Throw a proper error when creating without a callback
- Improved error messaging when two components' versions do not match one another.
BREAKING CHANGES
- Data Collector
-
The
create
API has changed.options.kount
fordataCollector.create
is now a simple boolean:dataCollector.create({ client: clientInstance, kount: true, paypal: true }, function (err, collector) {});
-
- Hosted Fields
- Add
inputSubmitRequest
event which is called when the user presses the Enter key (or equivalent) in a Hosted Fields input.
- Add
BREAKING CHANGES
- Make all callbacks consistently called asynchronously
- Hosted Fields
- The
fieldStateChange
event is now 4 events:empty
,notEmpty
,validityChange
, andcardTypeChange
- Change event payloads to always return the full state of the form and all possible card types
- The
- Data Collector
- A
client
option is now required
- A
- Hosted Fields
postalCode
field now has a maximum length of 10 characters- Fix issues when pasting into fields
- UnionPay
- Added support for UnionPay and Hosted Fields
- Updated the API
- Added
teardown
to cleanly destroy a UnionPay instance
- PayPal
- Add support for
billingAgreementDescription
- Add support for
BREAKING CHANGES
- UnionPay
fetchCapabilities
now takescard: {number: '4111'}
instead ofcardNumber: '4111'
enroll
now takes mobile phone data under themobile
property instead of thecard
propertyenroll
now returns a property calledenrollmentId
instead ofunionpayEnrollmentId
- Removed the
options.options
property fromtokenize
;smsCode
andenrollmentId
are now top-level options
- Improve documentation of callbacks
- Hosted Fields
- Calling methods (such as
tokenize
orsetPlaceholder
) after Hosted Fields has been torn down throws an error
- Calling methods (such as
- PayPal
- Calling methods (such as
tokenize
) after PayPal has been torn down throws an error
- Calling methods (such as
- DataCollector
- Throw an error when trying to tear down twice
- American Express
getRewardsBalance
to get the rewards balance of a Braintree noncegetExpressCheckoutProfile
to get the Express Checkout profile of an Amex nonce
- UnionPay
fetchCapabilities
to fetch card capabilities, and determine if a card requires enrollmentenroll
to process enrollment for a cardtokenize
UnionPay cards
- Client
client
components no longer have ateardown
function
- Hosted Fields
- Add
setPlaceholder
to allow dynamic updating of field placeholders - Client component version must match Hosted Fields' component version
- Throw
BraintreeError
if tokenize does not include a callback
- Add
- PayPal
- Bugfixes in teardown
- Client component version must match PayPal's component version
- Make teardown callback optional
- Throw
BraintreeError
if tokenize does not include a callback
- npm packaging fixes
- Hosted Fields
- Allow expiration dates with leading zeroes when formatting is enabled
- PayPal
- Bugfixes
BREAKING CHANGES
- PayPal
- Replace
shippingAddressOverride.editable
withshippingAddressEditable
, which disables user editing of shipping address when set to false. - Replace
singleUse
boolean property withflow
string property.singleUse: true
is nowflow: 'checkout'
.flow
is required; useflow: 'vault'
for Vault flow.
- Replace
Old | New |
---|---|
singleUse omitted |
flow: 'vault' |
singleUse: false |
flow: 'vault' |
singleUse: true |
flow: 'checkout' |
This release contains a number of new features for developers and their users, the key benefits are listed below. This is a significant departure from our earlier versions of the JS SDK. It is a composable SDK instead of a collection of pre-defined integration patterns (better for more advanced developers):
-
Smaller File Size
Results in faster load times and improves performance of their web applications. A merchant has the choice to control the size by controlling the components they use. To illustrate the implications of this: a merchant who is only using PayPal does not need to include (and subsequently force their users to download) the code for Hosted Fields, DataCollector, etc. if they are not leveraging these features.
-
Modular Architecture for Advanced Developers
Rebuilt with a module-first approach. Developers have the choice and control over the specific JS SDK components they’d like to use instead of using the full SDK. The value of this is that it results in a simpler integration and also has been something many advanced developers have requested.
-
Custom PayPal Button
Developers have the option to customize the PayPal button that is displayed on their page. We provide only a bindable programmatic handler.
-
Hosted Fields Formatting
Many developers who use Hosted Fields have asked us for more robust abilities to format input into the Hosted Fields Form Fields for UX reasons. The new SDK allows fields to be formatted. One example of this is clean spacing between card numbers (4111 1111 1111 1111 instead of 4111111111111111).
-
No Dependency on Form Submissions
Traditionally, our SDK has required developers to submit payment information in the context of a form. We no longer require developers to integrate with this pattern. Modern web applications tend to be built with richer client-side functionality (validation, multiple payment options, AJAX submission, etc.). Deferring the mechanics of tokenization to a simple API call in our SDK allows our libraries to be much less intrusive as far as developer experience goes.
-
CORS Support, as opposed to JSONP
CORS is a Web Security technology that allows developers tight control over which third party services can be rendered within their web page. This is now the default.
-
Improved .NET Experience
.NET developers who use the WebForms Technology have run into many issues with previous versions of our SDK related to competing form submission handling. Since we no longer rely on form submissions, native .NET form handling is left untouched.
-
Improved Documentation
By its very nature, this new release is more low-level and less opinionated about contextual integration. This means we can provide an API reference and simpler getting started guides.
-
Modern distribution
By focusing on npm and GitHub as release channels the SDK fits better with newer build pipelines and tooling.
-
Improved error messaging
Better error handling and presentation everywhere, with clearer error messaging.