fix(revenuecat): align tools and block with REST v1 API spec#4488
fix(revenuecat): align tools and block with REST v1 API spec#4488waleedlatif1 merged 11 commits intostagingfrom
Conversation
- Validated all 10 tools and the block against context7 REST v1 docs
- Unwrap {value:{subscriber}} envelope across post-receipts, attributes,
entitlements, and Google subscription endpoints
- Trim entitlement output to documented fields (expires_date,
grace_period_expires_date, product_identifier, purchase_date)
- Add subscriber output fields: last_seen, original_application_version,
other_purchases, subscriber_attributes
- create_purchase: productId optional (Google-only required); add
introductoryPrice, attributes, updated_at_ms; surface customer + subscriber;
X-Platform required; presentedOfferingIdentifier and paymentMode
- update_subscriber_attributes: read response and surface subscriber;
note required updated_at_ms
- defer_google_subscription: enforce XOR(extendByDays, expiryTimeMs) and
1-365 range; expiryTimeMs as one-of alternative
- grant_entitlement: duration optional, added endTimeMs (one-of)
- refund_google_subscription: corrected endpoint to
/transactions/{storeTransactionId}/refund
- delete_customer: read 'deleted' field (was 'was_deleted')
- list_offerings: corrected X-Platform values
- get_customer: count active subscriptions by expiry/refund
- Added shared throwIfRevenueCatError helper for {code, message} envelope
- Moved type coercions from tools.config.tool to tools.config.params to
preserve dynamic refs
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Normalizes API handling across tools by trimming/reshaping Updates several behaviors/endpoints: Reviewed by Cursor Bugbot for commit 8660b21. Configure here. |
Greptile SummaryThis PR aligns all 10 RevenueCat tools and the block against the REST v1 API spec, fixing endpoint URLs, response envelope unwrapping, param contracts, and error handling across the integration.
Confidence Score: 5/5Safe to merge — all changed code paths are consistent, shared helpers handle both response envelope shapes correctly, and previously flagged issues have been resolved. The changes are narrowly scoped to the RevenueCat integration. Response parsing, error surfacing, XOR guards, and URL corrections all behave correctly. The throwIfRevenueCatError helper uses response.clone() so the original body remains available for subsequent .json() calls. Active-subscription counting in get_customer now correctly filters by date rather than counting all keys. No files require special attention. Important Files Changed
Reviews (8): Last reviewed commit: "improvement(revenuecat): include updated..." | Re-trigger Greptile |
- create_purchase: wrap JSON.parse(attributes) with try/catch and clear error - update_subscriber_attributes: drop subscriber output (endpoint returns empty body) and guard JSON.parse on attributes - grant_entitlement: throw when both duration and endTimeMs are provided, matching defer_google_subscription behavior
|
@greptile |
|
@cursor review |
- delete_customer: drop dead was_deleted fallback (docs specify 'deleted') - grant_entitlement: mark duration + startTimeMs as deprecated, clarify startTimeMs only affects expiration calc (not grant time) - list_offerings: replace vague platform description with documented X-Platform enum (ios, android, amazon, stripe, roku, paddle)
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a5403cd. Configure here.
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a5403cd. Configure here.
The duration dropdown defaults to 'monthly' so any user filling in the advanced endTimeMs field would otherwise hit the XOR guard. Clear duration in the params mapper so endTimeMs takes precedence.
|
@greptile |
|
@cursor review |
…ided Mirror the duration/endTimeMs fix from 8204e89: when expiryTimeMs is populated, clear extendByDays in the params mapper so the empty-string form value does not trip the XOR guard. Also harden the tool-level XOR checks in defer_google_subscription and grant_entitlement to treat empty strings as undefined for direct (non-block) callers.
|
@greptile |
|
@cursor review |
- Block params mapper: only clear duration/extendByDays when the parsed endTimeMs/expiryTimeMs is finite, so invalid input does not silently discard the user's valid companion default - defer_google_subscription: validate extendByDays as integer (was Number.isFinite), matching the error message
|
@greptile |
|
@cursor review |
A malformed request_date would parse to NaN, making every entitlement and subscription compare false and silently zero active counts. Fall back to Date.now() when the parsed value is not finite.
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e6495c1. Configure here.
…der and wand prompt
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8660b21. Configure here.
Summary
{value:{subscriber}}envelope across post-receipts, attributes, entitlements, and Google sub endpointslast_seen,original_application_version,other_purchases,subscriber_attributes)create_purchase:productIdoptional (Google-only required); addintroductoryPrice,attributes,updated_at_ms; surfacecustomer+subscriber; X-Platform requiredupdate_subscriber_attributes: read response and surfacesubscriberdefer_google_subscription: enforce XOR(extendByDays,expiryTimeMs) and 1-365 rangegrant_entitlement:durationoptional, addedendTimeMs(one-of)refund_google_subscription: corrected to/transactions/{storeTransactionId}/refunddelete_customer: readdeletedfield;list_offerings: corrected X-Platform valuesthrowIfRevenueCatErrorhelper for{code, message}envelopetools.config.tool→tools.config.paramsto preserve dynamic refsType of Change
Testing
Tested manually; type-check and lint clean
Checklist