Create a Component
Learn more about creating promotional messaging components to show customers how they can use Affirm to finance their purchases.
The affirm.ui.components.create import creates an Affirm component in the background to be rendered on-demand on your website, drastically reducing the impact of loading time.
This component feature was designed to reduce latency and offer more flexibility to merchants.
const promoComponent = affirm.ui.components.create(‘promo’, options)Method Arguments
Attribute | Type | Description |
|---|---|---|
componentType required | string | Only |
options | object | See Options object. |
Options Properties
Attribute | Type | Description |
|---|---|---|
amount | integer | The loan amount passed to display price specific messaging. The amount must be in cents. |
pageType | string | The page type of the page the promo/messaging is on:
|
affirmLogoType | string | Sets the Affirm logo type. Default displays Affirm logo image:
|
affirmLogoColor | string | Set the color on the Affirm logo:
|
category | string | Identifies the product category associated with the messaging for analytics tracking (e.g., electronics, furniture). |
brand | string | Identifies the brand category associated with the messaging for analytics tracking (e.g., Samsung, Goodyear). |
sku | string | Identifies the SKU associated with the messaging for analytics tracking. |
promoId | string | Allows the merchant to select a specific promo id that they want to display. This will override the |
learnMoreShow | boolean | Whether to show or suppress the modal link:
|
Updated 9 days ago
USA
Canada