[B2BTEAM-3748] Accept optional priceToken on ItemInput (Pricing Fallback V2) - #219
Open
wender wants to merge 1 commit into
Open
[B2BTEAM-3748] Accept optional priceToken on ItemInput (Pricing Fallback V2)#219wender wants to merge 1 commit into
wender wants to merge 1 commit into
Conversation
Pricing Fallback V2: let storefronts send the signed price returned by the
search along with the item, so the checkout REST API can close the cart
with that price while the Pricing system is unavailable.
The field is optional and needs no resolver change: `addToCart` strips
only `options`, `index` and `uniqueId` before calling
`checkout.addItem`, and `updateItems` strips only `id`, so `priceToken`
already reaches `PATCH /orderForm/{id}/items` through the rest spread -
and `PATCH .../items` already supports it. When the storefront does not
send the field, the payload reaching checkout is byte-for-byte the same as
before.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
|
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
This was referenced Aug 6, 2026
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.
What problem is this solving?
Pricing Fallback V2 (B2BTEAM-3748, reference Slack thread): Intelligent Search now signs the price of each offer and returns it as
priceToken, so a storefront can forward that signed price on add to cart and the platform can keep closing carts even while the Pricing system is down.Everything upstream of this app is already in production:
intschprice signing (VTEX.Signersidecar)vtex.search-resolver@1.106.0/vtex.search-graphql@0.72.0priceTokenon theOffertypePATCH /api/checkout/pub/orderForm/{id}/itemspriceTokenper order item (confirmed by Guilherme Schirmer in the thread)vtex.checkout-graphql(ItemInput)This app is the blocker of the whole chain. Because
ItemInputhas nopriceToken, any storefront that forwards the token gets its variable rejected before the request reaches the resolver:That error was reproduced on
b2bstoreqawith price signing enabled and is currently blocking, in parallel:vtex.store-resources— the product query cannot even be prepared to expose the field usefully (store-resources PR)vtex.add-to-cart-button,vtex.minicart,vtex.store-components, per the activity list mapped by Wisney Cardeal in the threadWe are not the owners of this app, so this PR is offered as a starting point for the Checkout Experience team rather than something to merge as is — Thaynan Nunes scheduled a spike for the sprint starting 2026-08-03 precisely to size this change. If the direction is right, it is already validated end to end (see below).
What the change is:
graphql/types/Item.graphql: optionalpriceToken: Stringoninput ItemInput, with a docstring explaining the semantics.node/typings/global.d.ts: matching optionalpriceToken?: stringonOrderFormItemInput.No resolver change was needed, and that is deliberate:
addToCartbuilds its REST payload withitems.map(({ options, index, uniqueId, ...rest }) => ...), sopriceTokenalready flows throughrestintocheckout.addItem→PATCH /orderForm/{id}/items, which supports the field.updateItemsstrips onlyid, so it forwards the token as well.Checkout.addItemtypes items asOmit<OrderFormItemInput, 'uniqueId' | 'index' | 'options'>, so the new field is included automatically.Backwards compatibility. The field is optional and input-only: when a storefront does not send it, the payload reaching the checkout REST API is byte-for-byte identical to today, and no existing caller has to change. The builder classified the change by itself during
vtex link:i.e. an additive change, publishable as a minor. The token is also deliberately not exposed on the
Itemoutput type — it is signed data that only needs to travel inbound.How should this be manually tested?
Validated on b2bstoreqa / pricetoken with three linked apps: this one,
vtex.store-resources(product query requesting the field) andvtex.sku-list(forwarding it on add to cart). Requires an account with price signing enabled on Intelligent Search — it is still behind a feature flag, and the search team enables it on request.GET /api/intelligent-search/v1/product-search?an={account}→items[].sellers[].commertialOffer.PriceToken.items[0].priceToken.{"price":390,"priceWithoutDiscount":390,"seller":"1","id":"1","accountName":"b2bstoreqa","salesChannel":"1"}, valid for 30 minutes.priceTokenin the payload and confirm the behaviour is unchanged.Note that the fallback itself is only exercised during a Pricing outage, so nothing about the signed price is observable in the
addToCartresponse or in the orderForm. Christian Mutti's guidance in the thread is that the real end-to-end test is to intentionally open the circuit with the Pricing and watch carts still closing — that part is out of reach for us here.Checklist/Reminders
README.md— not applicable, no documented behaviour changes for existing callers.CHANGELOG.md.node/__tests__/items-mutations.test.tsif the team wants the pass-through pinned by a test; the current change is schema-only.pricetokenworkspace is ours and will be unlinked regardless of what happens to this PR.Type of changes
Notes
Two things worth deciding with the initiative owners rather than in this PR:
intsch, plus "instrument add-to-cart metrics with and without token" on the Store Framework list). If this app should emit anything on its side, that is a natural follow-up and we did not presume it here.