Skip to content

fix(api/paywall): return paymentId with pending entitlement#738

Merged
sidvishnoi merged 2 commits into
mainfrom
paywall-api-pending-payment-id
May 27, 2026
Merged

fix(api/paywall): return paymentId with pending entitlement#738
sidvishnoi merged 2 commits into
mainfrom
paywall-api-pending-payment-id

Conversation

@sidvishnoi
Copy link
Copy Markdown
Member

@sidvishnoi sidvishnoi commented May 27, 2026

If payment status is pending when we're checking entitlement, we want to be able to call /paywall/paywall-status API to poll the payment status until it reaches 'complete' or 'failed'. We require the paymentId available in that case.

Part of #727 (unhappy path)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

Deployment results

Worker Alias URL Outcome
API - 026f69f5 success
CDN - 9ebce508 success
App - b81bb6a9 success

Logs #26504923531

@sidvishnoi sidvishnoi changed the title fix(api/paywall): return paymentId along with entitlement fix(api/paywall): return paymentId with pending entitlement May 27, 2026
@DarianM DarianM requested a review from Copilot May 27, 2026 16:25
Copy link
Copy Markdown

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

Updates the paywall entitlement flow so that when a matching payment exists but is still pending, the API response can include the paymentId needed by clients to poll /paywall/paywall-status until completion/failure.

Changes:

  • Rename hasPaymentfindPayment and return { status, paymentId } instead of only status.
  • Extend /paywall/entitlement response to include paymentId when entitlement is pending.
  • Update payments DB unit tests to validate the new findPayment return shape.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
api/src/utils/payments-db.ts Renames lookup helper and returns paymentId alongside mapped status.
api/src/utils/payments-db.test.ts Adjusts assertions to the new findPayment return shape.
api/src/routes/paywall/entitlement.ts Includes paymentId in response only for pending entitlement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/src/routes/paywall/entitlement.ts
Comment thread api/src/routes/paywall/entitlement.ts
@sidvishnoi sidvishnoi merged commit e8becbd into main May 27, 2026
9 checks passed
@sidvishnoi sidvishnoi deleted the paywall-api-pending-payment-id branch May 27, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants