Paypal integration#773
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78e176afef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| event.event_type === "PAYMENT.CAPTURE.COMPLETED" && | ||
| event.resource.status === "COMPLETED" | ||
| ) { | ||
| return !!this.getMetadata(event).membershipId; | ||
| } |
There was a problem hiding this comment.
Resolve PayPal capture metadata via order fallback
This verification path only accepts PAYMENT.CAPTURE.COMPLETED when membershipId is present in resource.custom_id/resource.custom, but PayPal capture webhooks can arrive without those metadata fields and only include an order reference under resource.supplementary_data.related_ids.order_id. In that case verify() returns false, so the shared webhook route never marks the pending invoice as paid and one-time PayPal purchases remain unfulfilled. Add an order-id fallback (for example, fetch order details and recover metadata) before rejecting the event.
Useful? React with 👍 / 👎.
| 8. Set up the webhooks. Using webhooks, your school receives timely updates about payments from PayPal. | ||
| 9. In the PayPal Developer dashboard, create a webhook using your CourseLit school's webhook endpoint (listed in the same payment screen in your school). | ||
| 10. Subscribe the webhook to the following events: | ||
| - `Checkout order completed`: For confirming one-time payments |
There was a problem hiding this comment.
Update webhook docs to the processed one-time event
The setup guide tells admins to subscribe to Checkout order completed for one-time PayPal confirmations, but the implementation only processes PAYMENT.CAPTURE.COMPLETED/PAYMENT.SALE.COMPLETED. If users follow this documentation exactly, one-time webhook deliveries can be ignored and invoices stay pending. The docs should list the exact event name handled by the code path.
Useful? React with 👍 / 👎.
The validateRecaptcha() function is async and returns a Promise<boolean>, but was called without await on both the checkout login form and the main login form. Since a Promise object is always truthy, !Promise is always false, which meant the reCAPTCHA check was effectively bypassed. This fix adds the missing await keyword so reCAPTCHA validation actually runs when reCAPTCHA env vars are configured.
Fixes #772