Skip to content

Conversation

tonidero
Copy link
Contributor

@tonidero tonidero commented Aug 1, 2025

Motivation / Description

In this PR we add a new API to allow to post a purchase for a product in the simulated store. This will be used by the React native SDK when running in expo go mode, where it will need to post the receipt but needs to handle the UI differently than how it's handled on browser platforms.

Usage of this API requires to explicitely // @ts-ignore when calling this method.

This API is not meant to be used by others, only meant for Internal RevenueCat usage.

Changes introduced

Linear ticket (if any)

Additional comments

@tonidero tonidero requested a review from Copilot August 1, 2025 12:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new internal API to the Purchases SDK that allows posting test store receipts directly without the UI modal flow. The API is specifically designed for React Native SDK usage in Expo Go mode where different UI handling is required.

  • Extracts receipt posting logic into a reusable helper function
  • Adds internal API method postTestStoreReceipt to the Purchases class
  • Updates existing test store purchase functionality to use the extracted helper

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main.ts Adds INTERNAL_RC_API symbol and postTestStoreReceipt method to Purchases class
src/helpers/test-store-post-receipt-helper.ts New helper function that extracts receipt posting logic from purchase flow
src/helpers/test-store-purchase-helper.ts Refactored to use the new helper function instead of inline receipt posting
src/tests/helpers/test-store-purchase-helper.test.ts Updated tests to mock the new helper function
src/tests/helpers/test-store-post-receipt-helper.test.ts Comprehensive test suite for the new helper function
Comments suppressed due to low confidence (1)

src/tests/helpers/test-store-post-receipt-helper.test.ts:135

  • This test doesn't actually verify uniqueness since the UUID mock returns the same value. The test should either use different UUID values or verify the timestamp component changes between calls to properly test uniqueness.
  test("generates unique transaction IDs", async () => {

@tonidero tonidero marked this pull request as ready for review August 1, 2025 13:03
@tonidero tonidero requested review from a team August 1, 2025 13:04
Copy link
Member

@ajpallares ajpallares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me! Leaving approval to someone with deeper knowledge of JS

Base automatically changed from support-test-store to main August 6, 2025 10:29
@tonidero tonidero changed the title Add internal API to postTestStoreReceipt Add internal API to postSimulatedStoreReceipt Aug 7, 2025
@tonidero tonidero requested review from nicfix and ajpallares August 7, 2025 14:30
Copy link
Member

@ajpallares ajpallares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw the changes, now using @internal instead of the INTERNAL_RC_API symbol. I think it looks good! Again, will leave approval to someone with more knowledge 🙏

@tonidero tonidero enabled auto-merge (squash) August 12, 2025 07:48
@tonidero tonidero merged commit 7ddeddc into main Aug 12, 2025
2 of 5 checks passed
@tonidero tonidero deleted the expose-api-post-test-store-receipt branch August 12, 2025 07:51
fire-at-will pushed a commit that referenced this pull request Aug 26, 2025
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* Add Virtual Currency Functionality (#573) via Will Taylor
(@fire-at-will)
* [WEB-2865] Feedback loops for checkout and WPL (#575) via James
O'Donnell (@james-od)

### 🔄 Other Changes
* [WEB-2778] Add tax breakdown support to checkout tax responses and
examples (#570) via Antonio Borrero Granell (@antoniobg)
* Add internal API to postSimulatedStoreReceipt (#561) via Toni Rico
(@tonidero)
* Add getVirtualCurrencies backend network request (#569) via Will
Taylor (@fire-at-will)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants