Install the package via composer:
composer require think.studio/laravel-cashier-tools
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
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(),
]);
DashboardRouter::fromConfig()->productsUrl()
DashboardRouter::fromConfig()->productsUrl($stripeProduct->id)
(new DashboardRouter(true))->promotionCodesUrl($promotionCode->id)