调至内容部分
创建账户
或
登录
Stripe 文档徽标
/
询问人工智能
创建账户
登录
开始
付款
销售收入
平台和交易市场
资金管理
Developer resources
概览
关于 Stripe 支付
升级您的集成
支付分析
线上付款
概览查找您的用例Managed Payments
使用 Payment Link
构建结账页面
构建高级集成
构建应用内集成
支付方式
添加支付方式
    概览
    支付方式集成选项
    在管理平台中管理默认支付方式
    支付方式类型
    银行卡
    使用 Stripe 余额支付
    加密货币
    银行借记
    银行重定向
    银行转账
    贷记转账(来源)
    先买后付
      Affirm
        收款
        网站消息
      Afterpay / Clearpay
      Alma
      Billie
      Capchase Pay
      Klarna
      Kriya
      Mondu
      账单付款
      Scalapay
      SeQura
      Sunbit
      Zip
    实时付款
    付款凭单
    钱包
    按国家启用本地支付方式
    自定义支付方式
管理支付方式
用 Link 更快结账
支付接口
Payment Links
结账
Web Elements
应用内 Element
支付场景
处理多种货币
自定义支付流程
灵活收单
编排
线下支付
Terminal
Beyond payments
Incorporate your company
加密货币
Financial Connections
Climate
首页付款Add payment methodsBuy now, pay laterAffirm

Display Affirm messaging已废弃

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

注意

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

注意

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/basil/stripe.js"></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);
此页面的内容有帮助吗?
是否
需要帮助?联系支持。
加入我们的早期使用计划。
查看我们的更改日志。
有问题?联系销售。
LLM? Read llms.txt.
Powered by Markdoc