💂♂️ Authorization
Cashierstream lets you define a custom closure to check whether the billable is allowed to perform a request on the billing portal.
The first thing you need to make sure of is to have the RenokiCo\BillingPortal\Http\Middleware\Authorize
middleware in config/billing-portal.php
:
To customize the authorization response, you can define the closure resolver in your BillingPortalServiceProvider
file:
Redirecting instead of throwing error
Based on the true/false return value, it will either allow the request to pass through or throw a 403 error response. However, you can redirect your users instead of letting the package throw the error. The package middleware will check for a RedirectResponse
value and in case it is met, it will redirect the user instead of throwing the error:
Last updated