Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
    Overview
    Payment method integration options
    Manage default payment methods in the Dashboard
    Payment method types
    Cards
    Pay with Stripe balance
    Bank debits
    Bank redirects
    Bank transfers
    Credit transfers (Sources)
    Buy now, pay later
      Affirm
        Accept a payment
        Site messaging
      Afterpay / Clearpay
      Alma
      Billie
      Capchase Pay
      Klarna
      Kriya
      Mondu
      Payment on Invoice
      Scalapay
      SeQura
      Sunbit
      Zip
    Real-time payments
    Vouchers
    Wallets
    Enable local payment methods by country
    Custom payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Other Stripe products
Financial Connections
Crypto
Climate
HomePaymentsAdd payment methodsBuy now, pay laterAffirm

Display Affirm messagingDeprecated

Increase conversion by informing customers that you offer Affirm ahead of checkout.

Caution

The content in this topic refers to a Legacy feature. We recommend that you use the Payment Method Messaging Element to dynamically show your customers relevant buy now, pay later payment options for a given purchase. Stripe continues to maintain continuity for the affirmMessage Element, but has halted new feature development.

Let your customers know you accept payments with Affirm by including the Affirm messaging Element on your site. We suggest adding the messaging Element to your product, cart, and payment pages. The Affirm messaging Element takes care of:

  • Calculating and displaying the installments amount
  • Displaying the Affirm information modal
The Making of Prince of Persia: Journals 1985-1993
Jordan Mechner
$50

Include the Element

Caution

Affirm’s minimum transaction amount is 50 USD or 50 CAD. The promotional message isn’t rendered if the amount parameter is set to a number less than 50 USD or 50 CAD.

Use Stripe Elements to include the affirmMessage Element on your site.

If you haven’t already, include the Stripe.js script on your page by adding it to the head of your HTML file:

<script src="https://js.stripe.com/v3/"></script>

Create a placeholder element on your page where you want to mount the messaging Element:

<div id="affirm-message"></div>

On your product, cart, and payment pages, include the following code to create an instance of Stripe.js and mount the messaging Element:

// Set your publishable key. Remember to change this to your live publishable key in production! // See your keys here: https://dashboard.stripe.com/apikeys const stripe = Stripe(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
); const elements = stripe.elements(); const options = { amount: 5000, // $50.00 USD currency: 'USD' }; const affirmMessageElement = elements.create('affirmMessage', options); affirmMessageElement.mount('#affirm-message');

Customize the message

There are many options available to customize the appearance and contents of the messaging Element. See the API reference for the full list of options.

Logo color

Use the logoColor option to choose between the following styles:

primary
black
white

Style with CSS

Additional configuration options allow you to use CSS to style the messaging to better fit the look and feel of your site. You can customize the fontColor, fontSize, and textAlign of the messaging:

Code Example
const options = { amount: 5000, currency: 'USD', fontColor: '#5B63FF', logoColor: 'black', fontSize: '16px', textAlign: 'center', }; const affirmMessageElement = elements.create('affirmMessage', options);
Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc