How can I use Shop Pay messaging ("Pay in 4 interest free installments...") in a headless app?

I am migrating a Liquid site to a new headless storefront. The site currently includes the Shop Pay “Pay in X interest free installments of $X with Shop Pay [Learn more]” messaging:

I don’t see any documentation about implementing this in a headless storefront. Is this possible?

You’re saying you want to show this message on the new storefront, correct?

Yes, I’d like it to function & appear the same as it does on the Liquid theme.

You could simply recreate the same feature and styles with HTML and CSS and have it appear on your product page or wherever you want to show it.

What is unclear is how to determine what the messaging should be for a particular variant. Affirm has documentation on how to do this:
https://docs.affirm.com/platforms/docs/customize-affirm-promotional-messaging

I’d like to do the same thing with Shop Pay.

Did some research, and couldn’t find anything.

However, something you could do as a “hack”, is that you could create this feature using Javascript, and have the “four payments” just be whatever the cost of the product is divided by 4, then show that value on the HTML. That would mean either pulling the product’s value from a backend, a local storage value, or an “ID”.

Could something like this work?