Add version field to Checkout and Cart interfaces #2993
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.
Changes Made
version: number
field to theCheckout
interface in both core and payment-integration-api packagesversion: number
field to theCart
interface in both core and payment-integration-api packagesversion: 2
matching the API response formatAPI Response Structure
The Checkout API response includes a version field at both the checkout and cart levels:
These interface changes ensure the TypeScript definitions accurately reflect the actual API response structure, enabling proper type safety when working with checkout and cart objects that include version information.
Files Modified
packages/core/src/checkout/checkout.ts
packages/payment-integration-api/src/checkout/checkout.ts
packages/core/src/cart/cart.ts
packages/payment-integration-api/src/cart/cart.ts
packages/core/src/checkout/checkouts.mock.ts
packages/core/src/cart/carts.mock.ts
packages/payment-integration-api/src/mocks/carts.mock.ts
packages/payment-integrations-test-utils/src/test-utils/carts.mock.ts
packages/payment-integrations-test-utils/src/test-utils/checkouts.mock.ts
The changes are minimal and maintain backward compatibility while providing complete type coverage for the API response. All tests pass and the build completes successfully.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.