craftcms / stripe

Sync and extend Stripe products and subscriptions.
MIT License
5 stars 2 forks source link

Feature/guest checkout #9

Closed i-just closed 5 months ago

i-just commented 5 months ago

Description

This PR addresses a few bugs and slightly changes the behaviour of the src\services\Checkout->getCheckoutUrl() method to allow truly anonymous checkout.

Related issues

n/a

i-just commented 5 months ago

As per our discussions, I went back to accepting false and leaving the null behaviour as it was when generating checkout URLs.

This means that if you don’t pass anything as a $customer parameter, the default null value will be used, and the method will continue to attempt to get the currently logged-in user. However, if you pass false, the checkout URL will be anonymous (even if a user is currently logged in).

I also unified how the checkout is generated in all 3 cases: via controller action (stripe/checkout), twig function (stripeCheckoutUrl()) and price element method (price.getCheckoutUrl()).