Skip to content

Klarna payments are immediately captured — captureMode: manual not set for Klarna via Payments API #1372

@fuchsbart

Description

@fuchsbart

When using Klarna with the Payments API, payments are captured immediately upon creation. The "Automatically Ship on Marked Statuses" setting has no effect because the payment never reaches an authorized status — it goes straight to paid.

Config::MOLLIE_MANUAL_CAPTURE_METHODS only includes Riverty:

// src/Config/Config.php:420-422
public const MOLLIE_MANUAL_CAPTURE_METHODS = [
    self::RIVERTY,
];

This array is checked when building the payment request:

// src/Service/PaymentMethodService.php:338-340
if (in_array($molPaymentMethod->id_method, Config::MOLLIE_MANUAL_CAPTURE_METHODS)) {
    $paymentData->setCaptureMode('manual');
}

Since klarna is not in the list, captureMode is never set to manual. Mollie defaults to automatic capture, so the payment skips authorized and goes directly to paid.

Auto-Ship does not trigger Payments API captures

The actionOrderStatusUpdate hook (mollie.php:735-819) calls ShipmentSenderHandler, which goes through CanSendShipment::verify(). This verification rejects all Payments API transactions:

// src/Verification/Shipment/CanSendShipment.php:126-136
private function isShippingApplicable(int $orderId): bool
{
    // ...
    if ($paymentType !== PaymentTypeEnum::PAYMENT_TYPE_ORDER) {
        return false;  // always false for tr_xxx transactions
    }
    return true;
}

CaptureService::handleCapture() exists and correctly calls POST /v2/payments/{paymentId}/captures, but it is only used for manual captures from the admin UI (AdminMollieAjaxController.php:304, AdminMollieOrderController.php:62). It is never called from the auto-ship/status-change flow.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions