Skip to content

Add PayPal payment provider integration#816

Draft
rogersole wants to merge 1 commit intomainfrom
paypal-integration-analysis
Draft

Add PayPal payment provider integration#816
rogersole wants to merge 1 commit intomainfrom
paypal-integration-analysis

Conversation

@rogersole
Copy link
Copy Markdown
Contributor

Summary

  • Adds PayPal as a payment provider following the same architecture as the existing Paddle integration
  • New PayPalService (src/paypal/paypal-service.ts) handles SDK initialization via @paypal/paypal-js, checkout start, PayPal button rendering, and operation status polling
  • API key detection for ppl_ prefix keys, with routing in purchase() to performPayPalPurchase()
  • Svelte UI components (paypal-purchases-ui.svelte, paypal-purchases-ui-inner.svelte) for loading/buttons/success/error pages
  • PayPalCheckoutStartResponse type with paypal_billing_params (client_id, order_id, is_sandbox)
  • BackendInvalidPayPalAPIKey error code and InvalidPayPalAPIKeyError flow error code
  • 22 unit tests covering initialization, checkout start, purchase flow, cancellation, and polling

How it works

  1. User calls purchase() with a ppl_ API key → routes to performPayPalPurchase()
  2. PayPalService.startCheckout() calls backend's /checkout/start → gets order ID + client ID
  3. PayPal JS SDK is loaded and buttons are rendered in the UI
  4. User clicks PayPal button → completes payment in PayPal popup
  5. On approval, polls /checkout/{operationSessionId} for completion → returns result

Test plan

  • PayPal service unit tests pass (22 tests)
  • Existing Paddle service tests still pass (27 tests)
  • Existing main tests still pass (73 tests)
  • TypeScript compilation passes
  • Manual E2E testing with PayPal sandbox (requires backend support)
  • Verify PayPal button rendering in different browsers

Note: This is a draft PR. Backend PayPal support is required for full E2E testing.

🤖 Generated with Claude Code

Integrate PayPal as a payment provider following the same pattern as the
existing Paddle integration. This includes API key detection (ppl_ prefix),
PayPalService for SDK lifecycle/checkout/polling, Svelte UI components for
the button-based checkout flow, and service unit tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@RevenueCat-Danger-Bot
Copy link
Copy Markdown

2 Errors
🚫 Label the PR using one of the change type labels. If you are not sure which label to use, choose pr:other.
🚫 This PR increases the size of the repo by more than 250.00 KB (increased by 468.14 KB).
1 Message
📖 You can bypass the size check failure by adding the label "danger-bypass-size-limit". Please exercise caution.
Label Description
pr:feat A new feature. Use along with pr:breaking to force a major release.
pr:fix A bug fix. Use along with pr:force_minor to force a minor release.
pr:other Other changes. Catch-all for anything that doesn't fit the above categories. Releases that only contain this label will not be released. Use along with pr:force_patch, or pr:force_minor to force a patch or minor release.
pr:RevenueCatUI Use along any other tag to mark a PR that only contains RevenueCatUI changes
pr:next_release Preparing a new release
pr:dependencies Updating a dependency
pr:phc_dependencies Updating purchases-hybrid-common dependency
pr:changelog_ignore The PR will not be included in the changelog. This label doesn't determine the type of bump of the version and must be combined with pr:feat, pr:fix or pr:other.

Generated by 🚫 Danger

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.

2 participants