Express Checkout PR 3: Shipping & Totals Endpoint#94
Open
daniellzl wants to merge 4 commits intodl260302/express-checkout-pr2-checkout-objectfrom
Open
Express Checkout PR 3: Shipping & Totals Endpoint#94daniellzl wants to merge 4 commits intodl260302/express-checkout-pr2-checkout-objectfrom
daniellzl wants to merge 4 commits intodl260302/express-checkout-pr2-checkout-objectfrom
Conversation
Implements Step 3 of the Affirm Express Checkout Integration Guide: - ShippingTotals POST route: server-to-server endpoint called by Affirm backend to get shipping options and order totals - HMAC-SHA512 signature verification (affirmUtils.verifyHMAC) - Extensibility hooks: validateAddress, calculateTotals, filterShippingMethods Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
virginiac32
reviewed
Mar 19, 2026
| var tempBasket = BasketMgr.getCurrentOrNewBasket(); | ||
|
|
||
| // Populate basket with products from the cart snapshot | ||
| Transaction.wrap(function () { |
There was a problem hiding this comment.
Do we want 1 transaction block between this line and the Transaction.begin() on line 490?
daniellzl
commented
Mar 19, 2026
| // Note: getApplicableShippingMethods() requires a plain JS object, not an SFCC OrderAddress | ||
| var tempShipment = tempBasket.getDefaultShipment(); | ||
| var applicableShippingMethods = ShippingMgr.getShipmentShippingModel(tempShipment) | ||
| .getApplicableShippingMethods(addressObj); |
Collaborator
Author
There was a problem hiding this comment.
Why is addressObj being passed in here? Shouldn't tempShipment have the saved cart address?
This was referenced Mar 20, 2026
…60302/express-checkout-pr3-shipping-totals
…60302/express-checkout-pr3-shipping-totals
daniellzl
commented
Mar 20, 2026
| } | ||
|
|
||
| // Validate currency | ||
| if (currency !== 'USD') { |
Collaborator
Author
There was a problem hiding this comment.
Express checkout only supports the United States and USD for initial launch.
daniellzl
commented
Mar 20, 2026
| // Validate address via hook or default validation | ||
| if (HookMgr.hasHook('app.affirm.express.validateAddress')) { | ||
| var cartData = JSON.parse(expressCart.custom.cartData); | ||
| var addressValidation = HookMgr.callHook('app.affirm.express.validateAddress', 'validateAddress', shippingAddress, cartData); |
Collaborator
Author
There was a problem hiding this comment.
Custom merchant-defined validation hook called here, otherwise default to simple validation on line 415.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tech Spec
Summary
PR Stack (3 of 4)
Implements Step 3 of the Affirm Express Checkout Integration Guide.
Known issues
Test plan