Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow the bypass of payment_method_types #251

Closed
mvanbeselaere opened this issue Oct 2, 2023 · 5 comments · Fixed by #284
Closed

Allow the bypass of payment_method_types #251

mvanbeselaere opened this issue Oct 2, 2023 · 5 comments · Fixed by #284

Comments

@mvanbeselaere
Copy link

mvanbeselaere commented Oct 2, 2023

Hey there,

The current default request by the CustomerController is set to ['bancontact', 'card', 'ideal'] as per

$setupIntent = [
'customer' => $customer->reference,
'payment_method_types' => ['bancontact', 'card', 'ideal'],
];

It would be cool to be able to select our own default payment_method_types in the settings.
Or is there a way to tweak that via the params object of the {{ gateway.getPaymentFormHtml(params)|raw }}?

Thanks a lot

@okolvik-avento
Copy link

This wouldn't just be cool. It's absolutely necessary to be able to configure the payment methods

@okolvik-avento
Copy link

Found a way to override it:

use craft\commerce\stripe\base\Gateway as StripeGateway;
use craft\commerce\stripe\events\BuildSetupIntentRequestEvent;

Event::on(
    StripeGateway::class,
    StripeGateway::EVENT_BUILD_SETUP_INTENT_REQUEST,
	function(BuildSetupIntentRequestEvent $event) {
		$event->request["payment_method_types"] = ["card"];
	}
);

@daniellelecomte
Copy link

Hi @okolvik-avento - trying to implement something similar here. Can you share how you are implementing this override?

@nfourtythree
Copy link
Contributor

Hi All

Thanks for highlighting this.

We have pushed a fix which means the payment method options shown to the user will now match those that are enabled in your Stripe dashboard.

As @okolvik-avento mentioned you can still alter/restrict these by using the Gateway::EVENT_BUILD_SETUP_INTENT_REQUEST event.

This fix will be included in the next release of the plugin.

Thanks!

@nfourtythree
Copy link
Contributor

Hi All

Version 4.1.1 of the plugin has now been released which includes this update.

Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
4 participants