[pull] dev from stack-auth:dev#201
Merged
pull[bot] merged 3 commits intoerickirt:devfrom Oct 27, 2025
Merged
Conversation
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- RECURSEML_SUMMARY:START --> ## High-level PR Summary This PR adds support for custom `metadata` to inline products in the payments system. The change allows developers to attach arbitrary metadata to products created inline (without pre-configuration), which Stack Auth will store and return with the product. This enables applications to associate custom data such as feature flags, reference IDs, or other application-specific attributes with products. The implementation adds a new `productSchemaWithMetadata` schema, updates the product type handling in the backend, and includes comprehensive e2e tests verifying metadata is persisted and returned correctly through purchase creation, validation, and listing endpoints. ⏱️ Estimated Review Time: 15-30 minutes <details> <summary>💡 Review Order Suggestion</summary> | Order | File Path | |-------|-----------| | 1 | `packages/stack-shared/src/schema-fields.ts` | | 2 | `apps/backend/src/lib/payments.tsx` | | 3 | `apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts` | | 4 | `apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts` | | 5 | `apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts` | </details> [](https://discord.gg/n3SsVDAW6U) [](https://squash-322339097191.europe-west3.run.app/interactive/2549bec1b95e3e2cba3dd33a3d895a701da579e40ee40ce66e129b598d8a5c75/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=963) <!-- RECURSEML_SUMMARY:END --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Products now support custom metadata (client, client read-only, and server) and expose these fields in inline product representations. * Metadata is preserved and propagated through purchase creation, validation, grants, and owned-product listings so it’s available after purchase. * **Tests** * Added end-to-end tests verifying metadata is accepted, persisted, and returned in purchase creation, validation, grant, and listing flows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Adds support for custom metadata in inline products, updating schemas and functions to handle metadata, with comprehensive tests verifying the changes. > > - **Behavior**: > - Adds support for custom metadata in inline products, allowing arbitrary metadata attachment. > - Updates `ensureProductIdOrInlineProduct()` and `productToInlineProduct()` in `payments.tsx` to handle metadata. > - Metadata is preserved and returned in purchase creation, validation, and listing endpoints. > - **Schemas**: > - Adds `productSchemaWithMetadata` in `schema-fields.ts` to include `clientMetadata`, `clientReadOnlyMetadata`, and `serverMetadata`. > - Updates `inlineProductSchema` to support metadata fields. > - **Tests**: > - Adds e2e tests in `purchase-session.test.ts`, `create-purchase-url.test.ts`, and `products.test.ts` to verify metadata handling. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for 1b5601c. You can [customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> --------- Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved email rendering reliability by detecting and handling cases where template executions produce no result, preventing silent failures. * Enhanced error reporting for both single and batched email generation so failures are captured and surfaced more consistently for faster diagnosis. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Sign-up accepts an optional verification callback URL and a new opt-out flag to disable email verification; when opted-out or absent, URL checks and verification emails are skipped. * Client APIs and runtime validation updated to forbid providing a callback URL when opting out. Sign-up now retries without a callback if a redirect URL is not whitelisted. * **Tests** * End-to-end tests added for sign-up without verification and for conflicting verification settings. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Konsti Wohlwend <N2D4@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )