Skip to content

Require successful charge on manual early trial conversion - #14148

Merged
pieterbeulque merged 6 commits into
mainfrom
pieter/require-successful-charge-on-early-trial-conversion
Sep 22, 2026
Merged

pieterbeulque merged 6 commits into
mainfrom
pieter/require-successful-charge-on-early-trial-conversion

Conversation

@pieterbeulque

@pieterbeulque pieterbeulque commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Similar to how we attempt the charge before updating a subscription, attempt the charge before converting a trial early.

We do this only for explicit early conversions by setting trial_end to now, the automatic trial conversion still will flip trialing → active, then a failed payment will mark it as past due. TBD if we also want to change that, it may make sense to change from trialing → canceled instead of trialing → past due, but I think that's a different discussion. Since this focuses only on the manual trial-conversion path, the merchant has control, so we don't have to think about that.

Review in cubic

@mintlify

mintlify Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Polar 🟢 Ready View Preview Sep 22, 2026, 6:10 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@vercel

vercel Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
orbit Error Error Sep 22, 2026 6:24am UTC
polar-test Error Error Sep 22, 2026 6:24am UTC

Request Review

@pieterbeulque pieterbeulque changed the title Require successful charge on early trial conversion Require successful charge on manual early trial conversion Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

OpenAPI Changes

Operations

  • 🔀 PATCH /v1/subscriptions/{id} (modified)
    • 🔀 Response 402 modified
      • description: Payment required to apply the subscription update. → The charge failed, or requires customer authentication that can't be completed off-session.
      • content.application/json.schema: #/components/schemas/PaymentFailed → None
    • 🔀 Response 403 modified
      • description: Subscription is already canceled or will be at the end of the period, or is not active. → Subscription is already canceled or will be at the end of the period, is not active, or the organization is not ready to renew subscriptions.

Schemas

  • 🔀 SubscriptionUpdateBase (modified)
    • 🔀 Property trial_end modified
      • description: Set or extend the trial period of the subscription. If set to now, the trial will end immediately. → Set or extend the trial period of the subscription. If set to now, the trial will end immediately and the first billing cycle will be charged synchronously. The subscription remains trialing if the payment fails.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/polar/subscription/service.py
Comment thread server/tests/subscription/test_endpoints.py
Comment thread server/polar/subscription/service.py Outdated
billing_reason: OrderBillingReasonInternal,
*,
cutoff: datetime,
) -> Order:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we factorize with _create_subscription_update_order? One inline import is already too much for my delicate eyes 😛

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 5 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Manual trial early conversion now charges synchronously before activating, changing public API error responses and payment handling behavior. This is an operational and product decision that needs human review.

Re-trigger cubic

Comment thread docs/features/subscriptions/manage.mdx Outdated
Comment thread docs/features/subscriptions/trials.mdx Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/polar/subscription/service.py

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Manual early trial conversion now charges synchronously and keeps the subscription trialing if the charge fails, with new 402/403 API response types; the payment-handling and product-behavior tradeoffs need human sign-off.

Re-trigger cubic

@pieterbeulque
pieterbeulque added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit feec27e Sep 22, 2026
30 of 32 checks passed
@pieterbeulque
pieterbeulque deleted the pieter/require-successful-charge-on-early-trial-conversion branch September 22, 2026 06:32

This branch had an error being deployed

2 failed and 1 active (outdated) deployments
Preview – polar-test — 5eec5cc9 Deployed Sep 22, 2026 by vercel[bot]
Preview – orbit — 5eec5cc9 Deployed Sep 22, 2026 by vercel[bot]
staging - docs — 7b5753a7 Deployed Sep 22, 2026 by mintlify[bot]
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