Stripe Billing Portal
billing.stripe.com
The Klub plugin has a klub/portal
-route that allows you to forward your member to the billing portal hosted by Stripe.
In providing a redirect
-form parameter you can define to where in your frontend the "Close Billing Portal"-button will redirect the member.
site/snippets/stripe-billing-portal.php
<!-- form with POST to prevent browser URL preloading -->
<form action="<?= site()->url() ?>/klub/portal" method="POST">
<input type="hidden" name="token" value="<?= csrf() ?>">
<input type="hidden" name="redirect" value="<?= $page->url() ?>">
<button type="submit">Billing Portal</button>
</form>
Accessing the billing portal with this endpoint will always flush any caches the Klub plugin stores about Stripe.