-
Notifications
You must be signed in to change notification settings - Fork 63
Mandate method check in Billable Trait #203
Comments
Hi @mmachatschek, I don't agree. The first line checks if there's a mandate id available, regardless of what method is configured on the subscription plan. If there is a mandate id set, the subscription is created without having to go through the checkout. |
@sandervanhooft as there is no early return you will always be redirected to the checkout even if you have a mandate set on the billable model because in case of the problem with the payment method I mentioned you won't get into the if statement to
|
I'm trying to understand what you mean. Is this issue with this line? && $mandate->method === $method Would changing it to this solve your issue? && (is_null($method) || $mandate->method === $method) |
The The main problem here is that PayPal is missing in the mollie-php-api If you set the first payment method in the cashier config Also if you pass a comma separated list of possible first payment methods, the value of |
Can you suggest a fix? |
@sandervanhooft I added a PR at mollie/mollie-api-php for the paypal issue |
I would suggest to change the line to: && ($planModel->firstPaymentMethod() === null || $mandate->method === $method) This way you can either let the user decide which payment method to use by setting the first payment method of the plan to null or (if explicitly set in the plan model) strictly check if the original mandate method is the same as the |
@mmachatschek I just used that and it works. I was having problems when I wanted to have multiple subscriptions for the same user. Nice one! |
Thanks @mmachatschek for the suggestion. Let's do that. Can you send in a PR? Thanks for confirming this @juancruzmartino . |
I"m curios for what reason the check
$method = MandateMethod::getForFirstPaymentMethod($planModel->firstPaymentMethod());
of the mandate method has been implemented on thenewSubscription
method in theBillable
trait.Because of this check, you are always redirected to the mollie checkout in case you have set
null
in the configcashier.first_payment.method
to let the user choose the payment method at checkout. This is mostly relevant when you add multiple subscriptions to the same billable modelThe text was updated successfully, but these errors were encountered: