Add presented_workflow_id and presented_step_id to /receipts#3603
Open
vegaro wants to merge 5 commits into
Open
Add presented_workflow_id and presented_step_id to /receipts#3603vegaro wants to merge 5 commits into
presented_workflow_id and presented_step_id to /receipts#3603vegaro wants to merge 5 commits into
Conversation
presented_workflow_id and presented_step_id to /receipts
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3603 +/- ##
=======================================
Coverage 80.46% 80.47%
=======================================
Files 382 383 +1
Lines 15594 15619 +25
Branches 2166 2175 +9
=======================================
+ Hits 12548 12569 +21
Misses 2172 2172
- Partials 874 878 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The paywall-events workflow attribution (workflowId on PaywallEvent.Data and the events payload) is already on main. This adds the post-receipt path so native-store workflow purchases attribute to the exact screen, matching how web funnels already attribute via presented_step_id on the RC Billing checkout path. - PaywallPostReceiptData carries workflowId and stepId as @transient fields so they are sent only as top-level presented_workflow_id / presented_step_id and do not leak into the nested paywall object (paywall_id stays in `paywall`). - PaywallEvent.Data gains stepId with full serializer support; the step id is sourced from the current workflow step in PaywallViewModel. presented_step_id is a no-op until khepri's /receipts endpoint accepts it (WFL-336). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1919b00 to
f52062a
Compare
workflowId and stepId were @transient on PaywallPostReceiptData, so they were lost when the transaction was cached to disk. On retry or sync from cached metadata, presented_workflow_id and presented_step_id would be sent as null. Introduces WorkflowMetadata (workflowId, stepId) as a first-class field on LocalTransactionMetadata so the values survive disk round-trips. PaywallPostReceiptData is now purely about the paywall; Backend reads presented_workflow_id and presented_step_id from WorkflowMetadata instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b2bfd86. Configure here.
f149079 to
9e22cc1
Compare
9e22cc1 to
264d2e9
Compare
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.

Motivation
The backend needs workflow and paywall identifiers on paywall events and post-receipt requests to properly attribute purchases and impressions to specific paywalls and workflow steps. This PR adds it to the post receipt
Source https://revenuecat.slack.com/archives/C0AGDQGUZ97/p1781206585550989
Example posted data:
Note
Medium Risk
Touches the purchase receipt pipeline and attribution caching; incorrect workflow/step metadata could misattribute revenue, but changes are additive optional fields with tests covering payload shape and workflow re-presentation.
Overview
Post-receipt requests now include
presented_workflow_idandpresented_step_idat the top level of the/receiptsbody so purchases can be attributed to workflow steps. Workflow context is carried separately from the nestedpaywallobject (paywall IDs stay there; workflow fields are not duplicated insidepaywall).A new
WorkflowMetadatatype is cached inLocalTransactionMetadataand resolved from the purchase-initiated paywall event when posting receipts (including unsynced retries).PaywallEvent.Datagains optionalstepIdalongside existingworkflowId, with serialization support for stored events.RevenueCat UI records the current workflow step on paywall events and refreshes workflow/step on repeated impressions when the visual fingerprint is unchanged, so a purchase after advancing to another workflow step still posts the correct step metadata.
Reviewed by Cursor Bugbot for commit 264d2e9. Bugbot is set up for automated code reviews on this repo. Configure here.