Skip to content

[Klarna] Support payments in other presentment currencies when allowed #8984

Open

Description

Describe the bug

Klarna payments in general are restricted to domestic transactions; however, there is one exception that is outlined in the current documentation:

If you’re based in the EEA, UK, or Switzerland, then you can transact with consumers across the EEA, UK, and Switzerland, provided the presentment currency matches the currency of the customer’s country. For example, a Swedish business can present in EUR to accept Klarna from a buyer in Germany.

However, due to existing validations in the code, the Klarna payment method is not available when using a presentment currency different from the domestic currency used in the country that was selected during the WooPayments onboarding process.

To Reproduce

  1. Connect your store to a Stripe account from a Klarna-supported European country that doesn't use Euro as their domestic currency (e.g. United Kingdom)
  2. Enable Klarna
  3. As a shopper, set the currency to EUR, add a product to your cart and proceed to checkout
  4. As the billing country, select one Klarna-supported country that uses Euro as their domestic currency (e.g. Belgium)
  5. Notice the list of payment methods

Actual behavior

Klarna is not available as an option in the Payment Methods list.

Screenshots

Checkout

image

Expected behavior

Klarna should be available as an option in the Payment Methods list, and the order should succeed when using it.

Additional context

This issue related to #8718, however while the linked issue is focused on hiding Klarna when the location conditions are not met, while this issue should take care of showing Klarna when both the location and currency conditions are met.

The validations that are preventing Klarna from being displayed are mainly these two, since they force to only show the payment method when the cart currency matches the WooPayments account currency:

if ( [] !== $this->limits_per_currency ) {
$currency = get_woocommerce_currency();
// If the currency limits are not defined, we allow the PM for now (gateway has similar validation for limits).
// Additionally, we don't engage with limits verification in no-checkout context (cart is not available or empty).
if ( isset( $this->limits_per_currency[ $currency ], WC()->cart ) ) {
$amount = WC_Payments_Utils::prepare_amount( WC()->cart->get_total( '' ), $currency );
if ( $amount > 0 ) {
$range = null;
if ( isset( $this->limits_per_currency[ $currency ][ $account_country ] ) ) {
$range = $this->limits_per_currency[ $currency ][ $account_country ];
} elseif ( isset( $this->limits_per_currency[ $currency ]['default'] ) ) {
$range = $this->limits_per_currency[ $currency ]['default'];
}
// If there is no range specified for the currency-country pair we don't support it and return false.
if ( null === $range ) {
return false;
}
$is_valid_minimum = null === $range['min'] || $amount >= $range['min'];
$is_valid_maximum = null === $range['max'] || $amount <= $range['max'];
return $is_valid_minimum && $is_valid_maximum;
}
}
}

public function is_currency_valid( string $account_domestic_currency, $order_id = null ) {
$current_store_currency = $this->get_currency( $order_id );
if ( $this->has_domestic_transactions_restrictions() ) {
if ( strtolower( $current_store_currency ) !== strtolower( $account_domestic_currency ) ) {
return false;
}
}
return empty( $this->currencies ) || in_array( $current_store_currency, $this->currencies, true );
}

One of the biggest problems that would need to be solved is to figure out if the solution can be implemented entirely in the backend, or if it would be required to also implement frontend changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions