feat(resize): authorize resize via in-window PayPal SDK revise#29
Merged
Conversation
The resize popup opened PayPal's hosted approval page and relied on a
return_url redirect, which 404s on the shard nginx and never closed the
popup. Switch subscribed resizes to the same in-window JS SDK flow as
subscribe: render a PayPal button whose createSubscription calls
actions.subscription.revise(); onApprove polls until the webhook commits
the change; onCancel/onError release the pending slot via /resize/cancel.
Unsubscribed shards keep the immediate resize path. The hasPendingResize
watcher clears the busy state once the webhook flips pending off.
Depends on controller endpoints returning {subscription_id, plan_id,
expected_price_cents} from /resize and the new /resize/cancel.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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 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.
Problem
The subscribed-resize popup opened PayPal's hosted approval page (
window.open(approval_url)) and depended on areturn_urlredirect. That URL 404s on the shard nginx, so after approving, the popup landed on an error page and never closed.Fix
Subscribed resizes now use the same in-window JS SDK approach as subscribe — no popup, no redirect, no
return_url:renderResizeButton).createSubscription→POST /self/resize(claims the pending slot, returnssubscription_id,plan_id,expected_price_cents) →actions.subscription.revise(subscription_id, { plan_id, quantity }).onApprove→ poll until theBILLING.SUBSCRIPTION.UPDATEDwebhook commits the change; thehasPendingResizewatcher then clears the busy state.onCancel/onError→POST /self/resize/cancelto release the slot.Unsubscribed shards keep the immediate resize path.
Depends on
Controller PR:
/self/resizereturning the revise params + new/self/resize/cancel(FreeshardBase/freeshard-controller — feature/resize-via-sdk-revise), plus the price-promote/pending-clear on the UPDATED webhook (#292).Verification
ESLint clean; production build succeeds.
actions.subscription.revise(subscriptionID, { plan_id, quantity })call (PayPal's published docs don't show the JS snippet for quantity revisions). The call site is commented; adjust if the SDK expects a different shape.🤖 Generated with Claude Code