Afterpay.js Glossary

Constants

<CONSTANT_NAME>Values
currencyAUD, CAD ,GBP, NZD, USD, EUR
localeEN_AU, EN_CA, EN_GB, EN_NZ, EN_US, IT_IT, FR_FR, ES_ES
logoTypeBADGE, LOCKUP
modalLinkStyleCIRCLED_INFO_ICON, LEARN_MORE_TEXT, MORE_INFO_TEXT, CIRCLED_QUESTION_ICON, NONE
placementTypesPRICE_TABLE
sizeXS, SM, MD, LG
mobileViewLayoutFOUR_BY_ONE, TWO_BY_TWO
theme.badgeBLACK_ON_MINT, BLACK_ON_WHITE, MINT_ON_BLACK, WHITE_ON_BLACK
theme.lockupBLACK, WHITE, MINT
theme.modalWHITE
theme.priceTableBLACK, WHITE

Using Afterpay Constants

Constants are exposed to the window via the Afterpay object Afterpay.<constant_name>.

See some examples below:

1console.log(Afterpay.locale.EN_US) // "en_US"
2console.log(Afterpay.theme.lockup) // "{"BLACK":"black","WHITE":"white","MINT":"mint"}"
3console.log(Afterpay.theme.lockup.BLACK) // "black"

Functions

NameDescription
createPlacementsAdds one or more placements to the page using the targetSelector attribute.
launchModalDynamically open the Clearpay Modal.
readyCustom Window Event dispatched when Afterpay.js is successfully initialized.
modalRenderCompleteCustom Window Event dispatched when the <afterpay-modal> finishes rendering.

Window Events

NameDescription
readyCustom Window Event dispatched when Afterpay.js is successfully initialized.
modalRenderCompleteCustom Window Event dispatched when the <afterpay-modal> finishes rendering