Skip to content

CONV-267: Implement credit pack purchase grant#236

Merged
menvil merged 1 commit into
developfrom
feature/CONV-267-implement-credit-pack-purchase-grant
Jun 2, 2026
Merged

CONV-267: Implement credit pack purchase grant#236
menvil merged 1 commit into
developfrom
feature/CONV-267-implement-credit-pack-purchase-grant

Conversation

@menvil

@menvil menvil commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implements CreditPackWebhookHandler::handleCheckoutSessionCompleted() — resolves user and pack from metadata, grants credits via CreditLedger
  • Creates CashierWebhookController extending Cashier's WebhookController with handleCheckoutSessionCompleted() method
  • Registers custom controller at /stripe/webhook and uses Cashier::ignoreRoutes() to override default
  • User plan is not changed; credits granted through CreditLedger only

Test plan

  • tests/Feature/Billing/CreditPackWebhookHandlerTest.php — balance increases by 500 after checkout event
  • composer test passes (479 tests)
  • composer lint passes

🤖 Generated with Claude Code


Summary by cubic

Implements one-time credit pack purchases via Stripe Checkout and grants credits on checkout completion without changing user plans. Fulfills CONV-267 by awarding credits through the ledger when a pack is purchased.

  • New Features

    • Custom Stripe webhook at /stripe/webhook via CashierWebhookController (with Cashier::ignoreRoutes()), handling checkout.session.completed and returning success.
    • Implemented CreditPackWebhookHandler to resolve user and pack from Stripe metadata, then grant credits via CreditLedger with detailed Stripe and pack metadata.
    • Config-driven credit packs (small/medium/large) with repository/DTO, plus checkout via BillingPaymentService and CashierCreditPackCheckoutGateway (POST /billing/credits/{pack}).
  • Migration

    • Set env vars: STRIPE_CREDIT_PACK_SMALL_PRICE_ID, STRIPE_CREDIT_PACK_MEDIUM_PRICE_ID, STRIPE_CREDIT_PACK_LARGE_PRICE_ID.
    • Point Stripe to POST webhooks to /stripe/webhook; Cashier::ignoreRoutes() overrides default laravel/cashier routes.

Written for commit 80e5d3d. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • release

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6769a109-b4de-4ce4-8cf3-f72de76b5b76

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/CONV-267-implement-credit-pack-purchase-grant

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@menvil menvil force-pushed the feature/CONV-267-implement-credit-pack-purchase-grant branch from 718decb to 80e5d3d Compare June 2, 2026 18:32
@menvil menvil merged commit b584cd4 into develop Jun 2, 2026
@menvil menvil deleted the feature/CONV-267-implement-credit-pack-purchase-grant branch June 2, 2026 18:32
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.

1 participant