Search...
APIJSLog inGet started
Airwallex logo
Home
Platform APIs
Connected Accounts
Accounts
Payments
Transactional FX
Payouts
Issuing
Back to home
OverviewAPI
SDKs
Airwallex.js
Customization optionsUpgrade to Airwallex.js
Upgrade from Payment Elements SDK
Upgrade from Payouts Web SDK
Mobile SDKs
Demo environment

Upgrade from Payment Elements SDK

Refer to this guide if your integration uses Airwallex Payment Elements SDK

Update JavaScript client library

npm/yarn/pnpm installation

Install the new package.

cdn installation

Update the URL in the <script> tag.

  • Before: <script src="https://checkout.airwallex.com/assets/elements.bundle.min.js"></script>
  • After: <script src="https://static.airwallex.com/components/sdk/v1/index.js"></script>

After installation, you will need to initialize the SDK by calling the init() method.

Update SDK functions

init()

New parameters

  • enabledElements: An array of Element groups representing the Elements. For example, to use Payments elements, set enabledElements to payments.

Deprecated parameters

  • origin

BEFORE

JavaScript

AFTER

JavaScript

createElement()

No changes to the function other than the import source.

BEFORE

JavaScript

AFTER

JavaScript

redirectToCheckout()

Replace redirectToCheckout() with payments.redirectToCheckout().

BEFORE

JavaScript

AFTER

JavaScript

getPaymentIntent()

This function has been deprecated.

getDeviceFingerprint()

This function has been deprecated.

getGatewayUrl()

This function has been deprecated.

Element functions

For the following functions, replace the global object Airwallex with the instance object element where element is the object returned from createElement().

createPaymentConsent()

Replace Airwallex.createPaymentConsent() with element.createPaymentConsent().

BEFORE

JavaScript

AFTER

JavaScript

createPaymentMethod()

Replace Airwallex.createPaymentMethod() with element.createPaymentMethod().

BEFORE

JavaScript

AFTER

JavaScript

confirmPaymentIntent()

Replace Airwallex.confirmPaymentIntent() with element.confirm().

BEFORE

JavaScript

AFTER

JavaScript

confirmPaymentIntentWithSavedCard()

Replace Airwallex.confirmPaymentIntentWithSavedCard() with element.confirm.

BEFORE

JavaScript

AFTER

JavaScript

destroyElement()

Replace Airwallex.destroyElement() with element.destroy().

BEFORE

JavaScript

AFTER

JavaScript

Event listeners

Replace domElement.addEventListener('onEventName', ...) with element.on('eventName', ...) where element is the object returned from createElement().

BEFORE

JavaScript

AFTER

JavaScript
On this page
  • Update JavaScript client library
  • Update SDK functions