Skip to content

Express Checkout PR 2: UUID Generation + Checkout Object + UI#93

Open
daniellzl wants to merge 6 commits into
dl260302/express-checkout-pr1-infrastructurefrom
dl260302/express-checkout-pr2-checkout-object
Open

Express Checkout PR 2: UUID Generation + Checkout Object + UI#93
daniellzl wants to merge 6 commits into
dl260302/express-checkout-pr1-infrastructurefrom
dl260302/express-checkout-pr2-checkout-object

Conversation

@daniellzl
Copy link
Copy Markdown
Collaborator

@daniellzl daniellzl commented Mar 18, 2026

Tech Spec

Summary

Frontend

  • Updated Affirm hosted JS libraries (live.js, sandbox.js)
  • Reusable expressCheckoutButton.isml template (cart + PDP)
  • Template integrations (cart.isml, productDetails.isml, scripts.isml)
  • Client-side JS (expressCheckout.js) for AJAX checkout initiation and Affirm modal

Backend

  • ExpressCheckout controller route: generates UUID, writes AffirmExpressCart Custom Object, builds checkout object
  • affirmBasket.js: getSubtotal() and getExpressCheckout() methods
  • Refactored Logger to module-level in Affirm.js controller

PR Stack (2 of 4)

  1. PR 1: Infrastructure & Configuration
  2. PR 2 (this): UUID Generation + Checkout Object + UI
  3. PR 3: Shipping & Totals Endpoint
  4. PR 4: Order Confirmation & Placement

Implements Steps 1+2 of the Affirm Express Checkout Integration Guide.

Test plan

  • Verify Express Checkout button appears on cart and PDP pages when enabled
  • Verify button does not appear when AffirmExpressCheckoutEnabled is false
  • Verify clicking button triggers AJAX call and opens Affirm modal
  • Verify AffirmExpressCart Custom Object is created with correct data

…client JS

Implements Steps 1+2 of the Affirm Express Checkout Integration Guide:
- ExpressCheckout controller route (generates UUID, writes AffirmExpressCart
  Custom Object, builds checkout object)
- affirmBasket.js: getSubtotal() and getExpressCheckout() methods
- Client-side JS for AJAX checkout initiation and Affirm modal
- Reusable expressCheckoutButton.isml template (cart + PDP)
- Template integrations (cart.isml, productDetails.isml, scripts.isml)
- Updated Affirm hosted JS libraries (live.js, sandbox.js)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
}
}
var affirmData = require('*/cartridge/scripts/data/affirmData');
if (affirmData.getExpressCheckoutEnabled() && affirmData.getAffirmOnlineStatus() && affirmData.getAffirmVCNStatus() != 'on') {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't import express checkout script if merchant is VCN.

@@ -0,0 +1,18 @@
<isset name="affirmData" value="${require('*/cartridge/scripts/data/affirmData')}" scope="page" />

<isif condition="${affirmData.getExpressCheckoutEnabled() && affirmData.getAffirmOnlineStatus() && affirmData.getAffirmVCNStatus() != 'on'}">
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't render express checkout button if merchant is VCN.

return next();
}

if (affirm.data.getAffirmVCNStatus() == 'on') {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional guard to prevent VCN merchants from checking out with express

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave a TODO on the VCN gating to revisit once we're ready to support VCN merchants?

Transaction.wrap(function () {
var affirmExpressCart = CustomObjectMgr.createCustomObject('AffirmExpressCart', orderId);
affirmExpressCart.custom.basketUUID = basket.getUUID();
affirmExpressCart.custom.customerNo = basket.getCustomer() && basket.getCustomer().isRegistered()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is customerNo used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants