Skip to content

fix: verify Stripe payment before crediting and harden autopay idempotency - #941

Open
valvesss wants to merge 1 commit into
attendee-labs:mainfrom
cold-code-labs:fix/security-billing
Open

fix: verify Stripe payment before crediting and harden autopay idempotency#941
valvesss wants to merge 1 commit into
attendee-labs:mainfrom
cold-code-labs:fix/security-billing

Conversation

@valvesss

@valvesss valvesss commented Aug 7, 2026

Copy link
Copy Markdown

Summary

  • CheckoutSuccessView credits only when Stripe payment_status is paid or no_payment_required; otherwise 400.
  • CreateCheckoutSessionView / CheckoutSuccessView use AdminRequiredMixin + get_project_for_user.
  • Autopay stable Stripe idempotency key autopay-{org}-{amount}-{UTC day} + 10-minute enqueue cooldown under select_for_update.

Test plan

Local (Mimir): Postgres 15.3 + Redis 7.

  • test_autopay_charge_task + test_stripe_billing + test_usage_credits40/40 OK (Stripe mocked)

Still for CI/maintainer (optional live Stripe): test-mode checkout credit; double autopay enqueue → single PaymentIntent.


Contribution from Cold Code Labs · authored via Brokk · co-authors in commit trailers.

…tency

Prevent unpaid checkout success callbacks from adding credits, restrict
checkout views to admins with project access, and use a stable Stripe
idempotency key plus enqueue cooldown to avoid duplicate autopay charges.

Co-authored-by: Vitor Alves <vitoralvesinfo@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@valvesss
valvesss requested a review from a team as a code owner August 7, 2026 15:16
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