Skip to content

Set of utils what not added to main laravel cashier stripe package.

License

Notifications You must be signed in to change notification settings

dev-think-one/laravel-cashier-tools

Repository files navigation

Set of utils what not added to main laravel cashier stripe package

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

Installation

Install the package via composer:

composer require think.studio/laravel-cashier-tools

Usage

Create promotion codes command

php artisan cashier-tools:api:create:promotion-codes COUPON_ID_2021 -P "2021$" >> codes.txt
php artisan cashier-tools:api:create:promotion-codes COUPON_ID_2021 -S 20 -C 100 --p_max_redemptions=10 --stripe-secret=sk_live_4FL... >> codes.txt

Use helper for checkout redirect url

Builder to support redirect url params: (Like '{CHECKOUT_SESSION_ID}')

$url = route('cpd.account.index');

$subscription->allowPromotionCodes()
             ->checkout([
                 'success_url' => StripeCheckoutUrlBuilder::prepareSuccessUrl($url),
                 'cancel_url'  => StripeCheckoutUrlBuilder::prepareCancelUrl($url),
             ]);

$subscription->checkout([
    'success_url' => StripeCheckoutUrlBuilder::make($url)
                                             ->withSessionId()
                                             ->useResultStatus('foo')
                                             ->url(),
    'cancel_url'  => StripeCheckoutUrlBuilder::make($url)
                                             ->useResultStatus('bar')
                                             ->url(),
]);

Use dashboard router

DashboardRouter::fromConfig()->productsUrl()
DashboardRouter::fromConfig()->productsUrl($stripeProduct->id)
(new DashboardRouter(true))->promotionCodesUrl($promotionCode->id)

Credits

  • Think Studio

About

Set of utils what not added to main laravel cashier stripe package.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages