fix(polar): Implement updates to Polar API #80
Merged
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.
Description
Birk from Polar here 👋🏼 We're in the process of updating our API to reach a stable and fully documented v1.0. Unfortunately, we've had to introduce some breaking changes in that process. Causing
sponsorkit
to no longer work with Polar in the current version. Caused by:sponsorkit
using our deprecated/subscriptions/subscriptions/search
endpoint vs./subscriptions
This PR fixes the above and makes
sponsorkit
work with Polar again. However, I also took the opportunity to ensure the implementation is more accurate & uses our 1.0 endpoints to be more future proof. Below are the changes in full:https://api.polar.sh/v1/(.*)
from legacyhttps://api.polar.sh/api/v1/(.*)
SPONSORKIT_POLAR_ORGANIZATION
in.env
if using Polar (see more context below)/organizations
to respect the samesponsorkit
implementation API, but going against our updated API endpoints vs. passing an organization name to subscriptions directly (no longer supported)Breaking change to sponsorkit
SPONSORKIT_POLAR_ORGANIZATION
is now required and will throw in error if not present, but Polar is used. The former implementation stated we default to the users organization if not present. That was not the case nor is it supported now. We require an organization to be fetched and an explicit organization ID to be used in filtering/subscriptions
So we need to require it here. However, I don't suspect any active
sponsorkit
user would be impacted since using it with Polar now is broken & specifically an emptySPONSORKIT_POLAR_ORGANIZATION
would not have defaulted to the users personal one - it needs to be explicit.Linked Issues
Additional context