You can configure and display Pay Later messages using JavaScript as an alternative to HTML attributes. The JavaScript SDK messages
component uses an API that is similar to the API used by the buttons
component.
The following code sample shows how to create a message object by calling the paypal.Messages
function. The paypal.Messages
function takes a configuration object as its only argument and returns a message object.
The message object has a render()
function that accepts an argument that defines the element in which messages are rendered. In this example, .pp-message
is a CSS selector string, but you can also use an HTMLElement
reference, or an array of HTMLElement
references.