As soon as I add a restriction by billing address to a payment gateway that payment gateway will never appear, regardless of which country is chosen for the billing address. Example restriction I tried:

I don't understand how it's expected to update the billing address options unless the billing address was taken before the payment methods were shown (i.e. #3035976: Keep billing information as a separate pane instead of replacing it with the payment information pane). Switching country does perform an AJAX request, but it doesn't update anything other than the address fields.
As soon as I remove the country restriction, the payment method appears.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | Commerce v1 billing criteria.jpg | 373.98 KB | damienmckenna |
Comments
Comment #2
rob230 commentedSo from looking at the code, it's unclear to me whether this is a bug or not. It seems to be another consequence of making the billing address part of the payment information. As it stands, it's impossible for these conditions to work with the checkout flow provided by Commerce.
It returns FALSE until billing details have been saved on the order, so the only way to use that condition is to make billing address separate again: make your own checkout flow which has another step prior to 'Order information', undo the disabling of the separate BillingInformation pane in commerce_payment_commerce_checkout_pane_info_alter(), add billing information to your new step in the checkout flow, make your own PaymentInformation pane and use hook_commerce_checkout_pane_info_alter() to tell Drupal Commerce to use your class instead of the default one.
Comment #3
bojanz commentedConfirming #2. You select the payment gateway then input the address, not vice-versa. There is no way to limit a payment gateway by billing address, by design. That allows payment gateways to specify that they don't need billing information, and have it be hidden.
That means that the payment gateway form must hide the billing address condition.
EDIT: Funny enough, shipping is vice-versa (address then selection), and we have the opposite problem (you can limit shipping methods by address but can't have a shipping method which hides the address selection)
Comment #4
rob230 commentedNot sure I agree that the condition shouldn't be shown, as I intend to use it by asking for billing details first. In fact there are so many things in the checkout that need to depend on the billing country for me, putting it in the payment information pane has made things very difficult.
Comment #5
bojanz commentedIt's a difficult tradeoff, but one we made long ago. People implementing custom panes will also be able to unhide the condition.
Comment #6
markdcWe have a use case for billing country conditions. Not every country accepts the same methods. For example, Benelux is a union of 3 countries but their online payment methods differ: iDEAL for Netherlands, Bancontact for Belgium and none of the above for Luxembourg. From a UX perspective this should be reversed (as hinted at in #3).
Comment #7
dwkitchen commented#3170412: Allow a store to always collect a billing address before payment method selection will use this condition to be able to set the payment gateway based on billing address.
The removal of the condition should be Postponed while that issue is worked on, once resolved this issue can be Closed (works as designed).
Comment #8
damienmckennaThere are tangible business reasons why this is necessary.
In Commerce 1 on Drupal 7 it is possible to limit one payment method so it can only be used in one country, and other payment methods so they can be used in all countries except for that one. We've done that for years on a non-profit org's site and it works reliably.
What is the recommended way of implementing this business rule in Commerce 2, if not via this scenario?